varnish-3.0.5/0000755000175000017500000000000012247037213010173 500000000000000varnish-3.0.5/INSTALL0000644000175000017500000000152512247035455011155 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) --enable-werror use -Werror (default is NO) varnish-3.0.5/etc/0000755000175000017500000000000012247037207010751 500000000000000varnish-3.0.5/etc/Makefile.am0000644000175000017500000000132612234401732012721 00000000000000# EXTRA_DIST = zope-plone.vcl DISTCLEANFILES = default.vcl dist_varnishconf_DATA = default.vcl default.vcl: $(top_srcdir)/bin/varnishd/default.vcl ( printf "This is a basic VCL configuration file for varnish. See the vcl(7)\n\ man page for details on VCL syntax and semantics.\n\ \n\ Default backend definition. Set this to point to your content\n\ server.\n\ \n\ backend default {\n\ .host = \"127.0.0.1\";\n\ .port = \"8080\";\n\ }\n\ \n\ Below is a commented-out copy of the default VCL logic. If you\n\ redefine any of these subroutines, the built-in logic will be\n\ appended to your code.\n" ; \ sed -n '/vcl_recv/,$$p' $(top_srcdir)/bin/varnishd/default.vcl ) | \ sed 's/^\(.*\)$$/# \1/' > default.vcl varnish-3.0.5/etc/zope-plone.vcl0000644000175000017500000000541612247035455013500 00000000000000# # This is an example VCL configuration file for varnish, meant for the # Plone CMS running within Zope. It defines a "default" backend for # serving static content from a normal web server, and a "zope" # backend for requests to the Zope CMS # # See the vcl(7) man page for details on VCL syntax and semantics. # # $Id$ # # Default backend definition. Set this to point to your content # server. # Default backend is the Zope CMS backend default { .host = "127.0.0.1"; .port = "9673"; } acl purge { "localhost"; "192.0.2.0"/24; } sub vcl_recv { # Normalize host headers, and do rewriting for the zope sites. Reject # requests for unknown hosts if (req.http.host ~ "(www.)?example.com") { set req.http.host = "example.com"; set req.url = "/VirtualHostBase/http/example.com:80/example.com/VirtualHostRoot" + req.url; } elsif (req.http.host ~ "(www.)?example.org") { set req.http.host = "example.org"; set req.url = "/VirtualHostBase/http/example.org:80/example.org/VirtualHostRoot" + req.url; } else { error 404 "Unknown virtual host."; } # Handle special requests if (req.request != "GET" && req.request != "HEAD") { # POST - Logins and edits if (req.request == "POST") { return(pass); } # PURGE - The CacheFu product can invalidate updated URLs if (req.request == "PURGE") { if (!client.ip ~ purge) { error 405 "Not allowed."; } return(lookup); } # Do not cache the creation of objects in Plone if (req.url ~ "createObject"){ return(pass); } } # Don't cache authenticated requests if (req.http.Cookie && req.http.Cookie ~ "__ac(|_(name|password|persistent))=") { # Force lookup of specific urls unlikely to need protection if (req.url ~ "\.(js|css|kss)") { remove req.http.cookie; return(lookup); } return(pass); } # The default vcl_recv is used from here. } # Do the PURGE thing sub vcl_hit { if (req.request == "PURGE") { purge; error 200 "Purged"; } } sub vcl_miss { if (req.request == "PURGE") { purge; error 200 "Purged"; } } # Enforce a minimum TTL, since we can PURGE changed objects actively # from Zope by using the CacheFu product sub vcl_fetch { if (beresp.ttl < 3600s) { set beresp.ttl = 3600s; } } varnish-3.0.5/etc/default.vcl0000644000175000017500000000607512247037207013033 00000000000000# This is a basic VCL configuration file for varnish. See the vcl(7) # man page for details on VCL syntax and semantics. # # Default backend definition. Set this to point to your content # server. # # backend default { # .host = "127.0.0.1"; # .port = "8080"; # } # # Below is a commented-out copy of the default VCL logic. If you # redefine any of these subroutines, the built-in logic will be # appended to your code. # sub vcl_recv { # if (req.restarts == 0) { # if (req.http.x-forwarded-for) { # set req.http.X-Forwarded-For = # req.http.X-Forwarded-For + ", " + client.ip; # } else { # set req.http.X-Forwarded-For = client.ip; # } # } # if (req.request != "GET" && # req.request != "HEAD" && # req.request != "PUT" && # req.request != "POST" && # req.request != "TRACE" && # req.request != "OPTIONS" && # req.request != "DELETE") { # /* Non-RFC2616 or CONNECT which is weird. */ # return (pipe); # } # if (req.request != "GET" && req.request != "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 (lookup); # } # # sub vcl_pipe { # # Note that only the first request to the backend will have # # X-Forwarded-For set. If you use X-Forwarded-For and want to # # have it set for all requests, make sure to have: # # set bereq.http.connection = "close"; # # here. It is not set by default as it might break some broken web # # applications, like IIS with NTLM authentication. # return (pipe); # } # # sub vcl_pass { # return (pass); # } # # sub vcl_hash { # hash_data(req.url); # if (req.http.host) { # hash_data(req.http.host); # } else { # hash_data(server.ip); # } # return (hash); # } # # sub vcl_hit { # return (deliver); # } # # sub vcl_miss { # return (fetch); # } # # sub vcl_fetch { # if (beresp.ttl <= 0s || # beresp.http.Set-Cookie || # beresp.http.Vary == "*") { # /* # * Mark as "Hit-For-Pass" for the next 2 minutes # */ # set beresp.ttl = 120 s; # return (hit_for_pass); # } # return (deliver); # } # # sub vcl_deliver { # return (deliver); # } # # sub vcl_error { # set obj.http.Content-Type = "text/html; charset=utf-8"; # set obj.http.Retry-After = "5"; # synthetic {" # # # # # "} + obj.status + " " + obj.response + {" # # #

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

#

"} + obj.response + {"

#

Guru Meditation:

#

XID: "} + req.xid + {"

#
#

Varnish cache server

# # # "}; # return (deliver); # } # # sub vcl_init { # return (ok); # } # # sub vcl_fini { # return (ok); # } varnish-3.0.5/etc/Makefile.in0000644000175000017500000003674512247037162012755 00000000000000# Makefile.in generated by automake 1.14 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(dist_varnishconf_DATA) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.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_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : 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_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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)$(varnishconfdir)" DATA = $(dist_varnishconf_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIBS = @CURSES_LIBS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ 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@ JEMALLOC_SUBDIR = @JEMALLOC_SUBDIR@ 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@ 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@ XSLTPROC = @XSLTPROC@ 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 = zope-plone.vcl DISTCLEANFILES = default.vcl dist_varnishconf_DATA = default.vcl all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(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: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(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_varnishconfDATA: $(dist_varnishconf_DATA) @$(NORMAL_INSTALL) @list='$(dist_varnishconf_DATA)'; test -n "$(varnishconfdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(varnishconfdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(varnishconfdir)" || exit 1; \ fi; \ 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)$(varnishconfdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(varnishconfdir)" || exit $$?; \ done uninstall-dist_varnishconfDATA: @$(NORMAL_UNINSTALL) @list='$(dist_varnishconf_DATA)'; test -n "$(varnishconfdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(varnishconfdir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: 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)$(varnishconfdir)"; 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_varnishconfDATA 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_varnishconfDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am 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_varnishconfDATA 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 tags-am uninstall \ uninstall-am uninstall-dist_varnishconfDATA default.vcl: $(top_srcdir)/bin/varnishd/default.vcl ( printf "This is a basic VCL configuration file for varnish. See the vcl(7)\n\ man page for details on VCL syntax and semantics.\n\ \n\ Default backend definition. Set this to point to your content\n\ server.\n\ \n\ backend default {\n\ .host = \"127.0.0.1\";\n\ .port = \"8080\";\n\ }\n\ \n\ Below is a commented-out copy of the default VCL logic. If you\n\ redefine any of these subroutines, the built-in logic will be\n\ appended to your code.\n" ; \ sed -n '/vcl_recv/,$$p' $(top_srcdir)/bin/varnishd/default.vcl ) | \ sed 's/^\(.*\)$$/# \1/' > default.vcl # 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-3.0.5/Makefile.am0000644000175000017500000000164712247035455012165 00000000000000# ACLOCAL_AMFLAGS = -I m4 SUBDIRS = include lib bin man etc doc SUBDIRS += redhat pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = varnishapi.pc EXTRA_DIST = LICENSE autogen.sh varnishapi.pc.in DISTCHECK_CONFIGURE_FLAGS = \ --enable-developer-warnings \ --enable-debugging-symbols \ --enable-dependency-tracking \ --enable-diagnostics \ --enable-extra-developer-warnings \ --enable-tests \ --enable-werror install-data-local: $(install_sh) -d -m 0755 $(DESTDIR)$(localstatedir)/varnish distcheck-hook: V="@PACKAGE_VERSION@" ; \ V="$${V%%-*}" ; \ if ! grep "^Version: $$V$$" $(top_distdir)/redhat/varnish.spec && \ [ "@PACKAGE_VERSION@" != "trunk" ]; then \ echo "$$V" ; \ echo "redhat/varnish.spec does not have a version number matching the package" ; \ exit 1 ; \ fi distcleancheck_listfiles = \ find . -type f -exec sh -c 'test -f $(srcdir)/$$1 || echo $$1' \ sh '{}' ';' varnish-3.0.5/ltmain.sh0000644000175000017500000105202612247037157011750 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-1.3 # 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-1.3" 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-3.0.5/m4/0000755000175000017500000000000012247037207010516 500000000000000varnish-3.0.5/m4/ld-version-script.m40000644000175000017500000000274712247035455014301 00000000000000# ld-version-script.m4 serial 1 dnl Copyright (C) 2008, 2009 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 <='`$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*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; 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" && \ test undefined != "$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 ;; 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 | 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 ;; 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 | 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 | 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 | 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 ;; 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 | 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-3.0.5/m4/ax_pthread.m40000644000175000017500000002610112234401732013011 00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_pthread.html # =========================================================================== # # SYNOPSIS # # AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) # # DESCRIPTION # # This macro figures out how to build C programs using POSIX threads. It # sets the PTHREAD_LIBS output variable to the threads library and linker # flags, and the PTHREAD_CFLAGS output variable to any special C compiler # flags that are needed. (The user can also force certain compiler # flags/libs to be tested by setting these environment variables.) # # Also sets PTHREAD_CC to any special C compiler that is needed for # multi-threaded programs (defaults to the value of CC otherwise). (This # is necessary on AIX to use the special cc_r compiler alias.) # # NOTE: You are assumed to not only compile your program with these flags, # but also link it with them as well. e.g. you should link with # $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS # # If you are only building threads programs, you may wish to use these # variables in your default LIBS, CFLAGS, and CC: # # LIBS="$PTHREAD_LIBS $LIBS" # CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # CC="$PTHREAD_CC" # # In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant # has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name # (e.g. PTHREAD_CREATE_UNDETACHED on AIX). # # ACTION-IF-FOUND is a list of shell commands to run if a threads library # is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it # is not found. If ACTION-IF-FOUND is not specified, the default action # will define HAVE_PTHREAD. # # Please let the authors know if this macro fails on any platform, or if # you have any other suggestions or comments. This macro was based on work # by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help # from M. Frigo), as well as ac_pthread and hb_pthread macros posted by # Alejandro Forero Cuervo to the autoconf macro repository. We are also # grateful for the helpful feedback of numerous users. # # LICENSE # # Copyright (c) 2008 Steven G. Johnson # # 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-3.0.5/m4/ax_lib_readline.m40000644000175000017500000000744612234401732014006 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-3.0.5/m4/lt~obsolete.m40000644000175000017500000001375612247037157013272 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-3.0.5/m4/ltversion.m40000644000175000017500000000126212247037157012732 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-3.0.5/m4/ltsugar.m40000644000175000017500000001042412247037157012366 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-3.0.5/m4/ltoptions.m40000644000175000017500000003007312247037157012742 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-3.0.5/config.h.in0000644000175000017500000002014212247037161012137 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the `abort2' function. */ #undef HAVE_ABORT2 /* Define to 1 if you have the `backtrace' function. */ #undef HAVE_BACKTRACE /* Define to 1 if you have the `clock_gettime' function. */ #undef HAVE_CLOCK_GETTIME /* Define to 1 if you have the header file. */ #undef HAVE_CURSES_H /* 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_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 `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 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 you have the header file. */ #undef HAVE_NCURSES_CURSES_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 `srandomdev' function. */ #undef HAVE_SRANDOMDEV /* 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 to 1 if you have the `timegm' function. */ #undef HAVE_TIMEGM /* 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 SENDFILE works */ #undef SENDFILE_WORKS /* 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 /* Enable large inode numbers on Mac OS X 10.5. */ #ifndef _DARWIN_USE_64_BIT_INODE # define _DARWIN_USE_64_BIT_INODE 1 #endif /* 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-3.0.5/README0000644000175000017500000000077312240414672011003 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-3.0.5/configure.ac0000644000175000017500000003760512247035663012423 00000000000000AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (c) 2006 Verdens Gang AS Copyright (c) 2006-2011 Varnish Software AS]) AC_REVISION([$Id$]) AC_INIT([Varnish], [3.0.5], [varnish-dev@varnish-cache.org]) AC_CONFIG_SRCDIR(include/varnishapi.h) AM_CONFIG_HEADER(config.h) # save command line CFLAGS for use in VCC_CC (to pass through things like -m64) OCFLAGS="$CFLAGS" AC_CANONICAL_SYSTEM AC_LANG(C) AM_INIT_AUTOMAKE([foreign]) # 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_LIBTOOL AC_PROG_MAKE_SET AC_CHECK_PROGS(XSLTPROC, [xsltproc], "no") if test "x$XSLTPROC" = "xno"; then AC_MSG_WARN([xsltproc not found – not building documentation]) fi AM_CONDITIONAL(HAVE_XSLTPROC,[test "x$XSLTPROC" != "xno"]) 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_WARN([rst2man not found – not building man pages]) fi]) AM_CONDITIONAL(HAVE_RST2MAN,[test "x$RST2MAN" != "xno"]) 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"]) # 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) save_LIBS="${LIBS}" LIBS="" AC_SEARCH_LIBS(initscr, [curses ncurses], [have_curses=yes], [have_curses=no]) CURSES_LIBS="${LIBS}" LIBS="${save_LIBS}" AC_SUBST(CURSES_LIBS) if test "$have_curses" = no; then AC_MSG_WARN([curses not found; some tools will not be built]) fi AC_CHECK_HEADERS([ncurses/curses.h curses.h]) AM_CONDITIONAL([HAVE_CURSES], [test x$have_curses = xyes]) 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) PKG_CHECK_MODULES([LIBEDIT], [libedit], [AC_DEFINE([HAVE_LIBEDIT], [1], [Define we have libedit])], [AX_LIB_READLINE]) if test "$ac_cv_have_readline" = no; then AC_MSG_ERROR([libedit or readline not found]) fi # 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]) 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([abort2]) AC_CHECK_FUNCS([timegm]) AC_CHECK_FUNCS([nanosleep]) AC_CHECK_FUNCS([setppriv]) 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}" # sendfile is tricky: there are multiple versions, and most of them # don't work. case $target in *-*-freebsd*) AC_CACHE_CHECK([whether sendfile works], [ac_cv_so_sendfile_works], [AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ #include #include #include ]],[[ return (SF_SYNC == 0); ]])], [ac_cv_so_sendfile_works=yes], [ac_cv_so_sendfile_works=no]) ]) ;; #*-*-solaris*) # save_LIBS="${LIBS}" # LIBS="${NET_LIBS}" # AC_CHECK_LIB(sendfile, sendfile) # AC_CHECK_FUNCS([sendfile]) # AC_CHECK_FUNCS([sendfilev]) # NET_LIBS="${LIBS}" # LIBS="${save_LIBS}" *) AC_MSG_WARN([won't look for sendfile() on $target]) ;; esac if test "$ac_cv_so_sendfile_works" = yes; then AC_DEFINE([SENDFILE_WORKS], [1], [Define if SENDFILE works]) fi # 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_SUBDIR= 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_NOTICE([No system jemalloc found, using bundled version]) JEMALLOC_SUBDIR=libjemalloc JEMALLOC_LDADD='$(top_builddir)/lib/libjemalloc/libjemalloc_mt.la']) fi ;; esac AC_SUBST(JEMALLOC_SUBDIR) 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_CHECK_FUNCS([srandomdev]) AC_CHECK_FUNCS([backtrace]) # 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], [AC_MSG_ERROR([Python is needed to build Varnish, please install python.])]) # 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}" # 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 corresponds to FreeBSD's WARNS level 6 DEVELOPER_CFLAGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wformat" # Additional flags for GCC 4 EXTRA_DEVELOPER_CFLAGS="-Wextra -Wno-missing-field-initializers -Wno-sign-compare" # --enable-developer-warnings AC_ARG_ENABLE(developer-warnings, AS_HELP_STRING([--enable-developer-warnings],[enable strict warnings (default is NO)]), CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}") # --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") # --enable-diagnostics AC_ARG_ENABLE(diagnostics, AS_HELP_STRING([--enable-diagnostics],[enable run-time diagnostics (default is NO)]), CFLAGS="${CFLAGS} -DDIAGNOSTICS") # --enable-extra-developer-warnings AC_ARG_ENABLE(extra-developer-warnings, AS_HELP_STRING([--enable-extra-developer-warnings],[enable even stricter warnings (default is NO)]), [], [enable_extra_developer_warnings=no]) if test "x$enable_stack_protector" != "xno"; then save_CFLAGS="$CFLAGS" CFLAGS="${CFLAGS} ${EXTRA_DEVELOPER_CFLAGS}" AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([],[],[])], [], [AC_MSG_WARN([All of ${EXTRA_DEVELOPER_CFLAGS} not supported, disabling]) CFLAGS="$save_CFLAGS"]) fi # --enable-stack-protector AC_ARG_ENABLE(stack-protector, AS_HELP_STRING([--enable-stack-protector],[enable stack protector (default is NO)]), [], [enable_stack_protector=no]) if test "x$enable_stack_protector" != "xno"; then save_CFLAGS="$CFLAGS" CFLAGS="${CFLAGS} -fstack-protector-all" AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([],[],[])], [], [AC_MSG_WARN([-fstack-protector not supported, disabling]) CFLAGS="$save_CFLAGS"]) fi # --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]) # --enable-werror AC_ARG_ENABLE(werror, AS_HELP_STRING([--enable-werror],[use -Werror (default is NO)]), CFLAGS="${CFLAGS} -Werror") # 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]) # --enable-pcre-jit AC_ARG_ENABLE(pcre-jit, AS_HELP_STRING([--enable-pcre-jit], [use the PCRE JIT compiler (default is NO)]), , [enable_pcre_jit=no]) if test "$enable_pcre_jit" = yes; then AC_DEFINE([USE_PCRE_JIT],[1],[use the PCRE JIT compiler]) fi # Generate output AC_CONFIG_FILES([ Makefile bin/Makefile bin/varnishadm/Makefile bin/varnishd/Makefile bin/varnishlog/Makefile bin/varnishhist/Makefile bin/varnishncsa/Makefile bin/varnishreplay/Makefile bin/varnishstat/Makefile bin/varnishsizes/Makefile bin/varnishtest/Makefile bin/varnishtop/Makefile doc/Makefile doc/sphinx/Makefile doc/sphinx/conf.py etc/Makefile include/Makefile lib/Makefile lib/libvarnish/Makefile lib/libvarnishapi/Makefile lib/libvarnishcompat/Makefile lib/libvcl/Makefile lib/libvgz/Makefile lib/libvmod_std/Makefile lib/libjemalloc/Makefile man/Makefile redhat/Makefile varnishapi.pc ]) AC_OUTPUT varnish-3.0.5/test-driver0000755000175000017500000000761112247037162012321 00000000000000#! /bin/sh # test-driver - basic testsuite driver script. scriptversion=2012-06-27.10; # UTC # Copyright (C) 2011-2013 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. # This file is maintained in Automake, please report # bugs to or send patches to # . # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. set -u usage_error () { echo "$0: $*" >&2 print_usage >&2 exit 2 } print_usage () { cat <$log_file 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then estatus=1 fi case $estatus:$expect_failure in 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 0:*) col=$grn res=PASS recheck=no gcopy=no;; 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; *:*) col=$red res=FAIL recheck=yes gcopy=yes;; esac # Report outcome to console. echo "${col}${res}${std}: $test_name" # Register the test result, and other relevant metadata. echo ":test-result: $res" > $trs_file echo ":global-test-result: $res" >> $trs_file echo ":recheck: $recheck" >> $trs_file echo ":copy-in-global-log: $gcopy" >> $trs_file # 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-3.0.5/LICENSE0000644000175000017500000000245212234401732011120 00000000000000Copyright (c) 2006 Verdens Gang AS Copyright (c) 2006-2011 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-3.0.5/lib/0000755000175000017500000000000012247037207010744 500000000000000varnish-3.0.5/lib/libvarnishapi/0000755000175000017500000000000012247037207013577 500000000000000varnish-3.0.5/lib/libvarnishapi/Makefile.am0000644000175000017500000000146712247035455015566 00000000000000# INCLUDES = -I$(top_srcdir)/include @PCRE_CFLAGS@ lib_LTLIBRARIES = libvarnishapi.la libvarnishapi_la_LDFLAGS = -version-info 1:0:0 libvarnishapi_la_SOURCES = \ vsm_api.h \ vsl_api.h \ \ ../libvarnish/assert.c \ ../libvarnish/argv.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/vsha256.c \ vsm.c \ vsl_arg.c \ vsl.c \ vsc.c \ libvarnishapi.map libvarnishapi_la_CFLAGS = \ -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"' libvarnishapi_la_LIBADD = @PCRE_LIBS@ if HAVE_LD_VERSION_SCRIPT libvarnishapi_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libvarnishapi.map else libvarnishapi_la_LDFLAGS += -export-symbols-regex '^V' endif varnish-3.0.5/lib/libvarnishapi/vsl.c0000644000175000017500000002236312247035455014500 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 "vas.h" #include "vsm.h" #include "vsl.h" #include "vre.h" #include "vbm.h" #include "miniobj.h" #include "varnishapi.h" #include "vsm_api.h" #include "vsl_api.h" #include "vmb.h" /*--------------------------------------------------------------------*/ const char *VSL_tags[256] = { #define SLTM(foo) [SLT_##foo] = #foo, #include "vsl_tags.h" #undef SLTM }; /*--------------------------------------------------------------------*/ void VSL_Setup(struct VSM_data *vd) { struct vsl *vsl; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); AZ(vd->vsc); AZ(vd->vsl); ALLOC_OBJ(vsl, VSL_MAGIC); AN(vsl); vd->vsl = vsl; vsl->regflags = 0; /* XXX: Allocate only if log access */ vsl->vbm_client = vbit_init(4096); vsl->vbm_backend = vbit_init(4096); vsl->vbm_supress = vbit_init(256); vsl->vbm_select = vbit_init(256); vsl->r_fd = -1; /* XXX: Allocate only if -r option given ? */ vsl->rbuflen = 256; /* XXX ?? */ vsl->rbuf = malloc(vsl->rbuflen * 4L); assert(vsl->rbuf != NULL); vsl->num_matchers = 0; VTAILQ_INIT(&vsl->matchers); } /*--------------------------------------------------------------------*/ void VSL_Delete(struct VSM_data *vd) { struct vsl *vsl; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); vsl = vd->vsl; vd->vsl = NULL; CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC); vbit_destroy(vsl->vbm_client); vbit_destroy(vsl->vbm_backend); vbit_destroy(vsl->vbm_supress); vbit_destroy(vsl->vbm_select); free(vsl->rbuf); FREE_OBJ(vsl); } /*--------------------------------------------------------------------*/ void VSL_Select(const struct VSM_data *vd, unsigned tag) { struct vsl *vsl; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); vsl = vd->vsl; CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC); vbit_set(vsl->vbm_select, tag); } /*--------------------------------------------------------------------*/ void VSL_NonBlocking(const struct VSM_data *vd, int nb) { struct vsl *vsl; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); vsl = vd->vsl; CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC); if (nb) vsl->flags |= F_NON_BLOCKING; else vsl->flags &= ~F_NON_BLOCKING; } /*--------------------------------------------------------------------*/ static int vsl_nextlog(struct vsl *vsl, uint32_t **pp) { unsigned w, l; uint32_t t; int i; CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC); if (vsl->r_fd != -1) { assert(vsl->rbuflen >= 8); i = read(vsl->r_fd, vsl->rbuf, 8); if (i != 8) return (-1); l = 2 + VSL_WORDS(VSL_LEN(vsl->rbuf)); if (vsl->rbuflen < l) { l += 256; vsl->rbuf = realloc(vsl->rbuf, l * 4L); assert(vsl->rbuf != NULL); vsl->rbuflen = l; } i = read(vsl->r_fd, vsl->rbuf + 2, l * 4L - 8L); if (i != (l * 4L - 8L)) return (-1); *pp = vsl->rbuf; return (1); } for (w = 0; w < TIMEOUT_USEC;) { t = *vsl->log_ptr; if (t == VSL_WRAPMARKER) { /* Wrap around not possible at front */ assert(vsl->log_ptr != vsl->log_start + 1); vsl->log_ptr = vsl->log_start + 1; VRMB(); continue; } if (t == VSL_ENDMARKER) { if (vsl->log_ptr != vsl->log_start + 1 && vsl->last_seq != vsl->log_start[0]) { /* ENDMARKER not at front and seq wrapped */ vsl->log_ptr = vsl->log_start + 1; VRMB(); continue; } if (vsl->flags & F_NON_BLOCKING) return (-1); w += SLEEP_USEC; assert(usleep(SLEEP_USEC) == 0 || errno == EINTR); continue; } if (vsl->log_ptr == vsl->log_start + 1) vsl->last_seq = vsl->log_start[0]; *pp = (void*)(uintptr_t)vsl->log_ptr; /* Loose volatile */ vsl->log_ptr = VSL_NEXT(vsl->log_ptr); return (1); } *pp = NULL; return (0); } int VSL_NextLog(const struct VSM_data *vd, uint32_t **pp, uint64_t *bits) { struct vsl *vsl; uint32_t *p; unsigned char t; unsigned u; int i; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); vsl = vd->vsl; CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC); while (1) { i = vsl_nextlog(vsl, &p); if (i != 1) return (i); u = VSL_ID(p); t = VSL_TAG(p); switch(t) { case SLT_SessionOpen: case SLT_ReqStart: vbit_set(vsl->vbm_client, u); vbit_clr(vsl->vbm_backend, u); break; case SLT_BackendOpen: case SLT_BackendXID: vbit_clr(vsl->vbm_client, u); vbit_set(vsl->vbm_backend, u); break; default: break; } if (vsl->skip) { --vsl->skip; continue; } else if (vsl->keep) { if (--vsl->keep == 0) return (-1); } if (vbit_test(vsl->vbm_select, t)) { *pp = p; return (1); } if (vbit_test(vsl->vbm_supress, t)) continue; if (vsl->b_opt && !vbit_test(vsl->vbm_backend, u) && !vsl->c_opt) continue; if (vsl->c_opt && !vbit_test(vsl->vbm_client, u) && !vsl->b_opt) continue; if (vsl->regincl != NULL) { i = VRE_exec(vsl->regincl, VSL_DATA(p), VSL_LEN(p), 0, 0, NULL, 0, NULL); if (i == VRE_ERROR_NOMATCH) continue; } if (vsl->regexcl != NULL) { i = VRE_exec(vsl->regexcl, VSL_DATA(p), VSL_LEN(p), 0, 0, NULL, 0, NULL); if (i != VRE_ERROR_NOMATCH) continue; } if (bits != NULL) { struct vsl_re_match *vrm; int j = 0; VTAILQ_FOREACH(vrm, &vsl->matchers, next) { if (vrm->tag == t) { i = VRE_exec(vrm->re, VSL_DATA(p), VSL_LEN(p), 0, 0, NULL, 0, NULL); if (i >= 0) *bits |= (uintmax_t)1 << j; } j++; } } *pp = p; return (1); } } /*--------------------------------------------------------------------*/ int VSL_Dispatch(struct VSM_data *vd, VSL_handler_f *func, void *priv) { struct vsl *vsl; int i; unsigned u, l, s; uint32_t *p; uint64_t bitmap; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); vsl = vd->vsl; CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC); while (1) { bitmap = 0; i = VSL_NextLog(vd, &p, &bitmap); if (i == 0 && VSM_ReOpen(vd, 0) == 1) continue; if (i != 1) return (i); u = VSL_ID(p); l = VSL_LEN(p); s = 0; if (vbit_test(vsl->vbm_backend, u)) s |= VSL_S_BACKEND; if (vbit_test(vsl->vbm_client, u)) s |= VSL_S_CLIENT; if (func(priv, VSL_TAG(p), u, l, s, VSL_DATA(p), bitmap)) return (1); } } /*--------------------------------------------------------------------*/ int VSL_H_Print(void *priv, enum VSL_tag_e tag, unsigned fd, unsigned len, unsigned spec, const char *ptr, uint64_t bitmap) { FILE *fo = priv; int type; (void) bitmap; assert(fo != NULL); type = (spec & VSL_S_CLIENT) ? 'c' : (spec & VSL_S_BACKEND) ? 'b' : '-'; if (tag == SLT_Debug) { fprintf(fo, "%5u %-12s %c \"", fd, VSL_tags[tag], type); while (len-- > 0) { if (*ptr >= ' ' && *ptr <= '~') fprintf(fo, "%c", *ptr); else fprintf(fo, "%%%02x", (unsigned char)*ptr); ptr++; } fprintf(fo, "\"\n"); return (0); } fprintf(fo, "%5u %-12s %c %.*s\n", fd, VSL_tags[tag], type, len, ptr); return (0); } /*--------------------------------------------------------------------*/ void VSL_Open_CallBack(struct VSM_data *vd) { struct vsl *vsl; struct VSM_chunk *sha; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); vsl = vd->vsl; CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC); sha = VSM_find_alloc(vd, VSL_CLASS, "", ""); assert(sha != NULL); vsl->log_start = VSM_PTR(sha); vsl->log_end = VSM_NEXT(sha); vsl->log_ptr = vsl->log_start + 1; vsl->last_seq = vsl->log_start[0]; VRMB(); } /*--------------------------------------------------------------------*/ int VSL_Open(struct VSM_data *vd, int diag) { struct vsl *vsl; int i; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); vsl = vd->vsl; CHECK_OBJ_NOTNULL(vsl, VSL_MAGIC); if (vsl->r_fd == -1) { i = VSM_Open(vd, diag); if (i) return (i); } if (!vsl->d_opt && vsl->r_fd == -1) { while (*vsl->log_ptr != VSL_ENDMARKER) vsl->log_ptr = VSL_NEXT(vsl->log_ptr); } return (0); } /*--------------------------------------------------------------------*/ int VSL_Matched(const struct VSM_data *vd, uint64_t bitmap) { if (vd->vsl->num_matchers > 0) { uint64_t t; t = vd->vsl->num_matchers | (vd->vsl->num_matchers - 1); return (bitmap == t); } return (1); } varnish-3.0.5/lib/libvarnishapi/vsm_api.h0000644000175000017500000000412212247035455015330 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. * */ /* Parameters */ #define SLEEP_USEC (50*1000) #define TIMEOUT_USEC (5*1000*1000) struct vsc; struct VSM_data { unsigned magic; #define VSM_MAGIC 0x6e3bd69b VSM_diag_f *diag; void *priv; char *n_opt; char *fname; struct stat fstat; int vsm_fd; struct VSM_head *VSM_head; void *vsm_end; unsigned alloc_seq; /* Stuff relating the stats fields start here */ struct vsc *vsc; struct vsl *vsl; }; struct VSM_chunk *VSM_find_alloc(struct VSM_data *vd, const char *class, const char *type, const char *ident); void VSC_Delete(struct VSM_data *vd); void VSL_Delete(struct VSM_data *vd); void VSL_Open_CallBack(struct VSM_data *vd); varnish-3.0.5/lib/libvarnishapi/vsl_arg.c0000644000175000017500000001525012247035455015326 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 "vas.h" #include "vre.h" #include "vbm.h" #include "miniobj.h" #include "varnishapi.h" #include "vsm_api.h" #include "vsl_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 < 256; 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); } /*--------------------------------------------------------------------*/ static int vsl_r_arg(const struct VSM_data *vd, const char *opt) { CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); if (!strcmp(opt, "-")) vd->vsl->r_fd = STDIN_FILENO; else vd->vsl->r_fd = open(opt, O_RDONLY); if (vd->vsl->r_fd < 0) { perror(opt); return (-1); } return (1); } /*--------------------------------------------------------------------*/ static int vsl_IX_arg(const struct VSM_data *vd, const char *opt, int arg) { vre_t **rp; const char *error; int erroroffset; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); if (arg == 'I') rp = &vd->vsl->regincl; else rp = &vd->vsl->regexcl; if (*rp != NULL) { fprintf(stderr, "Option %c can only be given once", arg); return (-1); } *rp = VRE_compile(opt, vd->vsl->regflags, &error, &erroroffset); if (*rp == NULL) { fprintf(stderr, "Illegal regex: %s\n", error); return (-1); } return (1); } /*--------------------------------------------------------------------*/ static int vsl_ix_arg(const struct VSM_data *vd, const char *opt, int arg) { int i, l; const char *b, *e; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); /* If first option is 'i', set all bits for supression */ if (arg == 'i' && !(vd->vsl->flags & F_SEEN_IX)) for (i = 0; i < 256; i++) vbit_set(vd->vsl->vbm_supress, i); vd->vsl->flags |= F_SEEN_IX; for (b = opt; *b; b = e) { while (isspace(*b)) b++; e = strchr(b, ','); if (e == NULL) e = strchr(b, '\0'); l = e - b; if (*e == ',') e++; while (isspace(b[l - 1])) l--; i = VSL_Name2Tag(b, l); if (i >= 0) { if (arg == 'x') vbit_set(vd->vsl->vbm_supress, i); else vbit_clr(vd->vsl->vbm_supress, i); } else if (i == -2) { fprintf(stderr, "\"%*.*s\" matches multiple tags\n", l, l, b); return (-1); } else { fprintf(stderr, "Could not match \"%*.*s\" to any tag\n", l, l, b); return (-1); } } return (1); } /*--------------------------------------------------------------------*/ static int vsl_m_arg(const struct VSM_data *vd, const char *opt) { struct vsl_re_match *m; const char *error; char *o, *regex; int erroroffset; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); if (!strchr(opt, ':')) { fprintf(stderr, "No : found in -o option %s\n", opt); return (-1); } o = strdup(opt); AN(o); regex = strchr(o, ':'); *regex = '\0'; regex++; ALLOC_OBJ(m, VSL_RE_MATCH_MAGIC); AN(m); m->tag = VSL_Name2Tag(o, -1); if (m->tag < 0) { fprintf(stderr, "Illegal tag %s specified\n", o); free(o); FREE_OBJ(m); return (-1); } /* Get tag, regex */ m->re = VRE_compile(regex, vd->vsl->regflags, &error, &erroroffset); if (m->re == NULL) { fprintf(stderr, "Illegal regex: %s\n", error); free(o); FREE_OBJ(m); return (-1); } vd->vsl->num_matchers++; VTAILQ_INSERT_TAIL(&vd->vsl->matchers, m, next); free(o); return (1); } /*--------------------------------------------------------------------*/ static int vsl_s_arg(const struct VSM_data *vd, const char *opt) { char *end; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); if (*opt == '\0') { fprintf(stderr, "number required for -s\n"); return (-1); } vd->vsl->skip = strtoul(opt, &end, 10); if (*end != '\0') { fprintf(stderr, "invalid number for -s\n"); return (-1); } return (1); } /*--------------------------------------------------------------------*/ static int vsl_k_arg(const struct VSM_data *vd, const char *opt) { char *end; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); if (*opt == '\0') { fprintf(stderr, "number required for -k\n"); return (-1); } vd->vsl->keep = strtoul(opt, &end, 10); if (*end != '\0') { fprintf(stderr, "invalid number for -k\n"); return (-1); } return (1); } /*--------------------------------------------------------------------*/ int VSL_Arg(struct VSM_data *vd, int arg, const char *opt) { CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); switch (arg) { case 'b': vd->vsl->b_opt = !vd->vsl->b_opt; return (1); case 'c': vd->vsl->c_opt = !vd->vsl->c_opt; return (1); case 'd': vd->vsl->d_opt = !vd->vsl->d_opt; vd->vsl->flags |= F_NON_BLOCKING; return (1); case 'i': case 'x': return (vsl_ix_arg(vd, opt, arg)); case 'k': return (vsl_k_arg(vd, opt)); case 'n': return (VSM_n_Arg(vd, opt)); case 'r': return (vsl_r_arg(vd, opt)); case 's': return (vsl_s_arg(vd, opt)); case 'I': case 'X': return (vsl_IX_arg(vd, opt, arg)); case 'm': return (vsl_m_arg(vd, opt)); case 'C': vd->vsl->regflags = VRE_CASELESS; return (1); default: return (0); } } varnish-3.0.5/lib/libvarnishapi/Makefile.in0000644000175000017500000011401412247037163015566 00000000000000# Makefile.in generated by automake 1.14 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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' subdir = lib/libvarnishapi DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.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-assert.lo \ libvarnishapi_la-argv.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-vsha256.lo libvarnishapi_la-vsm.lo \ libvarnishapi_la-vsl_arg.lo libvarnishapi_la-vsl.lo \ libvarnishapi_la-vsc.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 am__v_lt_1 = libvarnishapi_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(libvarnishapi_la_CFLAGS) $(CFLAGS) \ $(libvarnishapi_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : 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_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/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_CC_1 = 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_CCLD_1 = SOURCES = $(libvarnishapi_la_SOURCES) DIST_SOURCES = $(libvarnishapi_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIBS = @CURSES_LIBS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ 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@ JEMALLOC_SUBDIR = @JEMALLOC_SUBDIR@ 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@ 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@ XSLTPROC = @XSLTPROC@ 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@ INCLUDES = -I$(top_srcdir)/include @PCRE_CFLAGS@ lib_LTLIBRARIES = libvarnishapi.la libvarnishapi_la_LDFLAGS = -version-info 1:0:0 $(am__append_1) \ $(am__append_2) libvarnishapi_la_SOURCES = \ vsm_api.h \ vsl_api.h \ \ ../libvarnish/assert.c \ ../libvarnish/argv.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/vsha256.c \ vsm.c \ vsl_arg.c \ vsl.c \ vsc.c \ libvarnishapi.map libvarnishapi_la_CFLAGS = \ -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"' libvarnishapi_la_LIBADD = @PCRE_LIBS@ all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(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: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @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 " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ 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)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } 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) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnishapi_la-argv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnishapi_la-assert.Plo@am__quote@ @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-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-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-vsm.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 -o $@ $< .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 -o $@ `$(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-assert.lo: ../libvarnish/assert.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-assert.lo -MD -MP -MF $(DEPDIR)/libvarnishapi_la-assert.Tpo -c -o libvarnishapi_la-assert.lo `test -f '../libvarnish/assert.c' || echo '$(srcdir)/'`../libvarnish/assert.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnishapi_la-assert.Tpo $(DEPDIR)/libvarnishapi_la-assert.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/assert.c' object='libvarnishapi_la-assert.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-assert.lo `test -f '../libvarnish/assert.c' || echo '$(srcdir)/'`../libvarnish/assert.c libvarnishapi_la-argv.lo: ../libvarnish/argv.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-argv.lo -MD -MP -MF $(DEPDIR)/libvarnishapi_la-argv.Tpo -c -o libvarnishapi_la-argv.lo `test -f '../libvarnish/argv.c' || echo '$(srcdir)/'`../libvarnish/argv.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnishapi_la-argv.Tpo $(DEPDIR)/libvarnishapi_la-argv.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../libvarnish/argv.c' object='libvarnishapi_la-argv.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-argv.lo `test -f '../libvarnish/argv.c' || echo '$(srcdir)/'`../libvarnish/argv.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-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.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 mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ 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-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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)$(libdir)"; 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-libLTLIBRARIES 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-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: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ ctags-am 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 tags-am uninstall uninstall-am uninstall-libLTLIBRARIES # 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-3.0.5/lib/libvarnishapi/vsm.c0000644000175000017500000002025412247035455014476 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 "vas.h" #include "vin.h" #include "vsm.h" #include "vbm.h" #include "miniobj.h" #include "varnishapi.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); AN(vd); vd->diag = (VSM_diag_f*)fprintf; vd->priv = stderr; vd->vsm_fd = -1; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); return (vd); } /*--------------------------------------------------------------------*/ void VSM_Diag(struct VSM_data *vd, VSM_diag_f *func, void *priv) { CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); if (func == NULL) vd->diag = (VSM_diag_f*)getpid; else vd->diag = func; vd->priv = priv; } /*--------------------------------------------------------------------*/ int VSM_n_Arg(struct VSM_data *vd, const char *opt) { CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); REPLACE(vd->n_opt, opt); AN(vd->n_opt); if (VIN_N_Arg(vd->n_opt, NULL, NULL, &vd->fname)) { vd->diag(vd->priv, "Invalid instance name: %s\n", strerror(errno)); return (-1); } return (1); } /*--------------------------------------------------------------------*/ const char * VSM_Name(const struct VSM_data *vd) { CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); return (vd->n_opt); } /*--------------------------------------------------------------------*/ void VSM_Delete(struct VSM_data *vd) { CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); VSM_Close(vd); free(vd->n_opt); free(vd->fname); if (vd->vsc != NULL) VSC_Delete(vd); if (vd->vsl != NULL) VSL_Delete(vd); free(vd); } /*--------------------------------------------------------------------*/ static int vsm_open(struct VSM_data *vd, int diag) { int i, j; struct VSM_head slh; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); AZ(vd->VSM_head); AN(vd->fname); vd->vsm_fd = open(vd->fname, O_RDONLY); if (vd->vsm_fd < 0) { if (diag) vd->diag(vd->priv, "Cannot open %s: %s\n", vd->fname, strerror(errno)); return (1); } assert(fstat(vd->vsm_fd, &vd->fstat) == 0); if (!S_ISREG(vd->fstat.st_mode)) { if (diag) vd->diag(vd->priv, "%s is not a regular file\n", vd->fname); AZ(close(vd->vsm_fd)); vd->vsm_fd = -1; return (1); } i = read(vd->vsm_fd, &slh, sizeof slh); if (i != sizeof slh) { if (diag) vd->diag(vd->priv, "Cannot read %s: %s\n", vd->fname, strerror(errno)); AZ(close(vd->vsm_fd)); vd->vsm_fd = -1; return (1); } if (slh.magic != VSM_HEAD_MAGIC) { if (diag) vd->diag(vd->priv, "Wrong magic number in file %s\n", vd->fname); AZ(close(vd->vsm_fd)); vd->vsm_fd = -1; return (1); } vd->VSM_head = (void *)mmap(NULL, slh.shm_size, PROT_READ, MAP_SHARED|MAP_HASSEMAPHORE, vd->vsm_fd, 0); if (vd->VSM_head == MAP_FAILED) { if (diag) vd->diag(vd->priv, "Cannot mmap %s: %s\n", vd->fname, strerror(errno)); AZ(close(vd->vsm_fd)); vd->vsm_fd = -1; vd->VSM_head = NULL; return (1); } vd->vsm_end = (uint8_t *)vd->VSM_head + slh.shm_size; for (j = 0; j < 20 && vd->VSM_head->alloc_seq == 0; j++) (void)usleep(50000); if (vd->VSM_head->alloc_seq == 0) { if (diag) vd->diag(vd->priv, "File not initialized %s\n", vd->fname); assert(0 == munmap((void*)vd->VSM_head, slh.shm_size)); AZ(close(vd->vsm_fd)); vd->vsm_fd = -1; vd->VSM_head = NULL; return (1); } vd->alloc_seq = vd->VSM_head->alloc_seq; if (vd->vsl != NULL) VSL_Open_CallBack(vd); return (0); } /*--------------------------------------------------------------------*/ int VSM_Open(struct VSM_data *vd, int diag) { CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); AZ(vd->VSM_head); if (!vd->n_opt) (void)VSM_n_Arg(vd, ""); return (vsm_open(vd, diag)); } /*--------------------------------------------------------------------*/ void VSM_Close(struct VSM_data *vd) { CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); if (vd->VSM_head == NULL) return; assert(0 == munmap((void*)vd->VSM_head, vd->VSM_head->shm_size)); vd->VSM_head = NULL; assert(vd->vsm_fd >= 0); assert(0 == close(vd->vsm_fd)); vd->vsm_fd = -1; } /*--------------------------------------------------------------------*/ int VSM_ReOpen(struct VSM_data *vd, int diag) { struct stat st; int i; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); AN(vd->VSM_head); if (stat(vd->fname, &st)) return (0); if (st.st_dev == vd->fstat.st_dev && st.st_ino == vd->fstat.st_ino) return (0); VSM_Close(vd); for (i = 0; i < 5; i++) { /* XXX param */ if (!vsm_open(vd, 0)) return (1); } if (vsm_open(vd, diag)) return (-1); return (1); } /*--------------------------------------------------------------------*/ struct VSM_head * VSM_Head(const struct VSM_data *vd) { CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); AN(vd->VSM_head); return(vd->VSM_head); } /*--------------------------------------------------------------------*/ struct VSM_chunk * VSM_find_alloc(struct VSM_data *vd, const char *class, const char *type, const char *ident) { struct VSM_chunk *sha; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); AN(vd->VSM_head); VSM_FOREACH(sha, vd) { CHECK_OBJ_NOTNULL(sha, VSM_CHUNK_MAGIC); if (strcmp(sha->class, class)) continue; if (type != NULL && strcmp(sha->type, type)) continue; if (ident != NULL && strcmp(sha->ident, ident)) continue; return (sha); } return (NULL); } /*--------------------------------------------------------------------*/ void * VSM_Find_Chunk(struct VSM_data *vd, const char *class, const char *type, const char *ident, unsigned *lenp) { struct VSM_chunk *sha; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); sha = VSM_find_alloc(vd, class, type, ident); if (sha == NULL) return (NULL); if (lenp != NULL) *lenp = sha->len - sizeof *sha; return (VSM_PTR(sha)); } /*--------------------------------------------------------------------*/ struct VSM_chunk * VSM_iter0(struct VSM_data *vd) { CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); vd->alloc_seq = vd->VSM_head->alloc_seq; while (vd->alloc_seq == 0) { (void)usleep(50000); vd->alloc_seq = vd->VSM_head->alloc_seq; } CHECK_OBJ_NOTNULL(&vd->VSM_head->head, VSM_CHUNK_MAGIC); return (&vd->VSM_head->head); } void VSM_itern(const struct VSM_data *vd, struct VSM_chunk **pp) { CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); if (vd->alloc_seq != vd->VSM_head->alloc_seq) { *pp = NULL; return; } CHECK_OBJ_NOTNULL(*pp, VSM_CHUNK_MAGIC); *pp = VSM_NEXT(*pp); if ((void*)(*pp) >= vd->vsm_end) { *pp = NULL; return; } CHECK_OBJ_NOTNULL(*pp, VSM_CHUNK_MAGIC); } /*--------------------------------------------------------------------*/ unsigned VSM_Seq(const struct VSM_data *vd) { CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); return (vd->VSM_head->alloc_seq); } varnish-3.0.5/lib/libvarnishapi/vsl_api.h0000644000175000017500000000527012247035455015334 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 "vqueue.h" struct vsl_re_match { unsigned magic; #define VSL_RE_MATCH_MAGIC 0x4013151e int tag; vre_t *re; VTAILQ_ENTRY(vsl_re_match) next; }; struct vsl { unsigned magic; #define VSL_MAGIC 0x7a31db38 /* Stuff relating the log records below here */ volatile uint32_t *log_start; volatile uint32_t *log_end; volatile uint32_t *log_ptr; volatile uint32_t last_seq; /* for -r option */ int r_fd; unsigned rbuflen; uint32_t *rbuf; int b_opt; int c_opt; int d_opt; unsigned flags; #define F_SEEN_IX (1 << 0) #define F_NON_BLOCKING (1 << 1) /* * These two bitmaps mark fd's as belonging to client or backend * transactions respectively. */ struct vbitmap *vbm_client; struct vbitmap *vbm_backend; /* * Bit map of programatically selected tags, that cannot be suppressed. * This way programs can make sure they will see certain tags, even * if the user tries to supress them with -x/-X */ struct vbitmap *vbm_select; /* index: tag */ /* Bit map of tags selected/supressed with -[iIxX] options */ struct vbitmap *vbm_supress; /* index: tag */ int regflags; vre_t *regincl; vre_t *regexcl; int num_matchers; VTAILQ_HEAD(, vsl_re_match) matchers; unsigned long skip; unsigned long keep; }; varnish-3.0.5/lib/libvarnishapi/libvarnishapi.map0000644000175000017500000000370712247035455017063 00000000000000/*- * Copyright (c) 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. */ 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; varnish-3.0.5/lib/libvarnishapi/vsc.c0000644000175000017500000001675012247035455014472 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 "vas.h" #include "vav.h" #include "vsm.h" #include "vsc.h" #include "vqueue.h" #include "miniobj.h" #include "varnishapi.h" #include "vsm_api.h" struct vsc_sf { unsigned magic; #define VSL_SF_MAGIC 0x558478dd VTAILQ_ENTRY(vsc_sf) next; int flags; #define VSL_SF_EXCL (1 << 0) #define VSL_SF_CL_WC (1 << 1) #define VSL_SF_ID_WC (1 << 2) #define VSL_SF_NM_WC (1 << 3) char *class; char *ident; char *name; }; struct vsc { unsigned magic; #define VSC_MAGIC 0x3373554a int sf_init; VTAILQ_HEAD(, vsc_sf) sf_list; }; /*--------------------------------------------------------------------*/ void VSC_Setup(struct VSM_data *vd) { CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); AZ(vd->vsc); AZ(vd->vsl); ALLOC_OBJ(vd->vsc, VSC_MAGIC); AN(vd->vsc); VTAILQ_INIT(&vd->vsc->sf_list); } /*--------------------------------------------------------------------*/ void VSC_Delete(struct VSM_data *vd) { struct vsc_sf *sf; struct vsc *vsc; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); vsc = vd->vsc; vd->vsc = NULL; CHECK_OBJ_NOTNULL(vsc, VSC_MAGIC); while(!VTAILQ_EMPTY(&vsc->sf_list)) { sf = VTAILQ_FIRST(&vsc->sf_list); VTAILQ_REMOVE(&vsc->sf_list, sf, next); free(sf->class); free(sf->ident); free(sf->name); FREE_OBJ(sf); } } /*--------------------------------------------------------------------*/ static int vsc_sf_arg(const struct VSM_data *vd, const char *opt) { struct vsc *vsc; struct vsc_sf *sf; char **av, *q, *p; int i; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); vsc = vd->vsc; CHECK_OBJ_NOTNULL(vsc, VSC_MAGIC); if (VTAILQ_EMPTY(&vsc->sf_list)) { if (*opt == '^') vsc->sf_init = 1; } av = VAV_Parse(opt, NULL, ARGV_COMMA); AN(av); if (av[0] != NULL) { vd->diag(vd->priv, "Parse error: %s", av[0]); return (-1); } for (i = 1; av[i] != NULL; i++) { ALLOC_OBJ(sf, VSL_SF_MAGIC); AN(sf); VTAILQ_INSERT_TAIL(&vsc->sf_list, sf, next); p = av[i]; if (*p == '^') { sf->flags |= VSL_SF_EXCL; p++; } q = strchr(p, '.'); if (q != NULL) { *q++ = '\0'; if (*p != '\0') REPLACE(sf->class, p); p = q; if (*p != '\0') { q = strchr(p, '.'); if (q != NULL) { *q++ = '\0'; if (*p != '\0') REPLACE(sf->ident, p); p = q; } } } if (*p != '\0') { REPLACE(sf->name, p); } /* Check for wildcards */ if (sf->class != NULL) { q = strchr(sf->class, '*'); if (q != NULL && q[1] == '\0') { *q = '\0'; sf->flags |= VSL_SF_CL_WC; } } if (sf->ident != NULL) { q = strchr(sf->ident, '*'); if (q != NULL && q[1] == '\0') { *q = '\0'; sf->flags |= VSL_SF_ID_WC; } } if (sf->name != NULL) { q = strchr(sf->name, '*'); if (q != NULL && q[1] == '\0') { *q = '\0'; sf->flags |= VSL_SF_NM_WC; } } } VAV_Free(av); return (1); } /*--------------------------------------------------------------------*/ int VSC_Arg(struct VSM_data *vd, int arg, const char *opt) { CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); AN(vd->vsc); switch (arg) { case 'f': return (vsc_sf_arg(vd, opt)); case 'n': return (VSM_n_Arg(vd, opt)); default: return (0); } } /*--------------------------------------------------------------------*/ int VSC_Open(struct VSM_data *vd, int diag) { int i; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); AN(vd->vsc); i = VSM_Open(vd, diag); return (i); } /*--------------------------------------------------------------------*/ struct VSC_C_main * VSC_Main(struct VSM_data *vd) { struct VSM_chunk *sha; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); CHECK_OBJ_NOTNULL(vd->vsc, VSC_MAGIC); sha = VSM_find_alloc(vd, VSC_CLASS, "", ""); assert(sha != NULL); return (VSM_PTR(sha)); } /*-------------------------------------------------------------------- * -1 -> unknown stats encountered. */ 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 int iter_call(const struct vsc *vsc, VSC_iter_f *func, void *priv, const struct VSC_point *const sp) { struct vsc_sf *sf; int good; CHECK_OBJ_NOTNULL(vsc, VSC_MAGIC); if (VTAILQ_EMPTY(&vsc->sf_list)) return (func(priv, sp)); good = vsc->sf_init; VTAILQ_FOREACH(sf, &vsc->sf_list, next) { if (iter_test(sf->class, sp->class, sf->flags & VSL_SF_CL_WC)) continue; if (iter_test(sf->ident, sp->ident, sf->flags & VSL_SF_ID_WC)) continue; if (iter_test(sf->name, sp->name, sf->flags & VSL_SF_NM_WC)) continue; if (sf->flags & VSL_SF_EXCL) good = 0; else good = 1; } if (!good) return (0); return (func(priv, sp)); } #define VSC_DO(U,l,t) \ static int \ iter_##l(const struct vsc *vsc, struct VSM_chunk *sha, \ VSC_iter_f *func, void *priv) \ { \ struct VSC_C_##l *st; \ struct VSC_point sp; \ int i; \ \ CHECK_OBJ_NOTNULL(vsc, VSC_MAGIC); \ CHECK_OBJ_NOTNULL(sha, VSM_CHUNK_MAGIC); \ st = VSM_PTR(sha); \ sp.class = t; \ sp.ident = sha->ident; #define VSC_F(nn,tt,ll,ff,dd,ee) \ sp.name = #nn; \ sp.fmt = #tt; \ sp.flag = ff; \ sp.desc = dd; \ sp.ptr = &st->nn; \ i = iter_call(vsc, func, priv, &sp); \ if (i) \ return(i); #define VSC_DONE(U,l,t) \ return (0); \ } #include "vsc_all.h" #undef VSC_DO #undef VSC_F #undef VSC_DONE int VSC_Iter(struct VSM_data *vd, VSC_iter_f *func, void *priv) { struct vsc *vsc; struct VSM_chunk *sha; int i; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); vsc = vd->vsc; CHECK_OBJ_NOTNULL(vsc, VSC_MAGIC); i = 0; VSM_FOREACH(sha, vd) { CHECK_OBJ_NOTNULL(sha, VSM_CHUNK_MAGIC); if (strcmp(sha->class, VSC_CLASS)) continue; /*lint -save -e525 -e539 */ #define VSC_F(n,t,l,f,d,e) #define VSC_DONE(a,b,c) #define VSC_DO(U,l,t) \ if (!strcmp(sha->type, t)) { \ i = iter_##l(vsc, sha, func, priv); \ if (!i) \ continue; \ } #include "vsc_all.h" #undef VSC_F #undef VSC_DO #undef VSC_DONE /*lint -restore */ break; } return (i); } varnish-3.0.5/lib/Makefile.am0000644000175000017500000000035612247035455012727 00000000000000# SUBDIRS = \ libvarnishcompat \ libvarnish \ libvarnishapi \ libvcl \ libvgz \ libvmod_std \ @JEMALLOC_SUBDIR@ DIST_SUBDIRS = \ libvarnishcompat \ libvarnish \ libvarnishapi \ libvcl \ libvgz \ libvmod_std \ libjemalloc varnish-3.0.5/lib/libvcl/0000755000175000017500000000000012247037207012217 500000000000000varnish-3.0.5/lib/libvcl/vcc_dir_round_robin.c0000644000175000017500000000571412247035455016326 00000000000000/*- * Copyright (c) 2008-2009 Varnish Software AS * All rights reserved. * * Author: Petter Knudsen * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (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 "vsb.h" #include "vcc_priv.h" #include "vcc_compile.h" #include "libvarnish.h" /*-------------------------------------------------------------------- * Parse directors */ void vcc_ParseRoundRobinDirector(struct vcc *tl) { struct token *t_field, *t_be; int nelem; struct fld_spec *fs; const char *first; char *p; fs = vcc_FldSpec(tl, "!backend", NULL); Fc(tl, 0, "\nstatic const struct vrt_dir_round_robin_entry " "vdrre_%.*s[] = {\n", PF(tl->t_dir)); for (nelem = 0; tl->t->tok != '}'; nelem++) { /* List of members */ first = ""; t_be = tl->t; vcc_ResetFldSpec(fs); SkipToken(tl, '{'); Fc(tl, 0, "\t{"); while (tl->t->tok != '}') { /* Member fields */ vcc_IsField(tl, &t_field, fs); ERRCHK(tl); if (vcc_IdIs(t_field, "backend")) { vcc_ParseBackendHost(tl, nelem, &p); ERRCHK(tl); AN(p); Fc(tl, 0, "%s .host = VGC_backend_%s", first, p); } else { ErrInternal(tl); } first = ", "; } vcc_FieldsOk(tl, fs); if (tl->err) { VSB_printf(tl->sb, "\nIn member host specification starting at:\n"); vcc_ErrWhere(tl, t_be); return; } Fc(tl, 0, " },\n"); vcc_NextToken(tl); } Fc(tl, 0, "};\n"); Fc(tl, 0, "\nstatic const struct vrt_dir_round_robin vgc_dir_priv_%.*s = {\n", PF(tl->t_dir)); Fc(tl, 0, "\t.name = \"%.*s\",\n", PF(tl->t_dir)); Fc(tl, 0, "\t.nmember = %d,\n", nelem); Fc(tl, 0, "\t.members = vdrre_%.*s,\n", PF(tl->t_dir)); Fc(tl, 0, "};\n"); } varnish-3.0.5/lib/libvcl/generate.py0000755000175000017500000004317212247035455014320 00000000000000#!/usr/local/bin/python3.1 #- # 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. # # 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": "!~", "T_INCLUDE": "include", "T_IF": "if", "T_ELSEIF": "elseif", "T_ELSIF": "elsif", "T_ELSE": "else", # Single char tokens, for convenience on one line None: "{}()*+-/%><=;!&.|~,", # These have handwritten recognizers "ID": None, "CNUM": None, "CSTR": None, "EOI": None, "CSRC": None, } ####################################################################### # Our methods and actions returns =( ('recv', ('error', 'pass', 'pipe', 'lookup',)), ('pipe', ('error', 'pipe',)), ('pass', ('error', 'restart', 'pass',)), ('hash', ('hash',)), ('miss', ('error', 'restart', 'pass', 'fetch',)), ('hit', ('error', 'restart', 'pass', 'deliver',)), ('fetch', ('error', 'restart', 'hit_for_pass', 'deliver',)), ('deliver', ('restart', 'deliver',)), ('error', ('restart', 'deliver',)), ('init', ('ok',)), ('fini', ('ok',)), ) ####################################################################### # Variables available in sessions # # 'all' means all methods # 'proc' means all methods but 'init' and 'fini' sp_variables = ( ('client.ip', 'IP', ( 'proc',), ( ), 'const struct sess *' ), ('client.identity', 'STRING', ( 'proc',), ( 'proc',), 'struct sess *' ), ('server.ip', 'IP', ( 'proc',), ( ), 'struct sess *' ), ('server.hostname', 'STRING', ( 'proc',), ( ), 'struct sess *' ), ('server.identity', 'STRING', ( 'proc',), ( ), 'struct sess *' ), ('server.port', 'INT', ( 'proc',), ( ), 'struct sess *' ), ('req.request', 'STRING', ( 'proc',), ( 'proc',), 'const struct sess *' ), ('req.url', 'STRING', ( 'proc',), ( 'proc',), 'const struct sess *' ), ('req.proto', 'STRING', ( 'proc',), ( 'proc',), 'const struct sess *' ), ('req.http.', 'HDR_REQ', ( 'proc',), ( 'proc',), 'const struct sess *' ), ('req.backend', 'BACKEND', ( 'proc',), ( 'proc',), 'struct sess *' ), ('req.restarts', 'INT', ( 'proc',), ( ), 'const struct sess *' ), ('req.esi_level', 'INT', ( 'proc',), ( ), 'const struct sess *' ), ('req.ttl', 'DURATION', ( 'proc',), ( 'proc',), 'struct sess *' ), ('req.grace', 'DURATION', ( 'proc',), ( 'proc',), 'struct sess *' ), ('req.keep', 'DURATION', ( 'proc',), ( 'proc',), 'struct sess *' ), ('req.xid', 'STRING', ( 'proc',), ( ), 'struct sess *' ), ('req.esi', 'BOOL', ( 'recv', 'fetch', 'deliver', 'error',), ( 'recv', 'fetch', 'deliver', 'error',), 'struct sess *' ), ('req.can_gzip', 'BOOL', ( 'proc',), ( ), 'struct sess *' ), ('req.backend.healthy', 'BOOL', ( 'proc',), ( ), 'const struct sess *' ), ('req.hash_ignore_busy', 'BOOL', ( 'recv',), ( 'recv',), 'struct sess *' ), ('req.hash_always_miss', 'BOOL', ( 'recv',), ( 'recv',), 'struct sess *' ), ('bereq.request', 'STRING', ( 'pipe', 'pass', 'miss', 'fetch',), ( 'pipe', 'pass', 'miss', 'fetch',), 'const struct sess *' ), ('bereq.url', 'STRING', ( 'pipe', 'pass', 'miss', 'fetch',), ( 'pipe', 'pass', 'miss', 'fetch',), 'const struct sess *' ), ('bereq.proto', 'STRING', ( 'pipe', 'pass', 'miss', 'fetch',), ( 'pipe', 'pass', 'miss', 'fetch',), 'const struct sess *' ), ('bereq.http.', 'HDR_BEREQ', ( 'pipe', 'pass', 'miss', 'fetch',), ( 'pipe', 'pass', 'miss', 'fetch',), 'const struct sess *' ), ('bereq.connect_timeout', 'DURATION', ( 'pipe', 'pass', 'miss',), ( 'pipe', 'pass', 'miss',), 'struct sess *' ), ('bereq.first_byte_timeout', 'DURATION', ( 'pass', 'miss',), ( 'pass', 'miss',), 'struct sess *' ), ('bereq.between_bytes_timeout', 'DURATION', ( 'pass', 'miss',), ( 'pass', 'miss',), 'struct sess *' ), ('beresp.proto', 'STRING', ( 'fetch',), ( 'fetch',), 'const struct sess *' ), ('beresp.saintmode', 'DURATION', ( ), ( 'fetch',), 'const struct sess *' ), ('beresp.status', 'INT', ( 'fetch',), ( 'fetch',), 'const struct sess *' ), ('beresp.response', 'STRING', ( 'fetch',), ( 'fetch',), 'const struct sess *' ), ('beresp.http.', 'HDR_BERESP', ( 'fetch',), ( 'fetch',), 'const struct sess *' ), ('beresp.do_esi', 'BOOL', ( 'fetch',), ( 'fetch',), 'const struct sess *' ), ('beresp.do_stream', 'BOOL', ( 'fetch',), ( 'fetch',), 'const struct sess *' ), ('beresp.do_gzip', 'BOOL', ( 'fetch',), ( 'fetch',), 'const struct sess *' ), ('beresp.do_gunzip', 'BOOL', ( 'fetch',), ( 'fetch',), 'const struct sess *' ), ('beresp.ttl', 'DURATION', ( 'fetch',), ( 'fetch',), 'struct sess *' ), ('beresp.grace', 'DURATION', ( 'fetch',), ( 'fetch',), 'struct sess *' ), ('beresp.keep', 'DURATION', ( 'fetch',), ( 'fetch',), 'struct sess *' ), ('beresp.backend.name', 'STRING', ( 'fetch',), ( ), 'const struct sess *' ), ('beresp.backend.ip', 'IP', ( 'fetch',), ( ), 'const struct sess *' ), ('beresp.backend.port', 'INT', ( 'fetch',), ( ), 'const struct sess *' ), ('beresp.storage', 'STRING', ( 'fetch',), ( 'fetch',), 'struct sess *' ), ('obj.proto', 'STRING', ( 'hit', 'error',), ( 'hit', 'error',), 'const struct sess *' ), ('obj.status', 'INT', ( 'error',), ( 'error',), 'const struct sess *' ), ('obj.response', 'STRING', ( 'error',), ( 'error',), 'const struct sess *' ), ('obj.hits', 'INT', ( 'hit', 'deliver',), ( ), 'const struct sess *' ), ('obj.http.', 'HDR_OBJ', ( 'hit', 'error',), ( 'error',), # XXX ? 'const struct sess *' ), ('obj.ttl', 'DURATION', ( 'hit', 'error',), ( 'hit', 'error',), 'struct sess *' ), ('obj.grace', 'DURATION', ( 'hit', 'error',), ( 'hit', 'error',), 'struct sess *' ), ('obj.keep', 'DURATION', ( 'hit', 'error',), ( 'hit', 'error',), 'struct sess *' ), ('obj.lastuse', 'DURATION', ( 'hit', 'deliver', 'error',), ( ), 'const struct sess *' ), ('resp.proto', 'STRING', ( 'deliver',), ( 'deliver',), 'const struct sess *' ), ('resp.status', 'INT', ( 'deliver',), ( 'deliver',), 'const struct sess *' ), ('resp.response', 'STRING', ( 'deliver',), ( 'deliver',), 'const struct sess *' ), ('resp.http.', 'HDR_RESP', ( 'deliver',), ( 'deliver',), 'const struct sess *' ), ('now', 'TIME', ( 'all',), ( ), 'const struct sess *' ), ) stv_variables = ( ('free_space', 'BYTES', "0."), ('used_space', 'BYTES', "0."), ('happy', 'BOOL', "0"), ) ####################################################################### # VCL to C type conversion vcltypes = { 'IP': "struct sockaddr_storage *", 'STRING': "const char *", 'BOOL': "unsigned", 'BACKEND': "struct director *", 'TIME': "double", 'DURATION': "double", 'BYTES': "double", 'INT': "int", 'HEADER': "const char *", } ####################################################################### # 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, fn): fi = open(fn) fc = fi.read() fi.close() w = 66 # Width of lines, after white space prefix maxlen = 10240 # Max length of string literal x = 0 l = 0 fo.write("\n\t/* %s */\n\n" % fn) for c in fc: if l == 0: fo.write("\tVSB_cat(sb, \"") l += 12 x += 12 if x == 0: fo.write("\t \"") d = c if c == '\n': d = "\\n" elif c == '\t': d = "\\t" elif c == '"': d = "\\\"" elif c == '\\': d = "\\\\" if c == '\n' and x > w - 20: fo.write(d + "\"\n") x = 0 continue if c.isspace() and x > w - 10: fo.write(d + "\"\n") x = 0 continue fo.write(d) x += len(d) l += len(d) if l > maxlen: fo.write("\");\n") l = 0; x = 0 if x > w - 3: fo.write("\"\n") x = 0 if x != 0: fo.write("\"") if l != 0: fo.write("\t);\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/libvcl/vcc_token_defs.h", "w") file_header(fo) j = 128 l = list(tokens.keys()) l.sort() for i in l: if i[0] == "'": continue fo.write("#define\t%s %d\n" % (i, j)) j += 1 assert j < 256 fo.close() ####################################################################### rets = dict() vcls = list() for i in returns: vcls.append(i[0]) for j in i[1]: rets[j] = True ####################################################################### fo = open(buildroot + "/include/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() for i in l: fo.write("VCL_RET_MAC(%s, %s" % (i.lower(), i.upper())) s=", " for j in returns: if i in j[1]: fo.write("%sVCL_MET_%s" % (s, j[0].upper())) s = " | " fo.write(")\n") fo.write("#endif\n") fo.write("\n#ifdef VCL_MET_MAC\n") for i in returns: fo.write("VCL_MET_MAC(%s,%s,\n" % (i[0].lower(), i[0].upper())) p = " (" for j in i[1]: fo.write(" %s(1U << VCL_RET_%s)\n" % (p, j.upper())) p = "| " fo.write("))\n") fo.write("#endif\n") fo.write("\n/*lint -restore */\n") fo.close() ####################################################################### fo = open(buildroot + "/include/vcl.h", "w") file_header(fo) fo.write(""" struct sess; struct cli; typedef int vcl_init_f(struct cli *); typedef void vcl_fini_f(struct cli *); typedef int vcl_func_f(struct sess *sp); """) fo.write("\n/* VCL Methods */\n") n = 0 for i in returns: fo.write("#define VCL_MET_%s\t\t(1U << %d)\n" % (i[0].upper(), n)) n += 1 fo.write("\n#define VCL_MET_MAX\t\t%d\n" % n) fo.write("\n#define VCL_MET_MASK\t\t0x%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("#define VCL_RET_%s\t\t%d\n" % (i.upper(), n)) n += 1 fo.write("\n#define VCL_RET_MAX\t\t%d\n" % n) fo.write(""" struct VCL_conf { unsigned magic; #define VCL_CONF_MAGIC 0x7406c509 /* from /dev/random */ struct director **director; unsigned ndirector; struct vrt_ref *ref; unsigned nref; unsigned busy; unsigned discard; unsigned nsrc; const char **srcname; const char **srcbody; vcl_init_f *init_vcl; vcl_fini_f *fini_vcl; """) for i in returns: fo.write("\tvcl_func_f\t*" + i[0] + "_func;\n") fo.write(""" }; """) fo.close() ####################################################################### def restrict(fo, spec): if len(spec) == 0: fo.write("\t 0,\n") return if spec[0] == 'all': spec = vcls if spec[0] == 'proc': spec = list() for i in vcls: if i != "init" and i != "fini": spec.append(i) p = "" n = 0 for j in spec: if n == 4: fo.write("\n") n = 0 if n == 0: fo.write("\t ") n += 1 fo.write(p + "VCL_MET_" + j.upper()) p = " | " fo.write(",\n") ####################################################################### fh = open(buildroot + "/include/vrt_obj.h", "w") file_header(fh) fo = open(buildroot + "/lib/libvcl/vcc_obj.c", "w") file_header(fo) fo.write(""" #include "config.h" #include #include "vcc_compile.h" const struct var vcc_vars[] = { """) for i in sp_variables: typ = i[1] if typ[:4] == "HDR_": typ = "HEADER" cnam = i[0].replace(".", "_") ctyp = vcltypes[typ] fo.write("\t{ \"%s\", %s, %d,\n" % (i[0], typ, len(i[0]))) if len(i[2]) > 0: fo.write('\t "VRT_r_%s(sp)",\n' % cnam) if typ != "HEADER": fh.write(ctyp + " VRT_r_%s(%s);\n" % (cnam, i[4])) else: fo.write('\t NULL,\t/* No reads allowed */\n') restrict(fo, i[2]) if len(i[3]) > 0: fo.write('\t "VRT_l_%s(sp, ",\n' % cnam) if typ != "HEADER": fh.write("void VRT_l_%s(%s, " % (cnam, i[4])) if typ != "STRING": fh.write(ctyp + ");\n") else: fh.write(ctyp + ", ...);\n") else: fo.write('\t NULL,\t/* No writes allowed */\n') restrict(fo, i[3]) if typ == "HEADER": fo.write('\t "%s",\n' % i[1]) else: fo.write('\t 0,\n') # XXX: shoule be NULL fo.write("\t},\n") fo.write("\t{ NULL }\n};\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/libvcl/vcc_fixed_token.c", "w") file_header(fo) fo.write(""" #include "config.h" #include #include #include "config.h" #include "vcc_priv.h" #include "vsb.h" """) emit_vcl_fixed_token(fo, tokens) emit_vcl_tnames(fo, tokens) fo.write(""" void vcl_output_lang_h(struct vsb *sb) { """) 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() ####################################################################### fo = open(buildroot + "/include/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 varnish-3.0.5/lib/libvcl/vcc_priv.h0000644000175000017500000000353512247035455014134 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. * * Stuff shared between main.c and fixed_token.c */ #include "vcc_token_defs.h" struct vsb; #define isident1(c) (isalpha(c)) #define isident(c) (isalpha(c) || isdigit(c) || (c) == '_' || (c) == '-') #define isvar(c) (isident(c) || (c) == '.') 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 varnish-3.0.5/lib/libvcl/Makefile.am0000644000175000017500000000153012247035455014175 00000000000000# INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include pkglib_LTLIBRARIES = libvcl.la libvcl_la_LDFLAGS = -avoid-version libvcl_la_SOURCES = \ vcc_priv.h \ vcc_compile.h \ vcc_token_defs.h \ vcc_types.h \ symbol_kind.h \ \ vcc_acl.c \ vcc_action.c \ vcc_backend.c \ vcc_backend_util.c \ vcc_compile.c \ vcc_dir_random.c \ vcc_dir_round_robin.c \ vcc_dir_dns.c \ vcc_expr.c \ vcc_parse.c \ vcc_fixed_token.c \ vcc_obj.c \ vcc_storage.c \ vcc_string.c \ vcc_symb.c \ vcc_token.c \ vcc_var.c \ vcc_vmod.c \ vcc_xref.c EXTRA_DIST = \ generate.py vcc_obj.c vcc_fixed_token.c vcc_token_defs.h: $(srcdir)/generate.py $(top_srcdir)/include/vrt.h @PYTHON@ $(top_srcdir)/lib/libvcl/generate.py $(top_srcdir) $(top_builddir) CLEANFILES = $(builddir)/vcc_token_defs.h \ $(builddir)/vcc_fixed_token.c \ $(builddir)/vcc_obj.c varnish-3.0.5/lib/libvcl/vcc_dir_random.c0000644000175000017500000000737112247035455015267 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 "vsb.h" #include "vcc_priv.h" #include "vcc_compile.h" #include "libvarnish.h" /*-------------------------------------------------------------------- * Parse directors */ void vcc_ParseRandomDirector(struct vcc *tl) { struct token *t_field, *t_be; int nelem; struct fld_spec *fs, *mfs; unsigned u, retries; const char *first; char *p; fs = vcc_FldSpec(tl, "?retries", NULL); retries = 0; while (tl->t->tok != '{') { vcc_IsField(tl, &t_field, fs); ERRCHK(tl); if (vcc_IdIs(t_field, "retries")) { ExpectErr(tl, CNUM); retries = vcc_UintVal(tl); ERRCHK(tl); SkipToken(tl, ';'); } else { ErrInternal(tl); } } mfs = vcc_FldSpec(tl, "!backend", "!weight", NULL); Fc(tl, 0, "\nstatic const struct vrt_dir_random_entry vdre_%.*s[] = {\n", PF(tl->t_dir)); for (nelem = 0; tl->t->tok != '}'; nelem++) { /* List of members */ first = ""; t_be = tl->t; vcc_ResetFldSpec(mfs); SkipToken(tl, '{'); Fc(tl, 0, "\t{"); while (tl->t->tok != '}') { /* Member fields */ vcc_IsField(tl, &t_field, mfs); ERRCHK(tl); if (vcc_IdIs(t_field, "backend")) { vcc_ParseBackendHost(tl, nelem, &p); ERRCHK(tl); AN(p); Fc(tl, 0, "%s .host = VGC_backend_%s", first, p); } else if (vcc_IdIs(t_field, "weight")) { ExpectErr(tl, CNUM); u = vcc_UintVal(tl); ERRCHK(tl); if (u == 0) { VSB_printf(tl->sb, "The .weight must be higher " "than zero."); vcc_ErrToken(tl, tl->t); VSB_printf(tl->sb, " at\n"); vcc_ErrWhere(tl, tl->t); return; } Fc(tl, 0, "%s .weight = %u", first, u); SkipToken(tl, ';'); } else { ErrInternal(tl); } first = ", "; } vcc_FieldsOk(tl, mfs); if (tl->err) { VSB_printf(tl->sb, "\nIn member host specification starting at:\n"); vcc_ErrWhere(tl, t_be); return; } Fc(tl, 0, " },\n"); vcc_NextToken(tl); } Fc(tl, 0, "};\n"); Fc(tl, 0, "\nstatic const struct vrt_dir_random vgc_dir_priv_%.*s = {\n", PF(tl->t_dir)); Fc(tl, 0, "\t.name = \"%.*s\",\n", PF(tl->t_dir)); Fc(tl, 0, "\t.retries = %u,\n", retries); Fc(tl, 0, "\t.nmember = %d,\n", nelem); Fc(tl, 0, "\t.members = vdre_%.*s,\n", PF(tl->t_dir)); Fc(tl, 0, "};\n"); } varnish-3.0.5/lib/libvcl/vcc_storage.c0000644000175000017500000001035412247035455014610 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. * * 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 "vsb.h" #include "vcc_priv.h" #include "vcc_compile.h" #include "libvarnish.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,b) | VCL_MET_##u #include "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 "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)); assert(!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-3.0.5/lib/libvcl/vcc_dir_dns.c0000644000175000017500000002233412247035455014567 00000000000000/*- * Copyright (c) 2009-2010 Varnish Software AS * All rights reserved. * * Author: Kristian Lyngstol * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (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 "vsb.h" #include "vcc_priv.h" #include "vcc_compile.h" #include "libvarnish.h" /*-------------------------------------------------------------------- * Parse directors */ static struct vcc_dir_backend_defaults { char *port; char *hostheader; double connect_timeout; double first_byte_timeout; double between_bytes_timeout; unsigned max_connections; unsigned saint; } b_defaults; static void vcc_dir_initialize_defaults(void) { b_defaults.port = NULL; b_defaults.hostheader = NULL; b_defaults.connect_timeout = -1.0; b_defaults.first_byte_timeout = -1.0; b_defaults.between_bytes_timeout = -1.0; b_defaults.max_connections = UINT_MAX; b_defaults.saint = UINT_MAX; } static const struct token *dns_first; static void print_backend(struct vcc *tl, int serial, const uint8_t *ip) { char vgcname[BUFSIZ]; char strip[16]; struct token tmptok; struct vsb *vsb; bprintf(strip, "%u.%u.%u.%u", ip[3], ip[2], ip[1], ip[0]); tmptok.dec = strip; bprintf(vgcname, "%.*s_%d", PF(tl->t_dir), serial); vsb = VSB_new_auto(); AN(vsb); tl->fb = vsb; Fc(tl, 0, "\t{ .host = VGC_backend_%s },\n",vgcname); Fh(tl, 1, "\n#define VGC_backend_%s %d\n", vgcname, tl->ndirector); Fb(tl, 0, "\nstatic const struct vrt_backend vgc_dir_priv_%s = {\n", vgcname); Fb(tl, 0, "\t.vcl_name = \"%.*s", PF(tl->t_dir)); if (serial >= 0) Fb(tl, 0, "[%d]", serial); Fb(tl, 0, "\",\n"); Emit_Sockaddr(tl, &tmptok, b_defaults.port ? b_defaults.port : "80"); Fb(tl, 0, "\t.hosthdr = \""); if (b_defaults.hostheader != NULL) Fb(tl,0, b_defaults.hostheader); else Fb(tl,0, strip); Fb(tl, 0, "\",\n"); Fb(tl, 0, "\t.saintmode_threshold = %d,\n",b_defaults.saint); #define FB_TIMEOUT(type) do { \ if (b_defaults.type != -1.0) \ Fb(tl, 0, "\t.%s = %g,\n",#type,b_defaults.type); \ } while (0) FB_TIMEOUT(connect_timeout); FB_TIMEOUT(first_byte_timeout); FB_TIMEOUT(between_bytes_timeout); Fb(tl, 0, "};\n"); tl->fb = NULL; AZ(VSB_finish(vsb)); Fh(tl, 0, "%s", VSB_data(vsb)); VSB_delete(vsb); Fi(tl, 0, "\tVRT_init_dir(cli, VCL_conf.director, \"simple\",\n" "\t VGC_backend_%s, &vgc_dir_priv_%s);\n", vgcname, vgcname); Ff(tl, 0, "\tVRT_fini_dir(cli, VGCDIR(%s));\n", vgcname); tl->ndirector++; } /* * Output backends for all IPs in the range supplied by * "a[0].a[1].a[2].a[3]/inmask". * * XXX: * This assumes that a uint32_t can be safely accessed as an array of 4 * uint8_ts. */ static void vcc_dir_dns_makebackend(struct vcc *tl, int *serial, const unsigned char a[], int inmask) { uint32_t ip4=0; uint32_t ip4end; uint32_t mask = UINT32_MAX << (32-inmask); ip4 |= a[0] << 24; ip4 |= a[1] << 16; ip4 |= a[2] << 8; ip4 |= a[3] ; ip4end = ip4 | ~mask; if (ip4 != (ip4 & mask)) { VSB_printf(tl->sb, "IP and network mask not compatible: "); vcc_ErrToken(tl, tl->t); VSB_printf(tl->sb, " at\n"); vcc_ErrWhere(tl, tl->t); ERRCHK(tl); } while (ip4 <= ip4end) { uint8_t *b; b=(uint8_t *)&ip4; (*serial)++; print_backend(tl, *serial, b); ip4++; } } static void vcc_dir_dns_parse_backend_options(struct vcc *tl) { struct fld_spec *fs; struct token *t_field; double t; unsigned u; vcc_dir_initialize_defaults(); fs = vcc_FldSpec(tl, "?port", "?host_header", "?connect_timeout", "?first_byte_timeout", "?between_bytes_timeout", "?max_connections", "?saintmode_threshold", NULL); while (tl->t->tok != CSTR) { vcc_IsField(tl, &t_field, fs); ERRCHK(tl); if (vcc_IdIs(t_field, "port")) { ExpectErr(tl, CSTR); assert(tl->t->dec != NULL); b_defaults.port = strdup(tl->t->dec); assert(b_defaults.port); vcc_NextToken(tl); SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "host_header")) { ExpectErr(tl, CSTR); assert(tl->t->dec != NULL); b_defaults.hostheader = strdup(tl->t->dec); assert(b_defaults.hostheader); vcc_NextToken(tl); SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "connect_timeout")) { vcc_TimeVal(tl, &t); ERRCHK(tl); b_defaults.connect_timeout = t; SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "first_byte_timeout")) { vcc_TimeVal(tl, &t); ERRCHK(tl); b_defaults.first_byte_timeout = t; SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "between_bytes_timeout")) { vcc_TimeVal(tl, &t); ERRCHK(tl); b_defaults.between_bytes_timeout = t; SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "max_connections")) { u = vcc_UintVal(tl); ERRCHK(tl); SkipToken(tl, ';'); b_defaults.max_connections = u; } else if (vcc_IdIs(t_field, "saintmode_threshold")) { u = vcc_UintVal(tl); /* UINT_MAX == magic number to mark as unset, so * not allowed here. */ if (u == UINT_MAX) { VSB_printf(tl->sb, "Value outside allowed range: "); vcc_ErrToken(tl, tl->t); VSB_printf(tl->sb, " at\n"); vcc_ErrWhere(tl, tl->t); } ERRCHK(tl); b_defaults.saint = u; SkipToken(tl, ';'); } else { ErrInternal(tl); return; } } } /* Parse a list of backends with optional /mask notation, then print out * all relevant backends. */ static void vcc_dir_dns_parse_list(struct vcc *tl, int *serial) { unsigned char a[4],mask; int ret; ERRCHK(tl); SkipToken(tl, '{'); if (tl->t->tok != CSTR) { vcc_dir_dns_parse_backend_options(tl); ERRCHK(tl); } while (tl->t->tok == CSTR) { mask = 32; ret = sscanf(tl->t->dec, "%hhu.%hhu.%hhu.%hhu", &a[0], &a[1], &a[2], &a[3]); if (ret != 4) { VSB_printf(tl->sb, "Incomplete IP supplied: "); vcc_ErrToken(tl, tl->t); VSB_printf(tl->sb, " at\n"); vcc_ErrWhere(tl, tl->t); ERRCHK(tl); } vcc_NextToken(tl); if (tl->t->tok == '/') { vcc_NextToken(tl); mask = vcc_UintVal(tl); ERRCHK(tl); } vcc_dir_dns_makebackend(tl,serial,a,mask); SkipToken(tl,';'); } ExpectErr(tl, '}'); } void vcc_ParseDnsDirector(struct vcc *tl) { struct token *t_field, *t_be, *t_suffix = NULL; double ttl = 60.0; int nelem = 0; struct fld_spec *fs; const char *first; char *p; dns_first = tl->t; tl->fb = tl->fc; fs = vcc_FldSpec(tl, "!backend", "?ttl", "?suffix","?list", NULL); Fc(tl, 0, "\nstatic const struct vrt_dir_dns_entry " "vddnse_%.*s[] = {\n", PF(tl->t_dir)); for (; tl->t->tok != '}'; ) { /* List of members */ if (tl->t->tok == '{') { nelem++; first = ""; t_be = tl->t; vcc_ResetFldSpec(fs); ExpectErr(tl, '{'); vcc_NextToken(tl); Fc(tl, 0, "\t{"); while (tl->t->tok != '}') { /* Member fields */ vcc_IsField(tl, &t_field, fs); ERRCHK(tl); if (vcc_IdIs(t_field, "backend")) { vcc_ParseBackendHost(tl, nelem, &p); ERRCHK(tl); AN(p); Fc(tl, 0, "%s .host = VGC_backend_%s", first, p); } else { ErrInternal(tl); } first = ", "; } vcc_FieldsOk(tl, fs); if (tl->err) { VSB_printf(tl->sb, "\nIn member host" " specification starting at:\n"); vcc_ErrWhere(tl, t_be); return; } Fc(tl, 0, " },\n"); } else { vcc_IsField(tl, &t_field, fs); ERRCHK(tl); if (vcc_IdIs(t_field, "suffix")) { ExpectErr(tl, CSTR); t_suffix = tl->t; vcc_NextToken(tl); ExpectErr(tl, ';'); } else if (vcc_IdIs(t_field, "ttl")) { vcc_RTimeVal(tl, &ttl); ExpectErr(tl, ';'); } else if (vcc_IdIs(t_field, "list")) { vcc_dir_dns_parse_list(tl,&nelem); } } vcc_NextToken(tl); } Fc(tl, 0, "};\n"); Fc(tl, 0, "\nstatic const struct vrt_dir_dns vgc_dir_priv_%.*s = {\n", PF(tl->t_dir)); Fc(tl, 0, "\t.name = \"%.*s\",\n", PF(tl->t_dir)); Fc(tl, 0, "\t.nmember = %d,\n", nelem); Fc(tl, 0, "\t.members = vddnse_%.*s,\n", PF(tl->t_dir)); Fc(tl, 0, "\t.suffix = "); if (t_suffix) Fc(tl, 0, "%.*s", PF(t_suffix)); else Fc(tl, 0, "\"\""); Fc(tl, 0, ",\n"); Fc(tl, 0, "\t.ttl = %f", ttl); Fc(tl, 0, ",\n"); Fc(tl, 0, "};\n"); } varnish-3.0.5/lib/libvcl/vcc_xref.c0000644000175000017500000002143312247035455014110 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 "vsb.h" #include "libvarnish.h" #include "vcc_priv.h" #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->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 "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 "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->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-3.0.5/lib/libvcl/vcc_string.c0000644000175000017500000000451712247035455014456 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 "vsb.h" #include "vcc_priv.h" #include "vcc_compile.h" #include "libvarnish.h" #include "vrt.h" #include "vre.h" /*--------------------------------------------------------------------*/ char * vcc_regexp(struct vcc *tl) { char buf[BUFSIZ], *p; vre_t *t; const char *error; int erroroffset; 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); Fi(tl, 0, "\tVRT_re_init(&%s, ",buf); EncToken(tl->fi, tl->t); Fi(tl, 0, ");\n"); Ff(tl, 0, "\tVRT_re_fini(%s);\n", buf); return (p); } varnish-3.0.5/lib/libvcl/vcc_obj.c0000644000175000017500000003216612247037175013724 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[] = { { "client.ip", IP, 9, "VRT_r_client_ip(sp)", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, NULL, /* No writes allowed */ 0, 0, }, { "client.identity", STRING, 15, "VRT_r_client_identity(sp)", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, "VRT_l_client_identity(sp, ", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, 0, }, { "server.ip", IP, 9, "VRT_r_server_ip(sp)", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, NULL, /* No writes allowed */ 0, 0, }, { "server.hostname", STRING, 15, "VRT_r_server_hostname(sp)", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, NULL, /* No writes allowed */ 0, 0, }, { "server.identity", STRING, 15, "VRT_r_server_identity(sp)", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, NULL, /* No writes allowed */ 0, 0, }, { "server.port", INT, 11, "VRT_r_server_port(sp)", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, NULL, /* No writes allowed */ 0, 0, }, { "req.request", STRING, 11, "VRT_r_req_request(sp)", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, "VRT_l_req_request(sp, ", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, 0, }, { "req.url", STRING, 7, "VRT_r_req_url(sp)", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, "VRT_l_req_url(sp, ", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, 0, }, { "req.proto", STRING, 9, "VRT_r_req_proto(sp)", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, "VRT_l_req_proto(sp, ", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, 0, }, { "req.http.", HEADER, 9, "VRT_r_req_http_(sp)", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, "VRT_l_req_http_(sp, ", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, "HDR_REQ", }, { "req.backend", BACKEND, 11, "VRT_r_req_backend(sp)", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, "VRT_l_req_backend(sp, ", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, 0, }, { "req.restarts", INT, 12, "VRT_r_req_restarts(sp)", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, NULL, /* No writes allowed */ 0, 0, }, { "req.esi_level", INT, 13, "VRT_r_req_esi_level(sp)", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, NULL, /* No writes allowed */ 0, 0, }, { "req.ttl", DURATION, 7, "VRT_r_req_ttl(sp)", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, "VRT_l_req_ttl(sp, ", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, 0, }, { "req.grace", DURATION, 9, "VRT_r_req_grace(sp)", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, "VRT_l_req_grace(sp, ", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, 0, }, { "req.keep", DURATION, 8, "VRT_r_req_keep(sp)", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, "VRT_l_req_keep(sp, ", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, 0, }, { "req.xid", STRING, 7, "VRT_r_req_xid(sp)", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, NULL, /* No writes allowed */ 0, 0, }, { "req.esi", BOOL, 7, "VRT_r_req_esi(sp)", VCL_MET_RECV | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, "VRT_l_req_esi(sp, ", VCL_MET_RECV | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, 0, }, { "req.can_gzip", BOOL, 12, "VRT_r_req_can_gzip(sp)", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, NULL, /* No writes allowed */ 0, 0, }, { "req.backend.healthy", BOOL, 19, "VRT_r_req_backend_healthy(sp)", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, NULL, /* No writes allowed */ 0, 0, }, { "req.hash_ignore_busy", BOOL, 20, "VRT_r_req_hash_ignore_busy(sp)", VCL_MET_RECV, "VRT_l_req_hash_ignore_busy(sp, ", VCL_MET_RECV, 0, }, { "req.hash_always_miss", BOOL, 20, "VRT_r_req_hash_always_miss(sp)", VCL_MET_RECV, "VRT_l_req_hash_always_miss(sp, ", VCL_MET_RECV, 0, }, { "bereq.request", STRING, 13, "VRT_r_bereq_request(sp)", VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS | VCL_MET_FETCH, "VRT_l_bereq_request(sp, ", VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS | VCL_MET_FETCH, 0, }, { "bereq.url", STRING, 9, "VRT_r_bereq_url(sp)", VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS | VCL_MET_FETCH, "VRT_l_bereq_url(sp, ", VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS | VCL_MET_FETCH, 0, }, { "bereq.proto", STRING, 11, "VRT_r_bereq_proto(sp)", VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS | VCL_MET_FETCH, "VRT_l_bereq_proto(sp, ", VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS | VCL_MET_FETCH, 0, }, { "bereq.http.", HEADER, 11, "VRT_r_bereq_http_(sp)", VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS | VCL_MET_FETCH, "VRT_l_bereq_http_(sp, ", VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS | VCL_MET_FETCH, "HDR_BEREQ", }, { "bereq.connect_timeout", DURATION, 21, "VRT_r_bereq_connect_timeout(sp)", VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS, "VRT_l_bereq_connect_timeout(sp, ", VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS, 0, }, { "bereq.first_byte_timeout", DURATION, 24, "VRT_r_bereq_first_byte_timeout(sp)", VCL_MET_PASS | VCL_MET_MISS, "VRT_l_bereq_first_byte_timeout(sp, ", VCL_MET_PASS | VCL_MET_MISS, 0, }, { "bereq.between_bytes_timeout", DURATION, 27, "VRT_r_bereq_between_bytes_timeout(sp)", VCL_MET_PASS | VCL_MET_MISS, "VRT_l_bereq_between_bytes_timeout(sp, ", VCL_MET_PASS | VCL_MET_MISS, 0, }, { "beresp.proto", STRING, 12, "VRT_r_beresp_proto(sp)", VCL_MET_FETCH, "VRT_l_beresp_proto(sp, ", VCL_MET_FETCH, 0, }, { "beresp.saintmode", DURATION, 16, NULL, /* No reads allowed */ 0, "VRT_l_beresp_saintmode(sp, ", VCL_MET_FETCH, 0, }, { "beresp.status", INT, 13, "VRT_r_beresp_status(sp)", VCL_MET_FETCH, "VRT_l_beresp_status(sp, ", VCL_MET_FETCH, 0, }, { "beresp.response", STRING, 15, "VRT_r_beresp_response(sp)", VCL_MET_FETCH, "VRT_l_beresp_response(sp, ", VCL_MET_FETCH, 0, }, { "beresp.http.", HEADER, 12, "VRT_r_beresp_http_(sp)", VCL_MET_FETCH, "VRT_l_beresp_http_(sp, ", VCL_MET_FETCH, "HDR_BERESP", }, { "beresp.do_esi", BOOL, 13, "VRT_r_beresp_do_esi(sp)", VCL_MET_FETCH, "VRT_l_beresp_do_esi(sp, ", VCL_MET_FETCH, 0, }, { "beresp.do_stream", BOOL, 16, "VRT_r_beresp_do_stream(sp)", VCL_MET_FETCH, "VRT_l_beresp_do_stream(sp, ", VCL_MET_FETCH, 0, }, { "beresp.do_gzip", BOOL, 14, "VRT_r_beresp_do_gzip(sp)", VCL_MET_FETCH, "VRT_l_beresp_do_gzip(sp, ", VCL_MET_FETCH, 0, }, { "beresp.do_gunzip", BOOL, 16, "VRT_r_beresp_do_gunzip(sp)", VCL_MET_FETCH, "VRT_l_beresp_do_gunzip(sp, ", VCL_MET_FETCH, 0, }, { "beresp.ttl", DURATION, 10, "VRT_r_beresp_ttl(sp)", VCL_MET_FETCH, "VRT_l_beresp_ttl(sp, ", VCL_MET_FETCH, 0, }, { "beresp.grace", DURATION, 12, "VRT_r_beresp_grace(sp)", VCL_MET_FETCH, "VRT_l_beresp_grace(sp, ", VCL_MET_FETCH, 0, }, { "beresp.keep", DURATION, 11, "VRT_r_beresp_keep(sp)", VCL_MET_FETCH, "VRT_l_beresp_keep(sp, ", VCL_MET_FETCH, 0, }, { "beresp.backend.name", STRING, 19, "VRT_r_beresp_backend_name(sp)", VCL_MET_FETCH, NULL, /* No writes allowed */ 0, 0, }, { "beresp.backend.ip", IP, 17, "VRT_r_beresp_backend_ip(sp)", VCL_MET_FETCH, NULL, /* No writes allowed */ 0, 0, }, { "beresp.backend.port", INT, 19, "VRT_r_beresp_backend_port(sp)", VCL_MET_FETCH, NULL, /* No writes allowed */ 0, 0, }, { "beresp.storage", STRING, 14, "VRT_r_beresp_storage(sp)", VCL_MET_FETCH, "VRT_l_beresp_storage(sp, ", VCL_MET_FETCH, 0, }, { "obj.proto", STRING, 9, "VRT_r_obj_proto(sp)", VCL_MET_HIT | VCL_MET_ERROR, "VRT_l_obj_proto(sp, ", VCL_MET_HIT | VCL_MET_ERROR, 0, }, { "obj.status", INT, 10, "VRT_r_obj_status(sp)", VCL_MET_ERROR, "VRT_l_obj_status(sp, ", VCL_MET_ERROR, 0, }, { "obj.response", STRING, 12, "VRT_r_obj_response(sp)", VCL_MET_ERROR, "VRT_l_obj_response(sp, ", VCL_MET_ERROR, 0, }, { "obj.hits", INT, 8, "VRT_r_obj_hits(sp)", VCL_MET_HIT | VCL_MET_DELIVER, NULL, /* No writes allowed */ 0, 0, }, { "obj.http.", HEADER, 9, "VRT_r_obj_http_(sp)", VCL_MET_HIT | VCL_MET_ERROR, "VRT_l_obj_http_(sp, ", VCL_MET_ERROR, "HDR_OBJ", }, { "obj.ttl", DURATION, 7, "VRT_r_obj_ttl(sp)", VCL_MET_HIT | VCL_MET_ERROR, "VRT_l_obj_ttl(sp, ", VCL_MET_HIT | VCL_MET_ERROR, 0, }, { "obj.grace", DURATION, 9, "VRT_r_obj_grace(sp)", VCL_MET_HIT | VCL_MET_ERROR, "VRT_l_obj_grace(sp, ", VCL_MET_HIT | VCL_MET_ERROR, 0, }, { "obj.keep", DURATION, 8, "VRT_r_obj_keep(sp)", VCL_MET_HIT | VCL_MET_ERROR, "VRT_l_obj_keep(sp, ", VCL_MET_HIT | VCL_MET_ERROR, 0, }, { "obj.lastuse", DURATION, 11, "VRT_r_obj_lastuse(sp)", VCL_MET_HIT | VCL_MET_DELIVER | VCL_MET_ERROR, NULL, /* No writes allowed */ 0, 0, }, { "resp.proto", STRING, 10, "VRT_r_resp_proto(sp)", VCL_MET_DELIVER, "VRT_l_resp_proto(sp, ", VCL_MET_DELIVER, 0, }, { "resp.status", INT, 11, "VRT_r_resp_status(sp)", VCL_MET_DELIVER, "VRT_l_resp_status(sp, ", VCL_MET_DELIVER, 0, }, { "resp.response", STRING, 13, "VRT_r_resp_response(sp)", VCL_MET_DELIVER, "VRT_l_resp_response(sp, ", VCL_MET_DELIVER, 0, }, { "resp.http.", HEADER, 10, "VRT_r_resp_http_(sp)", VCL_MET_DELIVER, "VRT_l_resp_http_(sp, ", VCL_MET_DELIVER, "HDR_RESP", }, { "now", TIME, 3, "VRT_r_now(sp)", VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR | VCL_MET_INIT | VCL_MET_FINI, NULL, /* No writes allowed */ 0, 0, }, { NULL } }; varnish-3.0.5/lib/libvcl/vcc_types.h0000644000175000017500000000321012247035455014306 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 */ VCC_TYPE(VOID) VCC_TYPE(BACKEND) VCC_TYPE(BOOL) VCC_TYPE(INT) VCC_TYPE(TIME) VCC_TYPE(DURATION) VCC_TYPE(STRING) VCC_TYPE(STRING_LIST) VCC_TYPE(IP) VCC_TYPE(HEADER) VCC_TYPE(BYTES) VCC_TYPE(REAL) VCC_TYPE(ENUM) /*lint -restore */ varnish-3.0.5/lib/libvcl/vcc_compile.c0000644000175000017500000004266712247035455014610 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: * Better error messages, throughout. * >It also accured 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 #include #include "vqueue.h" #include "vsb.h" #include "vcc_priv.h" #include "vcc_compile.h" #include "libvcl.h" #include "libvarnish.h" struct method method_tab[] = { #define VCL_MET_MAC(l,U,m) { "vcl_"#l, m, VCL_MET_##U }, #include "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); } /*--------------------------------------------------------------------*/ 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); } 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 Fi(const struct vcc *tl, int indent, const char *fmt, ...) { va_list ap; if (indent) VSB_printf(tl->fi, "%*.*s", tl->iindent, tl->iindent, ""); va_start(ap, fmt); VSB_vprintf(tl->fi, fmt, ap); va_end(ap); } void Ff(const struct vcc *tl, int indent, const char *fmt, ...) { va_list ap; if (indent) VSB_printf(tl->ff, "%*.*s", tl->findent, tl->findent, ""); va_start(ap, fmt); VSB_vprintf(tl->ff, 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 '\\': 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", *b); break; } } VSB_cat(sb, "\""); } void EncToken(struct vsb *sb, const struct token *t) { assert(t->tok == CSTR); EncString(sb, t->dec, NULL, 0); } /*-------------------------------------------------------------------- * Output the location/profiling table. For each counted token, we * record source+line+charpos for the first character in the token. */ static void LocTable(const struct vcc *tl) { struct token *t; unsigned lin, pos; struct source *sp; const char *p; Fh(tl, 0, "\n#define VGC_NREFS %u\n", tl->cnt + 1); Fc(tl, 0, "\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++; } Fc(tl, 0, " [%3u] = { %d, %8u, %4u, %3u, 0, ", t->cnt, sp->idx, t->b - sp->b, lin, pos + 1); if (t->tok == CSRC) Fc(tl, 0, " \"C{\"},\n"); else Fc(tl, 0, " \"%.*s\" },\n", PF(t)); } Fc(tl, 0, "};\n"); } /*--------------------------------------------------------------------*/ static void EmitInitFunc(const struct vcc *tl) { Fc(tl, 0, "\nstatic int\nVGC_Init(struct cli *cli)\n{\n\n"); AZ(VSB_finish(tl->fi)); VSB_cat(tl->fc, VSB_data(tl->fi)); Fc(tl, 0, "\treturn(0);\n"); Fc(tl, 0, "}\n"); } static void EmitFiniFunc(const struct vcc *tl) { unsigned u; Fc(tl, 0, "\nstatic void\nVGC_Fini(struct cli *cli)\n{\n\n"); /* * We do this here, so we are sure they happen before any * per-vcl vmod_privs get cleaned. */ for (u = 0; u < tl->nvmodpriv; u++) Fc(tl, 0, "\tvmod_priv_fini(&vmod_priv_%u);\n", u); AZ(VSB_finish(tl->ff)); VSB_cat(tl->fc, VSB_data(tl->ff)); Fc(tl, 0, "}\n"); } /*--------------------------------------------------------------------*/ static void EmitStruct(const struct vcc *tl) { struct source *sp; Fc(tl, 0, "\nconst char *srcname[%u] = {\n", tl->nsources); VTAILQ_FOREACH(sp, &tl->sources, list) { Fc(tl, 0, "\t"); EncString(tl->fc, sp->name, NULL, 0); Fc(tl, 0, ",\n"); } Fc(tl, 0, "};\n"); Fc(tl, 0, "\nconst char *srcbody[%u] = {\n", tl->nsources); VTAILQ_FOREACH(sp, &tl->sources, list) { Fc(tl, 0, " /* "); EncString(tl->fc, sp->name, NULL, 0); Fc(tl, 0, "*/\n"); Fc(tl, 0, "\t"); EncString(tl->fc, sp->b, sp->e, 1); Fc(tl, 0, ",\n"); } Fc(tl, 0, "};\n"); Fc(tl, 0, "\nstatic struct director\t*directors[%d];\n", tl->ndirector); Fc(tl, 0, "\nconst struct VCL_conf VCL_conf = {\n"); Fc(tl, 0, "\t.magic = VCL_CONF_MAGIC,\n"); Fc(tl, 0, "\t.init_vcl = VGC_Init,\n"); Fc(tl, 0, "\t.fini_vcl = VGC_Fini,\n"); Fc(tl, 0, "\t.ndirector = %d,\n", tl->ndirector); Fc(tl, 0, "\t.director = directors,\n"); Fc(tl, 0, "\t.ref = VGC_ref,\n"); Fc(tl, 0, "\t.nref = VGC_NREFS,\n"); Fc(tl, 0, "\t.nsrc = %u,\n", tl->nsources); Fc(tl, 0, "\t.srcname = srcname,\n"); Fc(tl, 0, "\t.srcbody = srcbody,\n"); #define VCL_MET_MAC(l,u,b) \ Fc(tl, 0, "\t." #l "_func = VGC_function_vcl_" #l ",\n"); #include "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 vcc *tl, struct vsb *sb, const char *fn) { char *f; struct source *sp; f = vreadfile(tl->vcl_dir, fn, NULL); if (f == NULL) { VSB_printf(sb, "Cannot read file '%s': %s\n", fn, strerror(errno)); return (NULL); } sp = vcc_new_source(f, NULL, fn); sp->freeit = f; return (sp); } /*--------------------------------------------------------------------*/ static void vcc_resolve_includes(struct vcc *tl) { struct token *t, *t1, *t2; struct source *sp; VTAILQ_FOREACH(t, &tl->tokens, list) { if (t->tok != 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; } assert(t2 != NULL); sp = vcc_file_source(tl, 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 vcc *tl0) { struct vcc *tl; int i; ALLOC_OBJ(tl, VCC_MAGIC); AN(tl); if (tl0 != NULL) { REPLACE(tl->default_vcl, tl0->default_vcl); REPLACE(tl->vcl_dir, tl0->vcl_dir); REPLACE(tl->vmod_dir, tl0->vmod_dir); tl->vars = tl0->vars; tl->err_unref = tl0->err_unref; } else { tl->err_unref = 1; } VTAILQ_INIT(&tl->symbols); VTAILQ_INIT(&tl->hosts); VTAILQ_INIT(&tl->membits); VTAILQ_INIT(&tl->tokens); VTAILQ_INIT(&tl->sources); tl->nsources = 0; tl->ndirector = 1; /* 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); /* Init C code */ tl->fi = VSB_new_auto(); assert(tl->fi != NULL); /* Finish C code */ tl->ff = VSB_new_auto(); assert(tl->ff != 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); VSB_delete(tl->fi); VSB_delete(tl->ff); 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 vcc *tl0, struct vsb *sb, struct source *sp) { struct vcc *tl; struct symbol *sym; const struct var *v; char *of; int i; tl = vcc_NewVcc(tl0); 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; vcl_output_lang_h(tl->fh); Fh(tl, 0, "\n/* ---===### VCC generated below here ###===---*/\n"); Fh(tl, 0, "\nextern const struct VCL_conf VCL_conf;\n"); /* Macro for accessing directors */ Fh(tl, 0, "#define VGCDIR(n) VCL_conf.director[VGC_backend_##n]\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 default VCL */ sp = vcc_new_source(tl->default_vcl, NULL, "Default"); 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->ndirector == 1) { 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 */ Fi(tl, 0, "\tVCL_conf.director[0] = VCL_conf.director[%d];\n", tl->defaultdir); vcc_AddRef(tl, tl->t_defaultdir, 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 */ for (i = 0; i < VCL_MET_MAX; i++) { Fh(tl, 1, "\nint\n"); Fh(tl, 1, "VGC_function_%s(struct sess *sp);\n", method_tab[i].name); Fc(tl, 1, "\nint\n"); Fc(tl, 1, "VGC_function_%s(struct sess *sp)\n", method_tab[i].name); AZ(VSB_finish(tl->fm[i])); Fc(tl, 1, "{\n"); Fc(tl, 1, "%s", VSB_data(tl->fm[i])); Fc(tl, 1, "}\n"); } LocTable(tl); EmitInitFunc(tl); EmitFiniFunc(tl); EmitStruct(tl); /* Combine it all in the fh vsb */ AZ(VSB_finish(tl->fc)); VSB_cat(tl->fh, VSB_data(tl->fc)); AZ(VSB_finish(tl->fh)); of = strdup(VSB_data(tl->fh)); AN(of); /* 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 vcc *tl, struct vsb *sb, const char *b) { struct source *sp; char *r; sp = vcc_new_source(b, NULL, "input"); if (sp == NULL) return (NULL); r = vcc_CompileSource(tl, sb, sp); return (r); } /*--------------------------------------------------------------------*/ const char * VCC_Return_Name(unsigned method) { switch (method) { #define VCL_RET_MAC(l, U, B) case VCL_RET_##U: return(#l); #include "vcl_returns.h" #undef VCL_RET_MAC default: return (NULL); } } /*-------------------------------------------------------------------- * Allocate a compiler instance */ struct vcc * VCC_New(void) { struct vcc *tl; tl = vcc_NewVcc(NULL); tl->vars = vcc_vars; return (tl); } /*-------------------------------------------------------------------- * Configure default VCL source code */ void VCC_Default_VCL(struct vcc *tl, const char *str) { CHECK_OBJ_NOTNULL(tl, VCC_MAGIC); REPLACE(tl->default_vcl, str); } /*-------------------------------------------------------------------- * Configure default VCL source directory */ void VCC_VCL_dir(struct vcc *tl, const char *str) { CHECK_OBJ_NOTNULL(tl, VCC_MAGIC); REPLACE(tl->vcl_dir, str); } /*-------------------------------------------------------------------- * Configure default VMOD directory */ void VCC_VMOD_dir(struct vcc *tl, const char *str) { CHECK_OBJ_NOTNULL(tl, VCC_MAGIC); REPLACE(tl->vmod_dir, str); } /*-------------------------------------------------------------------- * Configure default */ void VCC_Err_Unref(struct vcc *tl, unsigned u) { CHECK_OBJ_NOTNULL(tl, VCC_MAGIC); tl->err_unref = u; } varnish-3.0.5/lib/libvcl/vcc_compile.h0000644000175000017500000002165012247035455014602 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 "vqueue.h" #include "miniobj.h" #include "vcl.h" #define INDENT 2 struct acl_e; struct proc; struct expr; struct vcc; struct symbol; enum var_type { #define VCC_TYPE(foo) foo, #include "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, dd) SYM_##uu, #include "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 *args; /* SYM_VAR */ const struct var *var; unsigned r_methods; }; VTAILQ_HEAD(tokenhead, token); struct vcc { unsigned magic; #define VCC_MAGIC 0x24ad719d /* Parameter/Template section */ char *default_vcl; char *vcl_dir; char *vmod_dir; const struct var *vars; VTAILQ_HEAD(, symbol) symbols; /* Instance section */ struct tokenhead tokens; VTAILQ_HEAD(, source) sources; VTAILQ_HEAD(, membit) membits; VTAILQ_HEAD(, host) hosts; unsigned nsources; struct source *src; struct token *t; int indent; int hindent; int iindent; int findent; unsigned cnt; struct vsb *fc; /* C-code */ struct vsb *fh; /* H-code (before C-code) */ struct vsb *fi; /* Init func code */ struct vsb *ff; /* Finish func code */ struct vsb *fb; /* Body of current sub * NULL otherwise */ struct vsb *fm[VCL_MET_MAX]; /* Method bodies */ struct vsb *sb; int err; int ndirector; struct proc *curproc; struct proc *mprocs[VCL_MET_MAX]; VTAILQ_HEAD(, acl_e) acl; int nprobe; int defaultdir; struct token *t_defaultdir; struct token *t_dir; struct token *t_policy; unsigned unique; unsigned nvmodpriv; unsigned err_unref; }; struct var { const char *name; enum var_type fmt; unsigned len; const char *rname; unsigned r_methods; const char *lname; unsigned w_methods; const char *http; const char *hdr; }; struct method { const char *name; unsigned ret_bitmap; unsigned bitval; }; /*--------------------------------------------------------------------*/ /* vcc_acl.c */ void vcc_Acl(struct vcc *tl); void vcc_Acl_Hack(struct vcc *tl, char *b); /* vcc_action.c */ int vcc_ParseAction(struct vcc *tl); /* vcc_backend.c */ struct fld_spec; typedef void parsedirector_f(struct vcc *tl); void vcc_ParseProbe(struct vcc *tl); void vcc_ParseDirector(struct vcc *tl); void vcc_ParseBackendHost(struct vcc *tl, int serial, char **nm); struct fld_spec * vcc_FldSpec(struct vcc *tl, const char *first, ...); void vcc_ResetFldSpec(struct fld_spec *f); void vcc_IsField(struct vcc *tl, struct token **t, struct fld_spec *fs); void vcc_FieldsOk(struct vcc *tl, const struct fld_spec *fs); void Emit_Sockaddr(struct vcc *tl, const struct token *t_host, const char *port); /* vcc_compile.c */ extern struct method method_tab[]; /* * 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, ...); void Fc(const struct vcc *tl, int indent, const char *fmt, ...); void Fb(const struct vcc *tl, int indent, const char *fmt, ...); void Fi(const struct vcc *tl, int indent, const char *fmt, ...); void Ff(const struct vcc *tl, int indent, const char *fmt, ...); 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_dir_random.c */ parsedirector_f vcc_ParseRandomDirector; /* vcc_dir_round_robin.c */ parsedirector_f vcc_ParseRoundRobinDirector; /* vcc_expr.c */ void vcc_RTimeVal(struct vcc *tl, double *); void vcc_TimeVal(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_Func; sym_expr_t vcc_Eval_Backend; /* vcc_dir_dns.c */ parsedirector_f vcc_ParseDnsDirector; /* 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_string.c */ char *vcc_regexp(struct vcc *tl); /* 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, int line); int vcc_Teq(const struct token *t1, const struct token *t2); 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-3.0.5/lib/libvcl/vcc_backend.c0000644000175000017500000004660512247035455014543 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 necessary explanation of a convoluted policy: * * In VCL we have backends and directors. * * In VRT we have directors which reference (a number of) backend hosts. * * A VCL backend therefore has an implicit director of type "simple" created * by the compiler, but not visible in VCL. * * A VCL backend is a "named host", these can be referenced by name from * VCL directors, but not from VCL backends. * * The reason for this quasimadness is that we want to collect statistics * for each actual kickable hardware backend machine, but we want to be * able to refer to them multiple times in different directors. * * At the same time, we do not want to force users to declare each backend * host with a name, if all they want to do is put it into a director, so * backend hosts can be declared inline in the director, in which case * its identity is the director and its numerical index therein. */ #include "config.h" #include #include #include #include #include #include #include #include #include "vsb.h" #include "vss.h" #include "vcc_priv.h" #include "vcc_compile.h" #include "libvarnish.h" struct host { VTAILQ_ENTRY(host) list; struct token *name; char *vgcname; }; static int emit_sockaddr(struct vcc *tl, void *sa, unsigned sal) { unsigned len; uint8_t *u; AN(sa); AN(sal); assert(sal < 256); Fh(tl, 0, "\nstatic const unsigned char sockaddr%u[%d] = {\n", tl->unique, sal + 1); Fh(tl, 0, " %3u, /* Length */\n", sal); u = sa; for (len = 0; len unique++); } /*-------------------------------------------------------------------- * 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. */ #include void Emit_Sockaddr(struct vcc *tl, const struct token *t_host, const char *port) { struct addrinfo *res, *res0, *res1, hint; int n4, n6, error, retval, x; const char *emit, *multiple; char hbuf[NI_MAXHOST]; char *hop, *pop; AN(t_host->dec); retval = 0; memset(&hint, 0, sizeof hint); hint.ai_family = PF_UNSPEC; hint.ai_socktype = SOCK_STREAM; if (VSS_parse(t_host->dec, &hop, &pop)) { VSB_printf(tl->sb, "Backend host '%.*s': wrong syntax (unbalanced [...] ?)\n", PF(t_host) ); vcc_ErrWhere(tl, t_host); return; } error = getaddrinfo( hop != NULL ? hop : t_host->dec, pop != NULL ? pop : port, &hint, &res0); free(hop); free(pop); if (error) { VSB_printf(tl->sb, "Backend host '%.*s'" " could not be resolved to an IP address:\n", PF(t_host)); VSB_printf(tl->sb, "\t%s\n" "(Sorry if that error message is gibberish.)\n", gai_strerror(error)); vcc_ErrWhere(tl, t_host); return; } AZ(error); n4 = n6 = 0; multiple = NULL; for (res = res0; res; res = res->ai_next) { emit = NULL; if (res->ai_family == PF_INET) { if (n4++ == 0) emit = "ipv4"; else multiple = "IPv4"; } else if (res->ai_family == PF_INET6) { if (n6++ == 0) emit = "ipv6"; else multiple = "IPv6"; } else continue; if (multiple != NULL) { VSB_printf(tl->sb, "Backend host %.*s: resolves to " "multiple %s addresses.\n" "Only one address is allowed.\n" "Please specify which exact address " "you want to use, we found these:\n", PF(t_host), multiple); for (res1 = res0; res1 != NULL; res1 = res1->ai_next) { error = getnameinfo(res1->ai_addr, res1->ai_addrlen, hbuf, sizeof hbuf, NULL, 0, NI_NUMERICHOST); AZ(error); VSB_printf(tl->sb, "\t%s\n", hbuf); } vcc_ErrWhere(tl, t_host); return; } AN(emit); x = emit_sockaddr(tl, res->ai_addr, res->ai_addrlen); Fb(tl, 0, "\t.%s_sockaddr = sockaddr%u,\n", emit, x); error = getnameinfo(res->ai_addr, res->ai_addrlen, hbuf, sizeof hbuf, NULL, 0, NI_NUMERICHOST); AZ(error); Fb(tl, 0, "\t.%s_addr = \"%s\",\n", emit, hbuf); retval++; } if (res0 != NULL) { error = getnameinfo(res0->ai_addr, res0->ai_addrlen, NULL, 0, hbuf, sizeof hbuf, NI_NUMERICSERV); AZ(error); Fb(tl, 0, "\t.port = \"%s\",\n", hbuf); } freeaddrinfo(res0); if (retval == 0) { VSB_printf(tl->sb, "Backend host '%.*s': resolves to " "neither IPv4 nor IPv6 addresses.\n", PF(t_host) ); vcc_ErrWhere(tl, t_host); } } /*-------------------------------------------------------------------- * 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) { struct fld_spec *fs; struct token *t_field; struct token *t_did = NULL, *t_window = NULL, *t_threshold = NULL; struct token *t_initial = NULL; unsigned window, threshold, initial, status; double t; fs = vcc_FldSpec(tl, "?url", "?request", "?expected_response", "?timeout", "?interval", "?window", "?threshold", "?initial", NULL); SkipToken(tl, '{'); window = 0; threshold = 0; initial = 0; status = 0; Fh(tl, 0, "static const struct vrt_backend_probe vgc_probe__%d = {\n", tl->nprobe++); 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_TimeVal(tl, &t); ERRCHK(tl); Fh(tl, 0, "%g,\n", t); } else if (vcc_IdIs(t_field, "interval")) { Fh(tl, 0, "\t.interval = "); vcc_TimeVal(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", initial); 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; int i; vcc_NextToken(tl); /* ID: probe */ vcc_ExpectCid(tl); /* ID: name */ ERRCHK(tl); t_probe = tl->t; vcc_NextToken(tl); i = vcc_AddDef(tl, t_probe, SYM_PROBE); if (i > 1) { VSB_printf(tl->sb, "Probe %.*s redefined\n", PF(t_probe)); vcc_ErrWhere(tl, t_probe); } Fh(tl, 0, "\n#define vgc_probe_%.*s\tvgc_probe__%d\n", PF(t_probe), tl->nprobe); vcc_ParseProbeSpec(tl); } /*-------------------------------------------------------------------- * Parse and emit a backend host definition * * The struct vrt_backend is emitted to Fh(). */ static void vcc_ParseHostDef(struct vcc *tl, int serial, const char *vgcname) { struct token *t_field; struct token *t_host = NULL; struct token *t_port = NULL; struct token *t_hosthdr = NULL; unsigned saint = UINT_MAX; struct fld_spec *fs; struct vsb *vsb; unsigned u; double t; Fh(tl, 1, "\n#define VGC_backend_%s %d\n", vgcname, tl->ndirector); fs = vcc_FldSpec(tl, "!host", "?port", "?host_header", "?connect_timeout", "?first_byte_timeout", "?between_bytes_timeout", "?probe", "?max_connections", "?saintmode_threshold", 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.vcl_name = \"%.*s", PF(tl->t_dir)); if (serial >= 0) Fb(tl, 0, "[%d]", serial); 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_TimeVal(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_TimeVal(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_TimeVal(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, "saintmode_threshold")) { u = vcc_UintVal(tl); /* UINT_MAX == magic number to mark as unset, so * not allowed here. */ if (u == UINT_MAX) { VSB_printf(tl->sb, "Value outside allowed range: "); vcc_ErrToken(tl, tl->t); VSB_printf(tl->sb, " at\n"); vcc_ErrWhere(tl, tl->t); } ERRCHK(tl); saint = u; SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "probe") && tl->t->tok == '{') { Fb(tl, 0, "\t.probe = &vgc_probe__%d,\n", tl->nprobe); vcc_ParseProbeSpec(tl); 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."); 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); if (t_port != NULL) Emit_Sockaddr(tl, t_host, t_port->dec); else Emit_Sockaddr(tl, t_host, "80"); 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"); Fb(tl, 0, "\t.saintmode_threshold = %d,\n",saint); /* 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); Fi(tl, 0, "\tVRT_init_dir(cli, VCL_conf.director, \"simple\",\n" "\t VGC_backend_%s, &vgc_dir_priv_%s);\n", vgcname, vgcname); Ff(tl, 0, "\tVRT_fini_dir(cli, VGCDIR(%s));\n", vgcname); tl->ndirector++; } /*-------------------------------------------------------------------- * Parse and emit a backend host specification. * * The syntax is the following: * * backend_spec: * name_of_backend # by reference * '{' be_elements '}' # by specification * * The struct vrt_backend is emitted to Fh(). */ void vcc_ParseBackendHost(struct vcc *tl, int serial, char **nm) { struct host *h; struct token *t; char vgcname[BUFSIZ]; AN(nm); *nm = NULL; if (tl->t->tok == ID) { VTAILQ_FOREACH(h, &tl->hosts, list) { if (vcc_Teq(h->name, tl->t)) break; } if (h == NULL) { VSB_printf(tl->sb, "Reference to unknown backend "); vcc_ErrToken(tl, tl->t); VSB_printf(tl->sb, " at\n"); vcc_ErrWhere(tl, tl->t); return; } vcc_AddRef(tl, h->name, SYM_BACKEND); vcc_NextToken(tl); SkipToken(tl, ';'); *nm = h->vgcname; } else if (tl->t->tok == '{') { t = tl->t; sprintf(vgcname, "%.*s_%d", PF(tl->t_dir), serial); vcc_ParseHostDef(tl, serial, vgcname); if (tl->err) { VSB_printf(tl->sb, "\nIn backend host specification starting at:\n"); vcc_ErrWhere(tl, t); } *nm = strdup(vgcname); /* XXX */ return; } else { VSB_printf(tl->sb, "Expected a backend host specification here, " "either by name or by {...}\n"); vcc_ErrToken(tl, tl->t); VSB_printf(tl->sb, " at\n"); vcc_ErrWhere(tl, tl->t); return; } } /*-------------------------------------------------------------------- * Tell rest of compiler about a backend */ static void vcc_DefBackend(struct vcc *tl, const struct token *nm) { struct symbol *sym; sym = VCC_GetSymbolTok(tl, nm, SYM_BACKEND); AN(sym); if (sym->ndef > 0) { VSB_printf(tl->sb, "Backend %.*s redefined\n", PF(nm)); vcc_ErrWhere(tl, nm); return; } sym->fmt = BACKEND; sym->eval = vcc_Eval_Backend; sym->ndef++; } /*-------------------------------------------------------------------- * Parse a plain backend aka a simple director */ static void vcc_ParseSimpleDirector(struct vcc *tl) { struct host *h; char vgcname[BUFSIZ]; h = TlAlloc(tl, sizeof *h); h->name = tl->t_dir; vcc_DefBackend(tl, tl->t_dir); ERRCHK(tl); sprintf(vgcname, "_%.*s", PF(h->name)); h->vgcname = TlAlloc(tl, strlen(vgcname) + 1); strcpy(h->vgcname, vgcname); vcc_ParseHostDef(tl, -1, vgcname); ERRCHK(tl); VTAILQ_INSERT_TAIL(&tl->hosts, h, list); } /*-------------------------------------------------------------------- * Parse directors and backends */ static const struct dirlist { const char *name; parsedirector_f *func; } dirlist[] = { { "hash", vcc_ParseRandomDirector }, { "random", vcc_ParseRandomDirector }, { "client", vcc_ParseRandomDirector }, { "round-robin", vcc_ParseRoundRobinDirector }, { "fallback", vcc_ParseRoundRobinDirector }, { "dns", vcc_ParseDnsDirector }, { NULL, NULL } }; void vcc_ParseDirector(struct vcc *tl) { struct token *t_first; struct dirlist const *dl; int isfirst; t_first = tl->t; vcc_NextToken(tl); /* ID: director | backend */ vcc_ExpectCid(tl); /* ID: name */ ERRCHK(tl); if (tl->t->e - tl->t->b > 64) { VSB_printf(tl->sb, "Name of %.*s too long (max 64, is %zu):\n", PF(t_first), (size_t)(tl->t->e - tl->t->b)); vcc_ErrWhere(tl, tl->t); return; } tl->t_dir = tl->t; vcc_NextToken(tl); isfirst = tl->ndirector; if (vcc_IdIs(t_first, "backend")) { tl->t_policy = t_first; vcc_ParseSimpleDirector(tl); } else { vcc_DefBackend(tl, tl->t_dir); ERRCHK(tl); ExpectErr(tl, ID); /* ID: policy */ tl->t_policy = tl->t; vcc_NextToken(tl); for (dl = dirlist; dl->name != NULL; dl++) if (vcc_IdIs(tl->t_policy, dl->name)) break; if (dl->name == NULL) { VSB_printf(tl->sb, "Unknown director policy: "); vcc_ErrToken(tl, tl->t_policy); VSB_printf(tl->sb, " at\n"); vcc_ErrWhere(tl, tl->t_policy); return; } Ff(tl, 0, "\tVRT_fini_dir(cli, VGCDIR(_%.*s));\n", PF(tl->t_dir)); SkipToken(tl, '{'); dl->func(tl); if (!tl->err) SkipToken(tl, '}'); Fh(tl, 1, "\n#define VGC_backend__%.*s %d\n", PF(tl->t_dir), tl->ndirector); tl->ndirector++; Fi(tl, 0, "\tVRT_init_dir(cli, VCL_conf.director, \"%.*s\",\n", PF(tl->t_policy)); Fi(tl, 0, "\t VGC_backend__%.*s, &vgc_dir_priv_%.*s);\n", PF(tl->t_dir), PF(tl->t_dir)); } if (tl->err) { VSB_printf(tl->sb, "\nIn %.*s specification starting at:\n", PF(t_first)); vcc_ErrWhere(tl, t_first); return; } if (isfirst == 1 || vcc_IdIs(tl->t_dir, "default")) { tl->defaultdir = tl->ndirector - 1; tl->t_defaultdir = tl->t_dir; } tl->t_policy = NULL; tl->t_dir = NULL; } varnish-3.0.5/lib/libvcl/vcc_action.c0000644000175000017500000002104612247035455014421 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 parses the real action of the VCL code, the procedure * statements which do the actual work. */ #include "config.h" #include #include #include "vsb.h" #include "vcc_priv.h" #include "vcc_compile.h" #include "libvarnish.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(sp))\n", PF(tl->t)); Fb(tl, 1, "\treturn (1);\n"); vcc_NextToken(tl); return; } /*--------------------------------------------------------------------*/ static void parse_error(struct vcc *tl) { vcc_NextToken(tl); Fb(tl, 1, "VRT_error(sp,\n"); if (tl->t->tok == '(') { vcc_NextToken(tl); vcc_Expr(tl, INT); if (tl->t->tok == ',') { Fb(tl, 1, ",\n"); vcc_NextToken(tl); vcc_Expr(tl, STRING); } else Fb(tl, 1, ", 0\n"); SkipToken(tl, ')'); } else { vcc_Expr(tl, INT); if (tl->t->tok != ';') { Fb(tl, 1, ",\n"); vcc_Expr(tl, STRING); } else Fb(tl, 1, ", 0\n"); } Fb(tl, 1, ");\n"); Fb(tl, 1, "VRT_done(sp, VCL_RET_ERROR);\n"); } /*--------------------------------------------------------------------*/ 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", vp->lname); 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, 0, "%s %c ", vp->rname, *tl->t->b); vcc_NextToken(tl); fmt = ap->want; break; } if (ap->type == VOID) SkipToken(tl, ap->oper); if (fmt == STRING) { vcc_Expr(tl, STRING_LIST); } else { vcc_Expr(tl, fmt); } Fb(tl, 1, ");\n"); } /*--------------------------------------------------------------------*/ static void parse_unset(struct vcc *tl) { const struct var *vp; vcc_NextToken(tl); ExpectErr(tl, ID); vp = vcc_FindVar(tl, tl->t, 1, "cannot be unset"); ERRCHK(tl); assert(vp != NULL); if (vp->fmt != STRING || vp->http == NULL) { 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_ban(struct vcc *tl) { vcc_NextToken(tl); ExpectErr(tl, '('); vcc_NextToken(tl); Fb(tl, 1, "VRT_ban_string(sp, "); vcc_Expr(tl, STRING); ERRCHK(tl); Fb(tl, 0, ");\n"); ExpectErr(tl, ')'); vcc_NextToken(tl); } /*--------------------------------------------------------------------*/ static void parse_ban_url(struct vcc *tl) { vcc_NextToken(tl); ExpectErr(tl, '('); vcc_NextToken(tl); Fb(tl, 1, "VRT_ban(sp, \"req.url\", \"~\", "); vcc_Expr(tl, STRING); ERRCHK(tl); ExpectErr(tl, ')'); vcc_NextToken(tl); Fb(tl, 0, ", 0);\n"); } /*--------------------------------------------------------------------*/ static void parse_new_syntax(struct vcc *tl) { VSB_printf(tl->sb, "Please change \"%.*s\" to \"return(%.*s)\".\n", PF(tl->t), PF(tl->t)); vcc_ErrWhere(tl, tl->t); } /*--------------------------------------------------------------------*/ static void parse_hash_data(struct vcc *tl) { vcc_NextToken(tl); SkipToken(tl, '('); Fb(tl, 1, "VRT_hashdata(sp, "); vcc_Expr(tl, STRING_LIST); ERRCHK(tl); Fb(tl, 0, ");\n"); SkipToken(tl, ')'); } /*--------------------------------------------------------------------*/ static void parse_panic(struct vcc *tl) { vcc_NextToken(tl); Fb(tl, 1, "VRT_panic(sp, "); vcc_Expr(tl, STRING); ERRCHK(tl); Fb(tl, 0, ", vrt_magic_string_end);\n"); } /*--------------------------------------------------------------------*/ static void parse_return(struct vcc *tl) { int retval = 0; vcc_NextToken(tl); ExpectErr(tl, '('); vcc_NextToken(tl); ExpectErr(tl, ID); #define VCL_RET_MAC(l, U, B) \ do { \ if (vcc_IdIs(tl->t, #l)) { \ Fb(tl, 1, "VRT_done(sp, VCL_RET_" #U ");\n"); \ vcc_ProcAction(tl->curproc, VCL_RET_##U, tl->t);\ retval = 1; \ } \ } while (0); #include "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(sp);\n"); } /*--------------------------------------------------------------------*/ static void parse_purge(struct vcc *tl) { vcc_NextToken(tl); Fb(tl, 1, "VRT_purge(sp, 0, 0);\n"); } /*--------------------------------------------------------------------*/ static void parse_synthetic(struct vcc *tl) { vcc_NextToken(tl); Fb(tl, 1, "VRT_synth_page(sp, 0, "); vcc_Expr(tl, STRING_LIST); ERRCHK(tl); Fb(tl, 0, ");\n"); } /*--------------------------------------------------------------------*/ typedef void action_f(struct vcc *tl); static struct action_table { const char *name; action_f *func; unsigned bitmask; } action_table[] = { { "error", parse_error, VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH }, #define VCL_RET_MAC(l, U, B) \ { #l, parse_new_syntax }, #include "vcl_returns.h" #undef VCL_RET_MAC /* Keep list sorted from here */ { "call", parse_call }, { "hash_data", parse_hash_data, VCL_MET_HASH }, { "panic", parse_panic }, { "ban", parse_ban }, { "ban_url", parse_ban_url }, { "remove", parse_unset }, /* backward compatibility */ { "return", parse_return }, { "rollback", parse_rollback }, { "set", parse_set }, { "synthetic", parse_synthetic, VCL_MET_ERROR }, { "unset", parse_unset }, { "purge", parse_purge, VCL_MET_MISS | VCL_MET_HIT }, { 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-3.0.5/lib/libvcl/vcc_expr.c0000644000175000017500000006507312247035455014132 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 "vsb.h" #include "vcc_priv.h" #include "vcc_compile.h" #include "libvarnish.h" static const char * vcc_Type(enum var_type fmt) { switch(fmt) { #define VCC_TYPE(a) case a: return(#a); #include "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 { VSB_printf(tl->sb, "Unknown time unit "); vcc_ErrToken(tl, tl->t); VSB_printf(tl->sb, ". Legal are 's', 'm', 'h' and 'd'\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); } static double vcc_DoubleVal(struct vcc *tl) { double d; int i; vcc_NumVal(tl, &d, &i); return (d); } /*--------------------------------------------------------------------*/ void vcc_RTimeVal(struct vcc *tl, double *d) { double v, sc; int sign = 1; if (tl->t->tok == '-') { sign *= -1; vcc_NextToken(tl); } v = vcc_DoubleVal(tl); ERRCHK(tl); ExpectErr(tl, ID); sc = vcc_TimeUnit(tl); *d = sign * v * sc; } /*--------------------------------------------------------------------*/ void vcc_TimeVal(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; struct token *t1, *t2; }; 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; return (e); } 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; e = vcc_new_expr(); while (*p != '\0') { if (*p == '\n') { if (!nl) VSB_putc(e->vsb, *p); nl = 1; p++; continue; } nl = 0; if (*p != '\v') { VSB_putc(e->vsb, *p); p++; continue; } assert(*p == '\v'); p++; switch(*p) { case '+': VSB_cat(e->vsb, "\v+"); break; case '-': VSB_cat(e->vsb, "\v-"); break; case '1': case '2': if (*p == '1') VSB_cat(e->vsb, VSB_data(e1->vsb)); else { AN(e2); VSB_cat(e->vsb, VSB_data(e2->vsb)); } break; default: assert(__LINE__ == 0); } p++; } AZ(VSB_finish(e->vsb)); if (e1 != NULL) e->t1 = e1->t1; else if (e2 != NULL) e->t1 = e2->t1; if (e2 != NULL) e->t2 = e2->t1; else if (e1 != NULL) e->t1 = e1->t1; if ((e1 == NULL || e1->constant) && (e2 == NULL || e2->constant)) e->constant = 1; 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: assert(__LINE__ == 0); } 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 "vcc_types.h" #undef VCC_TYPE return (VOID); } /*-------------------------------------------------------------------- */ static void vcc_expr_tostring(struct expr **e, enum var_type fmt) { const char *p; CHECK_OBJ_NOTNULL(*e, EXPR_MAGIC); AN(fmt == STRING || fmt == STRING_LIST); p = NULL; switch((*e)->fmt) { case BACKEND: p = "VRT_backend_string(sp, \v1)"; break; case BOOL: p = "VRT_bool_string(sp, \v1)"; break; case DURATION: p = "VRT_double_string(sp, \v1)"; break; /* XXX: should DURATION insist on "s" suffix ? */ case INT: p = "VRT_int_string(sp, \v1)"; break; case IP: p = "VRT_IP_string(sp, \v1)"; break; case BYTES: p = "VRT_double_string(sp, \v1)"; break; /* XXX */ case REAL: p = "VRT_double_string(sp, \v1)"; break; case TIME: p = "VRT_time_string(sp, \v1)"; break; default: break; } if (p != NULL) *e = vcc_expr_edit(fmt, p, *e, NULL); } /*-------------------------------------------------------------------- */ 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; char *p; char buf[128]; vcc_delete_expr(*e); SkipToken(tl, ID); SkipToken(tl, '('); vcc_expr0(tl, &e2, STRING); if (e2 == NULL) return; if (e2->fmt != STRING) vcc_expr_tostring(&e2, STRING); SkipToken(tl, ','); ExpectErr(tl, CSTR); p = vcc_regexp(tl); vcc_NextToken(tl); bprintf(buf, "VRT_regsub(sp, %d,\n\v1,\n%s\n", all, p); *e = vcc_expr_edit(STRING, buf, e2, *e); SkipToken(tl, ','); vcc_expr0(tl, &e2, STRING); if (e2 == NULL) return; if (e2->fmt != STRING) vcc_expr_tostring(&e2, STRING); *e = vcc_expr_edit(STRING, "\v1, \v2)", *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 = 1; } /*-------------------------------------------------------------------- */ 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, "VGCDIR(_%.*s)", PF(tl->t)); 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); } /*-------------------------------------------------------------------- */ void vcc_Eval_Func(struct vcc *tl, struct expr **e, const struct symbol *sym) { const char *p, *r; struct expr *e1, *e2; enum var_type fmt; char buf[32]; assert(sym->kind == SYM_FUNC || sym->kind == SYM_PROC); AN(sym->cfunc); AN(sym->args); SkipToken(tl, ID); SkipToken(tl, '('); p = sym->args; e2 = vcc_mk_expr(vcc_arg_type(&p), "%s(sp\v+", sym->cfunc); while (*p != '\0') { e1 = NULL; fmt = vcc_arg_type(&p); if (fmt == VOID && !strcmp(p, "PRIV_VCL")) { r = strchr(sym->name, '.'); AN(r); e1 = vcc_mk_expr(VOID, "&vmod_priv_%.*s", r - sym->name, sym->name); p += strlen(p) + 1; } else if (fmt == VOID && !strcmp(p, "PRIV_CALL")) { bprintf(buf, "vmod_priv_%u", tl->nvmodpriv++); Fh(tl, 0, "struct vmod_priv %s;\n", buf); e1 = vcc_mk_expr(VOID, "&%s", buf); p += strlen(p) + 1; } else if (fmt == ENUM) { ExpectErr(tl, ID); ERRCHK(tl); r = p; 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; } e1 = vcc_mk_expr(VOID, "\"%.*s\"", PF(tl->t)); while (*p != '\0') p += strlen(p) + 1; p++; SkipToken(tl, ID); if (*p != '\0') SkipToken(tl, ','); } else if (fmt == HEADER) { const struct var *v; sym = VCC_FindSymbol(tl, tl->t, SYM_NONE); ERRCHK(tl); SkipToken(tl, ID); if (sym == NULL) { VSB_printf(tl->sb, "Symbol not found.\n"); vcc_ErrWhere(tl, tl->t); return; } vcc_AddUses(tl, tl->t, sym->r_methods, "Not available"); if (sym->kind != SYM_VAR) { VSB_printf(tl->sb, "Wrong kind of symbol.\n"); vcc_ErrWhere(tl, tl->t); return; } AN(sym->var); v = sym->var; if (v->http == NULL) { VSB_printf(tl->sb, "Variable not an HTTP header.\n"); vcc_ErrWhere(tl, tl->t); return; } e1 = vcc_mk_expr(VOID, "%s, \"%s\"", v->http, v->hdr); if (*p != '\0') SkipToken(tl, ','); } else { vcc_expr0(tl, &e1, fmt); ERRCHK(tl); if (e1->fmt != fmt) { VSB_printf(tl->sb, "Wrong argument type."); VSB_printf(tl->sb, " Expected %s.", vcc_Type(fmt)); VSB_printf(tl->sb, " Got %s.\n", vcc_Type(e1->fmt)); vcc_ErrWhere2(tl, e1->t1, tl->t); return; } assert(e1->fmt == fmt); if (e1->fmt == STRING_LIST) { e1 = vcc_expr_edit(STRING_LIST, "\v+\n\v1,\nvrt_magic_string_end\v-", e1, NULL); } if (*p != '\0') SkipToken(tl, ','); } e2 = vcc_expr_edit(e2->fmt, "\v1,\n\v2", e2, e1); } SkipToken(tl, ')'); e2 = vcc_expr_edit(e2->fmt, "\v1\n)\v-", e2, NULL); *e = e2; } /*-------------------------------------------------------------------- * SYNTAX: * Expr4: * '(' Expr0 ')' * CNUM * CSTR */ static void vcc_expr4(struct vcc *tl, struct expr **e, enum var_type fmt) { struct expr *e1, *e2; const struct symbol *sym; double d; *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 = 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: AN(sym->eval); AZ(*e); sym->eval(tl, e, sym); 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); e1 = vcc_new_expr(); EncToken(e1->vsb, tl->t); e1->fmt = STRING; e1->t1 = tl->t; e1->constant = 1; vcc_NextToken(tl); AZ(VSB_finish(e1->vsb)); *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_RTimeVal(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, "%g", vcc_DoubleVal(tl)); ERRCHK(tl); } else { e1 = vcc_mk_expr(INT, "%.*s", PF(tl->t)); vcc_NextToken(tl); } e1->constant = 1; *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 } * */ 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; if ((f2 == STRING_LIST || f2 == STRING) && tl->t->tok == '+') { while (tl->t->tok == '+') { vcc_NextToken(tl); vcc_expr_mul(tl, &e2, STRING); ERRCHK(tl); if (e2->fmt != STRING && e2->fmt != STRING_LIST) vcc_expr_tostring(&e2, f2); ERRCHK(tl); assert(e2->fmt == STRING || e2->fmt == STRING_LIST); if ((*e)->constant && e2->constant) { assert((*e)->fmt == STRING); assert(e2->fmt == STRING); *e = vcc_expr_edit(STRING, "\v1\n\v2", *e, e2); } else { *e = vcc_expr_edit(STRING_LIST, "\v1,\n\v2", *e, e2); } } } if (fmt != STRING_LIST && (*e)->fmt == STRING_LIST) *e = vcc_expr_edit(STRING, "\v+VRT_WrkString(sp,\n\v1,\nvrt_magic_string_end)", *e, NULL); if (fmt == STRING_LIST && (*e)->fmt == STRING) (*e)->fmt = STRING_LIST; switch(f2) { case INT: break; case TIME: break; case DURATION: break; case BYTES: 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 == '-') { if (f2 == TIME) f2 = DURATION; tk = tl->t; vcc_NextToken(tl); vcc_expr_mul(tl, &e2, f2); ERRCHK(tl); if (tk->tok == '-' && (*e)->fmt == TIME && e2->fmt == TIME) { /* OK */ } else if (tk->tok == '-' && (*e)->fmt == BYTES && e2->fmt == BYTES) { /* OK */ } else if (e2->fmt != f2) { 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); } } /*-------------------------------------------------------------------- * 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), {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]; char *re; const char *not; struct token *tk; *e = NULL; vcc_expr_add(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_add(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(sp, \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(sp, \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)) { vcc_NextToken(tl); ExpectErr(tl, ID); vcc_AddRef(tl, tl->t, SYM_BACKEND); bprintf(buf, "(\v1 %.*s VGCDIR(_%.*s))", PF(tk), PF(tl->t)); 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) return; *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); } /*-------------------------------------------------------------------- * 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); if (fmt == STRING || fmt == STRING_LIST) vcc_expr_tostring(&e, fmt); 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_Func(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-3.0.5/lib/libvcl/symbol_kind.h0000644000175000017500000000351012247035455014624 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 */ VCC_SYMB(NONE, none, "undefined") VCC_SYMB(VAR, var, "variable") VCC_SYMB(FUNC, func, "function") /* VMOD function */ VCC_SYMB(PROC, proc, "procedure") /* VMOD procedure */ VCC_SYMB(VMOD, vmod, "vmod") VCC_SYMB(ACL, acl, "acl") VCC_SYMB(SUB, sub, "sub") /* VCL subroutine */ VCC_SYMB(BACKEND, backend, "backend") VCC_SYMB(PROBE, probe, "probe") VCC_SYMB(WILDCARD, wildcard, "wildcard") /*lint -restore */ varnish-3.0.5/lib/libvcl/Makefile.in0000644000175000017500000005541412247037163014216 00000000000000# Makefile.in generated by automake 1.14 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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/libvcl DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.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) libvcl_la_LIBADD = am_libvcl_la_OBJECTS = vcc_acl.lo vcc_action.lo vcc_backend.lo \ vcc_backend_util.lo vcc_compile.lo vcc_dir_random.lo \ vcc_dir_round_robin.lo vcc_dir_dns.lo vcc_expr.lo vcc_parse.lo \ vcc_fixed_token.lo vcc_obj.lo vcc_storage.lo vcc_string.lo \ vcc_symb.lo vcc_token.lo vcc_var.lo vcc_vmod.lo vcc_xref.lo libvcl_la_OBJECTS = $(am_libvcl_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libvcl_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libvcl_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : 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_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/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_CC_1 = 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_CCLD_1 = SOURCES = $(libvcl_la_SOURCES) DIST_SOURCES = $(libvcl_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIBS = @CURSES_LIBS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ 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@ JEMALLOC_SUBDIR = @JEMALLOC_SUBDIR@ 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@ 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@ XSLTPROC = @XSLTPROC@ 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@ INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include pkglib_LTLIBRARIES = libvcl.la libvcl_la_LDFLAGS = -avoid-version libvcl_la_SOURCES = \ vcc_priv.h \ vcc_compile.h \ vcc_token_defs.h \ vcc_types.h \ symbol_kind.h \ \ vcc_acl.c \ vcc_action.c \ vcc_backend.c \ vcc_backend_util.c \ vcc_compile.c \ vcc_dir_random.c \ vcc_dir_round_robin.c \ vcc_dir_dns.c \ vcc_expr.c \ vcc_parse.c \ vcc_fixed_token.c \ vcc_obj.c \ vcc_storage.c \ vcc_string.c \ vcc_symb.c \ vcc_token.c \ vcc_var.c \ vcc_vmod.c \ vcc_xref.c EXTRA_DIST = \ generate.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: $(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/libvcl/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign lib/libvcl/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: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) @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 " $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" || exit 1; \ 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)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libvcl.la: $(libvcl_la_OBJECTS) $(libvcl_la_DEPENDENCIES) $(EXTRA_libvcl_la_DEPENDENCIES) $(AM_V_CCLD)$(libvcl_la_LINK) -rpath $(pkglibdir) $(libvcl_la_OBJECTS) $(libvcl_la_LIBADD) $(LIBS) 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_dir_dns.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcc_dir_random.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcc_dir_round_robin.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_string.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_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 -o $@ $< .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 -o $@ `$(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: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ 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-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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: -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-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 TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES cscopelist-am ctags \ ctags-am 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 tags-am uninstall uninstall-am \ uninstall-pkglibLTLIBRARIES vcc_obj.c vcc_fixed_token.c vcc_token_defs.h: $(srcdir)/generate.py $(top_srcdir)/include/vrt.h @PYTHON@ $(top_srcdir)/lib/libvcl/generate.py $(top_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-3.0.5/lib/libvcl/vcc_fixed_token.c0000644000175000017500000004271612247037175015453 00000000000000/* * NB: This file is machine generated, DO NOT EDIT! * * Edit and run generate.py instead */ #include "config.h" #include #include #include "config.h" #include "vcc_priv.h" #include "vsb.h" #define M1() do {*q = p + 1; return (p[0]); } while (0) #define M2(c,t) do {if (p[1] == (c)) { *q = p + 2; return (t); }} while (0) 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 'e': if (p[1] == 'l' && p[2] == 's' && p[3] == 'e' && p[4] == 'i' && p[5] == 'f' && !isvar(p[6])) { *q = p + 6; return (T_ELSEIF); } if (p[1] == 'l' && p[2] == 's' && p[3] == 'i' && p[4] == 'f' && !isvar(p[5])) { *q = p + 5; return (T_ELSIF); } if (p[1] == 'l' && p[2] == 's' && p[3] == 'e' && !isvar(p[4])) { *q = p + 4; return (T_ELSE); } return (0); case 'i': if (p[1] == 'n' && p[2] == 'c' && p[3] == 'l' && p[4] == 'u' && p[5] == 'd' && p[6] == 'e' && !isvar(p[7])) { *q = p + 7; return (T_INCLUDE); } M2('f', T_IF); return (0); 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_ELSE] = "else", [T_ELSEIF] = "elseif", [T_ELSIF] = "elsif", [T_EQ] = "==", [T_GEQ] = ">=", [T_IF] = "if", [T_INC] = "++", [T_INCLUDE] = "include", [T_INCR] = "+=", [T_LEQ] = "<=", [T_MUL] = "*=", [T_NEQ] = "!=", [T_NOMATCH] = "!~", [T_SHL] = "<<", [T_SHR] = ">>", }; void vcl_output_lang_h(struct vsb *sb) { /* ../include/vcl.h */ VSB_cat(sb, "/*\n * NB: This file is machine generated, DO " "NOT EDIT!\n *\n * Edit and run generate.py instead\n" " */\n\nstruct sess;\nstruct cli;\n\ntypedef int vcl_init_f(struc" "t cli *);\ntypedef void vcl_fini_f(struct cli *);\n" "typedef int vcl_func_f(struct sess *sp);\n\n/* VCL Methods " "*/\n#define VCL_MET_RECV\t\t(1U << 0)\n#define VCL_MET_PIPE\t" "\t(1U << 1)\n#define VCL_MET_PASS\t\t(1U << 2)\n#define VCL_MET_" "HASH\t\t(1U << 3)\n#define VCL_MET_MISS\t\t(1U << 4)\n" "#define VCL_MET_HIT\t\t(1U << 5)\n#define VCL_MET_FETCH\t\t" "(1U << 6)\n#define VCL_MET_DELIVER\t\t(1U << 7)\n" "#define VCL_MET_ERROR\t\t(1U << 8)\n#define VCL_MET_INIT\t\t" "(1U << 9)\n#define VCL_MET_FINI\t\t(1U << 10)\n\n" "#define VCL_MET_MAX\t\t11\n\n#define VCL_MET_MASK\t\t0x7ff\n" "\n/* VCL Returns */\n#define VCL_RET_DELIVER\t\t0\n" "#define VCL_RET_ERROR\t\t1\n#define VCL_RET_FETCH\t\t2\n" "#define VCL_RET_HASH\t\t3\n#define VCL_RET_HIT_FOR_PASS\t\t" "4\n#define VCL_RET_LOOKUP\t\t5\n#define VCL_RET_OK\t\t6\n" "#define VCL_RET_PASS\t\t7\n#define VCL_RET_PIPE\t\t8\n" "#define VCL_RET_RESTART\t\t9\n\n#define VCL_RET_MAX\t\t10\n" "\nstruct VCL_conf {\n\tunsigned\tmagic;\n#define VCL_CONF_MAGIC\t" "0x7406c509\t/* from /dev/random */\n\n\tstruct director\t**direc" "tor;\n\tunsigned\tndirector;\n\tstruct vrt_ref\t*ref;\n" "\tunsigned\tnref;\n\tunsigned\tbusy;\n\tunsigned\tdiscard;\n" "\n\tunsigned\tnsrc;\n\tconst char\t**srcname;\n\tconst char\t" "**srcbody;\n\n\tvcl_init_f\t*init_vcl;\n\tvcl_fini_f\t*fini_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*miss_func;\n\tvcl_func_f\t*hit_func;\n" "\tvcl_func_f\t*fetch_func;\n\tvcl_func_f\t*deliver_func;\n" "\tvcl_func_f\t*error_func;\n\tvcl_func_f\t*init_func;\n" "\tvcl_func_f\t*fini_func;\n\n};\n" ); /* ../include/vrt.h */ VSB_cat(sb, "/*-\n * Copyright (c) 2006 Verdens Gang AS\n" " * Copyright (c) 2006-2010 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.\n *\n * XXX: When this file is changed, " "lib/libvcl/generate.py *MUST* be rerun.\n */\n\nstruct sess;\n" "struct vsb;\nstruct cli;\nstruct director;\nstruct VCL_conf;\n" "struct sockaddr_storage;\n\n/*\n * A backend probe specification" "\n */\n\nextern const void * const vrt_magic_string_end;\n" "extern const void * const vrt_magic_string_unset;\n" "\nstruct vrt_backend_probe {\n\tconst char\t*url;\n" "\tconst char\t*request;\n\tdouble\t\ttimeout;\n\tdouble\t\t" "interval;\n\tunsigned\texp_status;\n\tunsigned\twindow;\n" "\tunsigned\tthreshold;\n\tunsigned\tinitial;\n};\n" "\n/*\n * A backend is a host+port somewhere on the network\n" " */\nstruct vrt_backend {\n\tconst char\t\t\t*vcl_name;\n" "\tconst char\t\t\t*ipv4_addr;\n\tconst char\t\t\t*ipv6_addr;\n" "\tconst char\t\t\t*port;\n\n\tconst unsigned char\t\t*ipv4_socka" "ddr;\n\tconst unsigned char\t\t*ipv6_sockaddr;\n\n" "\tconst char\t\t\t*hosthdr;\n\n\tdouble\t\t\t\tconnect_timeout;\n" "\tdouble\t\t\t\tfirst_byte_timeout;\n\tdouble\t\t\t\tbetween_byt" "es_timeout;\n\tunsigned\t\t\tmax_connections;\n\tunsigned\t" "\t\tsaintmode_threshold;\n\tconst struct vrt_backend_probe\t" "*probe;\n};\n\n/*\n * A director with an unpredictable reply\n" " */\n\nstruct vrt_dir_random_entry {\n\tint\t\t\t\t\thost;\n" "\tdouble\t\t\t\t\tweight;\n};\n\nstruct vrt_dir_random {\n" "\tconst char\t\t\t\t*name;\n\tunsigned\t\t\t\tretries;\n" "\tunsigned\t\t\t\tnmember;\n\tconst struct vrt_dir_random_entry\t" "*members;\n};\n\n/*\n * A director with round robin selection\n" " */\n\nstruct vrt_dir_round_robin_entry {\n\tint\t\t\t\t\thost;\n" "};\n\nstruct vrt_dir_round_robin {\n\tconst char\t\t\t\t*name;\n" "\tunsigned\t\t\t\tnmember;\n\tconst struct vrt_dir_round_robin_e" "ntry\t*members;\n};\n\n/*\n * A director with dns-based selectio" "n\n */\n\nstruct vrt_dir_dns_entry {\n\tint\t\t\t\t\thost;\n" "};\n\nstruct vrt_dir_dns {\n\tconst char\t\t\t\t*name;\n" "\tconst char\t\t\t\t*suffix;\n\tconst double\t\t\t\tttl;\n" "\tunsigned\t\t\t\tnmember;\n\tconst struct vrt_dir_dns_entry\t" "\t*members;\n};\n\n/*\n * other stuff.\n * XXX: document when " "bored\n */\n\nstruct vrt_ref {\n\tunsigned\tsource;\n" "\tunsigned\toffset;\n\tunsigned\tline;\n\tunsigned\tpos;\n" "\tunsigned\tcount;\n\tconst char\t*token;\n};\n\n" "/* ACL related */\n#define VRT_ACL_MAXADDR\t\t16\t/* max(IPv4, " "IPv6) */\n\nvoid VRT_acl_log(const struct sess *, const char " "*msg);\n\n/* Regexp related */\nvoid VRT_re_init(void **, " "const char *);\nvoid VRT_re_fini(void *);\nint VRT_re_match(cons" "t struct sess *sp, const char *, void *re);\nconst char *VRT_reg" "sub(const struct sess *sp, int all, const char *,\n" " void *, const char *);\n\nvoid VRT_panic(const struct " "sess *sp, const char *, ...);\nvoid VRT_ban(struct sess *sp, " "char *, ...);\nvoid VRT_ban_string(struct sess *sp, const " "char *);\nvoid VRT_purge(const struct sess *sp, double ttl, " "double grace);\n\nvoid VRT_count(const struct sess *, unsigned);" "\nint VRT_rewrite(const char *, const char *);\nvoid VRT_error(s" "truct sess *, unsigned, const char *);\nint VRT_switch_config(co" "nst char *);\n\nenum gethdr_e { HDR_REQ, HDR_RESP, HDR_OBJ, " "HDR_BEREQ, HDR_BERESP };\nchar *VRT_GetHdr(const struct sess " "*, enum gethdr_e where, const char *);\nvoid VRT_SetHdr(const " "struct sess *, enum gethdr_e where, const char *,\n" " const char *, ...);\nvoid VRT_handling(struct sess *sp, " "unsigned hand);\n\nvoid VRT_hashdata(const struct sess *sp, " "const char *str, ...);\n\n/* Simple stuff */\nint VRT_strcmp(con" "st char *s1, const char *s2);\nvoid VRT_memmove(void *dst, " "const void *src, unsigned len);\n\nvoid VRT_ESI(const struct " "sess *sp);\nvoid VRT_Rollback(struct sess *sp);\n" "\n/* Synthetic pages */\nvoid VRT_synth_page(const struct " "sess *sp, unsigned flags, const char *, ...);\n\n" "/* Backend related */\nvoid VRT_init_dir(struct cli *, struct " "director **, const char *name,\n int idx, const void *priv);\n" "void VRT_fini_dir(struct cli *, struct director *);\n" "\n/* VMOD/Modules related */\nint VRT_Vmod_Init(void **hdl, " "void *ptr, int len, const char *nm,\n const char *path, " "struct cli *cli);\nvoid VRT_Vmod_Fini(void **hdl);\n" "\nstruct vmod_priv;\ntypedef void vmod_priv_free_f(void *);\n" "struct vmod_priv {\n\tvoid\t\t\t*priv;\n\tvmod_priv_free_f\t" "*free;\n};\n\ntypedef int vmod_init_f(struct vmod_priv *, " " const struct VCL_conf *);\n\nstatic inline void\n" "vmod_priv_fini(const struct vmod_priv *p)\n{\n\n\tif (p->priv " "!= (void*)0 && p->free != (void*)0)\n\t\tp->free(p->priv);\n" "}\n\n/* Stevedore related functions */\nint VRT_Stv(const " "char *nm);\n\n/* Convert things to string */\n\nchar *VRT_IP_str" "ing(const struct sess *sp, const struct sockaddr_storage *sa);\n" "char *VRT_int_string(const struct sess *sp, int);\n" "char *VRT_double_string(const struct sess *sp, double);\n" "char *VRT_time_string(const struct sess *sp, double);\n" "const char *VRT_bool_string(const struct sess *sp, unsigned);\n" "const char *VRT_backend_string(const struct sess *sp, const " "struct director *d);\n\n#define VRT_done(sp, hand)\t\t\t\\\n" "\tdo {\t\t\t\t\t\\\n\t\tVRT_handling(sp, hand);\t\t\\\n" "\t\treturn (1);\t\t\t\\\n\t} while (0)\n\nconst char *VRT_WrkStr" "ing(const struct sess *sp, const char *p, ...);\n" ); /* ../include/vrt_obj.h */ VSB_cat(sb, "/*\n * NB: This file is machine generated, DO " "NOT EDIT!\n *\n * Edit and run generate.py instead\n" " */\nstruct sockaddr_storage * VRT_r_client_ip(const struct " "sess *);\nconst char * VRT_r_client_identity(struct sess *);\n" "void VRT_l_client_identity(struct sess *, const char *, ...);\n" "struct sockaddr_storage * VRT_r_server_ip(struct sess *);\n" "const char * VRT_r_server_hostname(struct sess *);\n" "const char * VRT_r_server_identity(struct sess *);\n" "int VRT_r_server_port(struct sess *);\nconst char * VRT_r_req_re" "quest(const struct sess *);\nvoid VRT_l_req_request(const " "struct sess *, const char *, ...);\nconst char * VRT_r_req_url(c" "onst struct sess *);\nvoid VRT_l_req_url(const struct sess " "*, const char *, ...);\nconst char * VRT_r_req_proto(const " "struct sess *);\nvoid VRT_l_req_proto(const struct sess *, " "const char *, ...);\nstruct director * VRT_r_req_backend(struct " "sess *);\nvoid VRT_l_req_backend(struct sess *, struct director " "*);\nint VRT_r_req_restarts(const struct sess *);\n" "int VRT_r_req_esi_level(const struct sess *);\ndouble VRT_r_req_" "ttl(struct sess *);\nvoid VRT_l_req_ttl(struct sess *, double);\n" "double VRT_r_req_grace(struct sess *);\nvoid VRT_l_req_grace(str" "uct sess *, double);\ndouble VRT_r_req_keep(struct sess *);\n" "void VRT_l_req_keep(struct sess *, double);\nconst char * " "VRT_r_req_xid(struct sess *);\nunsigned VRT_r_req_esi(struct " "sess *);\nvoid VRT_l_req_esi(struct sess *, unsigned);\n" "unsigned VRT_r_req_can_gzip(struct sess *);\nunsigned VRT_r_req_" "backend_healthy(const struct sess *);\nunsigned VRT_r_req_hash_i" "gnore_busy(struct sess *);\nvoid VRT_l_req_hash_ignore_busy(stru" "ct sess *, unsigned);\nunsigned VRT_r_req_hash_always_miss(struc" "t sess *);\nvoid VRT_l_req_hash_always_miss(struct sess *, " "unsigned);\nconst char * VRT_r_bereq_request(const struct " "sess *);\nvoid VRT_l_bereq_request(const struct sess *, const " "char *, ...);\nconst char * VRT_r_bereq_url(const struct sess " "*);\nvoid VRT_l_bereq_url(const struct sess *, const char " "*, ...);\nconst char * VRT_r_bereq_proto(const struct sess " "*);\nvoid VRT_l_bereq_proto(const struct sess *, const char " "*, ...);\ndouble VRT_r_bereq_connect_timeout(struct sess *);\n" "void VRT_l_bereq_connect_timeout(struct sess *, double);\n" "double VRT_r_bereq_first_byte_timeout(struct sess *);\n" "void VRT_l_bereq_first_byte_timeout(struct sess *, double);\n" "double VRT_r_bereq_between_bytes_timeout(struct sess *);\n" "void VRT_l_bereq_between_bytes_timeout(struct sess *, double);\n" "const char * VRT_r_beresp_proto(const struct sess *);\n" "void VRT_l_beresp_proto(const struct sess *, const char *, " "...);\nvoid VRT_l_beresp_saintmode(const struct sess *, double);" "\nint VRT_r_beresp_status(const struct sess *);\n" "void VRT_l_beresp_status(const struct sess *, int);\n" "const char * VRT_r_beresp_response(const struct sess *);\n" "void VRT_l_beresp_response(const struct sess *, const char " "*, ...);\nunsigned VRT_r_beresp_do_esi(const struct sess *);\n" "void VRT_l_beresp_do_esi(const struct sess *, unsigned);\n" "unsigned VRT_r_beresp_do_stream(const struct sess *);\n" "void VRT_l_beresp_do_stream(const struct sess *, unsigned);\n" "unsigned VRT_r_beresp_do_gzip(const struct sess *);\n" "void VRT_l_beresp_do_gzip(const struct sess *, unsigned);\n" "unsigned VRT_r_beresp_do_gunzip(const struct sess *);\n" "void VRT_l_beresp_do_gunzip(const struct sess *, unsigned);\n" "double VRT_r_beresp_ttl(struct sess *);\nvoid VRT_l_beresp_ttl(s" "truct sess *, double);\ndouble VRT_r_beresp_grace(struct sess " "*);\nvoid VRT_l_beresp_grace(struct sess *, double);\n" "double VRT_r_beresp_keep(struct sess *);\nvoid VRT_l_beresp_keep" "(struct sess *, double);\nconst char * VRT_r_beresp_backend_name" "(const struct sess *);\nstruct sockaddr_storage * VRT_r_beresp_b" "ackend_ip(const struct sess *);\nint VRT_r_beresp_backend_port(c" "onst struct sess *);\nconst char * VRT_r_beresp_storage(struct " "sess *);\nvoid VRT_l_beresp_storage(struct sess *, const char " "*, ...);\nconst char * VRT_r_obj_proto(const struct sess *);\n" "void VRT_l_obj_proto(const struct sess *, const char *, ...);\n" "int VRT_r_obj_status(const struct sess *);\nvoid VRT_l_obj_statu" "s(const struct sess *, int);\nconst char * VRT_r_obj_response(co" "nst struct sess *);\nvoid VRT_l_obj_response(const struct " "sess *, const char *, ...);\nint VRT_r_obj_hits(const struct " "sess *);\ndouble VRT_r_obj_ttl(struct sess *);\nvoid VRT_l_obj_t" "tl(struct sess *, double);\ndouble VRT_r_obj_grace(struct " "sess *);\nvoid VRT_l_obj_grace(struct sess *, double);\n" "double VRT_r_obj_keep(struct sess *);\nvoid VRT_l_obj_keep(struc" "t sess *, double);\ndouble VRT_r_obj_lastuse(const struct " "sess *);\nconst char * VRT_r_resp_proto(const struct sess " "*);\nvoid VRT_l_resp_proto(const struct sess *, const char " "*, ...);\nint VRT_r_resp_status(const struct sess *);\n" "void VRT_l_resp_status(const struct sess *, int);\n" "const char * VRT_r_resp_response(const struct sess *);\n" "void VRT_l_resp_response(const struct sess *, const char *, " "...);\ndouble VRT_r_now(const struct sess *);\ndouble VRT_Stv_fr" "ee_space(const char *);\ndouble VRT_Stv_used_space(const char " "*);\nunsigned VRT_Stv_happy(const char *);\n" ); } varnish-3.0.5/lib/libvcl/vcc_acl.c0000644000175000017500000002706212247035455013707 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 "vsb.h" #include "vrt.h" #include "vcc_priv.h" #include "vcc_compile.h" #include "libvarnish.h" struct acl_e { VTAILQ_ENTRY(acl_e) list; unsigned char data[VRT_ACL_MAXADDR + 1]; unsigned mask; unsigned not; unsigned para; 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", 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", 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->t_addr->dec, "0", &hint, &res0); if (error) { if (ae->para) { VSB_printf(tl->sb, "Warning: %s ignored\n -- %s\n", ae->t_addr->dec, 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->t_addr->dec, 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 appearantly * 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->t_addr->dec; 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; 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; vcc_NextToken(tl); 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 */ /* * XXX: this is semi-silly. We try really hard to not depend in the * XXX: systems include files while compiling VCL, but we need to know * XXX: the size of the sa_familiy member. * XXX: FlexeLint complains about these antics, so isolate it in a * XXX: separate function. */ /*lint -save -e506 -e774 -e550 */ static void c_is_a_silly_language(const struct vcc *tl) { struct sockaddr sa; assert(sizeof (unsigned char) == 1); assert(sizeof (unsigned short) == 2); assert(sizeof (unsigned int) == 4); if (sizeof sa.sa_family == 1) Fh(tl, 0, "\tunsigned char fam;\n"); else if (sizeof sa.sa_family == 2) Fh(tl, 0, "\tunsigned short fam;\n"); else if (sizeof sa.sa_family == 4) Fh(tl, 0, "\tunsigned int fam;\n"); else assert(0 == __LINE__); } /*lint -restore */ static void vcc_acl_emit(const struct vcc *tl, const char *acln, int anon) { struct acl_e *ae; int depth, l, m, i; unsigned at[VRT_ACL_MAXADDR + 1]; const char *oc; Fh(tl, 0, "\nstatic int\n"); Fh(tl, 0, "match_acl_%s_%s(const struct sess *sp, const void *p)\n", anon ? "anon" : "named", acln); Fh(tl, 0, "{\n"); Fh(tl, 0, "\tconst unsigned char *a;\n"); c_is_a_silly_language(tl); Fh(tl, 0, "\n"); Fh(tl, 0, "\ta = p;\n"); Fh(tl, 0, "\tVRT_memmove(&fam, a + %d, sizeof fam);\n", offsetof(struct sockaddr, sa_family)); Fh(tl, 0, "\tif (fam == %d)\n", PF_INET); Fh(tl, 0, "\t\ta += %d;\n", offsetof(struct sockaddr_in, sin_addr)); Fh(tl, 0, "\telse if (fam == %d)\n", PF_INET6); Fh(tl, 0, "\t\ta += %d;\n", offsetof(struct sockaddr_in6, sin6_addr)); Fh(tl, 0, "\telse {\n"); Fh(tl, 0, "\t\tVRT_acl_log(sp, \"NO_FAM %s\");\n", acln); Fh(tl, 0, "\t\treturn(0);\n"); Fh(tl, 0, "\t}\n\n"); depth = -1; oc = 0; 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 */ oc = ""; 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, "", oc, ae->data[i]); else Fh(tl, 0, "\t%*s%sif (a[%d] == %d) {\n", -i, "", oc, i - 1, ae->data[i]); at[i] = ae->data[i]; depth = i; oc = ""; } if (m > 0) { /* Do fractional byte compares */ Fh(tl, 0, "\t%*s%sif ((a[%d] & 0x%x) == %d) {\n", -i, "", oc, i - 1, (0xff00 >> m) & 0xff, ae->data[i] & ((0xff00 >> m) & 0xff)); at[i] = 256; depth = i; oc = ""; } i = (ae->mask + 7) / 8; if (!anon) { Fh(tl, 0, "\t%*sVRT_acl_log(sp, \"%sMATCH %s \" ", -i, "", ae->not ? "NEG_" : "", acln, PF(ae->t_addr)); EncToken(tl->fh, ae->t_addr); if (ae->t_mask != NULL) Fh(tl, 0, " \"/%.*s\" ", PF(ae->t_mask)); 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(sp, \"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(sp, \v1)", (tcond == T_NEQ ? "!" : ""), acln); } void vcc_Acl(struct vcc *tl) { struct token *an; int i; char acln[1024]; vcc_NextToken(tl); VTAILQ_INIT(&tl->acl); ExpectErr(tl, ID); 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-3.0.5/lib/libvcl/vcc_parse.c0000644000175000017500000001571212247035455014261 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 "vsb.h" #include "vcc_priv.h" #include "vcc_compile.h" #include "libvarnish.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(sp, %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, T_IF); Fb(tl, 1, "if "); vcc_Conditional(tl); ERRCHK(tl); L(tl, vcc_Compound(tl)); ERRCHK(tl); while (1) { switch (tl->t->tok) { case T_ELSE: vcc_NextToken(tl); if (tl->t->tok != T_IF) { Fb(tl, 1, "else\n"); L(tl, vcc_Compound(tl)); ERRCHK(tl); return; } /* FALLTHROUGH */ case T_ELSEIF: case T_ELSIF: Fb(tl, 1, "else if "); vcc_NextToken(tl); vcc_Conditional(tl); ERRCHK(tl); L(tl, vcc_Compound(tl)); ERRCHK(tl); break; default: C(tl, ";"); return; } } } /*-------------------------------------------------------------------- * 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 T_IF: vcc_IfStmt(tl); break; case '}': vcc_NextToken(tl); tl->indent -= INDENT; Fb(tl, 1, "}\n"); return; case CSRC: Fb(tl, 1, "%.*s\n", tl->t->e - (tl->t->b + 2), tl->t->b + 1); vcc_NextToken(tl); break; case EOI: VSB_printf(tl->sb, "End of input while in compound statement\n"); tl->err = 1; return; case ID: 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_Function(struct vcc *tl) { int m, i; vcc_NextToken(tl); ExpectErr(tl, ID); m = IsMethod(tl->t); 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 " "(struct sess *sp);\n", PF(tl->t)); Fc(tl, 1, "int VGC_function_%.*s(struct sess *sp);\n", PF(tl->t)); Fc(tl, 1, "\nint\n"); Fc(tl, 1, "VGC_function_%.*s (struct sess *sp)\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; } /*-------------------------------------------------------------------- * Top level of parser, recognize: * Inline C-code * ACL definitions * Function definitions * Backend & Director definitions * End of input */ typedef void parse_f(struct vcc *tl); static struct toplev { const char *name; parse_f *func; } toplev[] = { { "acl", vcc_Acl }, { "sub", vcc_Function }, { "backend", vcc_ParseDirector }, { "director", vcc_ParseDirector }, { "probe", vcc_ParseProbe }, { "import", vcc_ParseImport }, { NULL, NULL } }; void vcc_Parse(struct vcc *tl) { struct toplev *tp; while (tl->t->tok != EOI) { ERRCHK(tl); switch (tl->t->tok) { case CSRC: Fc(tl, 0, "%.*s\n", tl->t->e - (tl->t->b + 4), tl->t->b + 2); vcc_NextToken(tl); 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-3.0.5/lib/libvcl/vcc_symb.c0000644000175000017500000000745712247035455014130 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 "vsb.h" #include "vcc_priv.h" #include "vcc_compile.h" #include "libvarnish.h" /*--------------------------------------------------------------------*/ const char * VCC_SymKind(struct vcc *tl, const struct symbol *s) { switch(s->kind) { #define VCC_SYMB(uu, ll, dd) case SYM_##uu: return(dd); #include "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 + 1); 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-3.0.5/lib/libvcl/vcc_var.c0000644000175000017500000000676212247035455013744 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 "vsb.h" #include "vcc_priv.h" #include "vcc_compile.h" #include "libvarnish.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; int l; char buf[258]; vh = wc->var; 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 = STRING; v->http = vh->http; l = strlen(v->name + vh->len) + 1; bprintf(buf, "\\%03o%s:", (unsigned)l, v->name + vh->len); v->hdr = TlDup(tl, buf); bprintf(buf, "VRT_GetHdr(sp, %s, \"%s\")", v->http, v->hdr); v->rname = TlDup(tl, buf); bprintf(buf, "VRT_SetHdr(sp, %s, \"%s\", ", v->http, v->hdr); v->lname = TlDup(tl, buf); 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); } assert(v->fmt != HEADER); return (v); } VSB_printf(tl->sb, "Unknown variable "); vcc_ErrToken(tl, t); VSB_cat(tl->sb, "\nAt: "); vcc_ErrWhere(tl, t); return (NULL); } varnish-3.0.5/lib/libvcl/vcc_vmod.c0000644000175000017500000001247512247035455014117 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 "vsb.h" #include "vcc_priv.h" #include "vcc_compile.h" #include "libvarnish.h" #include "vmod_abi.h" void vcc_ParseImport(struct vcc *tl) { void *hdl; char fn[1024]; struct token *mod, *t1; const char *modname; const char *proto; const char *abi; const char **spec; struct symbol *sym; const struct symbol *osym; const char *p; // int *modlen; 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 conflics 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...' at "); vcc_ErrToken(tl, tl->t); vcc_ErrWhere(tl, tl->t); return; } vcc_NextToken(tl); ExpectErr(tl, CSTR); bprintf(fn, "%s", tl->t->dec); vcc_NextToken(tl); } else { bprintf(fn, "%s/libvmod_%.*s.so", tl->vmod_dir, PF(mod)); } Fh(tl, 0, "static void *VGC_vmod_%.*s;\n", PF(mod)); Fi(tl, 0, "\tif (VRT_Vmod_Init(&VGC_vmod_%.*s,\n", PF(mod)); Fi(tl, 0, "\t &Vmod_Func_%.*s,\n", PF(mod)); Fi(tl, 0, "\t sizeof(Vmod_Func_%.*s),\n", PF(mod)); Fi(tl, 0, "\t \"%.*s\",\n", PF(mod)); Fi(tl, 0, "\t "); EncString(tl->fi, fn, NULL, 0); Fi(tl, 0, ",\n\t "); Fi(tl, 0, "cli))\n"); Fi(tl, 0, "\t\treturn(1);\n"); SkipToken(tl, ';'); hdl = dlopen(fn, RTLD_NOW | RTLD_LOCAL); if (hdl == NULL) { VSB_printf(tl->sb, "Could not load module %.*s\n\t%s\n\t%s\n", PF(mod), fn, dlerror()); vcc_ErrWhere(tl, mod); return; } modname = dlsym(hdl, "Vmod_Name"); if (modname == NULL) { VSB_printf(tl->sb, "Could not load module %.*s\n\t%s\n\t%s\n", PF(mod), fn, "Symbol Vmod_Name not found"); vcc_ErrWhere(tl, mod); return; } if (!vcc_IdIs(mod, modname)) { VSB_printf(tl->sb, "Could not load module %.*s\n\t%s\n", PF(mod), fn); VSB_printf(tl->sb, "\tModule has wrong name: <%s>\n", modname); vcc_ErrWhere(tl, mod); return; } abi = dlsym(hdl, "Vmod_Varnish_ABI"); if (abi == NULL || strcmp(abi, VMOD_ABI_Version) != 0) { VSB_printf(tl->sb, "Could not load module %.*s\n\t%s\n", PF(mod), fn); VSB_printf(tl->sb, "\tABI mismatch, expected <%s>, got <%s>\n", VMOD_ABI_Version, abi); vcc_ErrWhere(tl, mod); return; } proto = dlsym(hdl, "Vmod_Proto"); if (proto == NULL) { VSB_printf(tl->sb, "Could not load module %.*s\n\t%s\n\t%s\n", PF(mod), fn, "Symbol Vmod_Proto not found"); vcc_ErrWhere(tl, mod); return; } spec = dlsym(hdl, "Vmod_Spec"); if (spec == NULL) { VSB_printf(tl->sb, "Could not load module %.*s\n\t%s\n\t%s\n", PF(mod), fn, "Symbol Vmod_Spec not found"); vcc_ErrWhere(tl, mod); return; } Fh(tl, 0, "static struct vmod_priv vmod_priv_%.*s;\n", PF(mod)); for (; *spec != NULL; spec++) { p = *spec; if (!strcmp(p, "INIT")) { p += strlen(p) + 1; Fi(tl, 0, "\t%s(&vmod_priv_%.*s, &VCL_conf);\n", p, PF(mod)); } else { sym = VCC_AddSymbolStr(tl, p, SYM_FUNC); ERRCHK(tl); AN(sym); sym->eval = vcc_Eval_Func; 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%s\n", proto); /* XXX: zero the function pointer structure ?*/ Ff(tl, 0, "\tvmod_priv_fini(&vmod_priv_%.*s);\n", PF(mod)); Ff(tl, 0, "\tVRT_Vmod_Fini(&VGC_vmod_%.*s);\n", PF(mod)); } varnish-3.0.5/lib/libvcl/vcc_token_defs.h0000644000175000017500000000105412247037175015270 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_ELSE 138 #define T_ELSEIF 139 #define T_ELSIF 140 #define T_EQ 141 #define T_GEQ 142 #define T_IF 143 #define T_INC 144 #define T_INCLUDE 145 #define T_INCR 146 #define T_LEQ 147 #define T_MUL 148 #define T_NEQ 149 #define T_NOMATCH 150 #define T_SHL 151 #define T_SHR 152 varnish-3.0.5/lib/libvcl/vcc_backend_util.c0000644000175000017500000000705612247035455015575 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 "vsb.h" #include "vcc_priv.h" #include "vcc_compile.h" #include "libvarnish.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; }; 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); return; } 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-3.0.5/lib/libvcl/vcc_token.c0000644000175000017500000002670112247035455014267 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 "vqueue.h" #include "vsb.h" #include "libvarnish.h" #include "vcc_priv.h" #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 %d Pos %d)", 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_bcat(tl->sb, " ", 1); x++; } } else { x++; y++; VSB_bcat(tl->sb, p, 1); } } 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, int 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 token to token */ int vcc_Teq(const struct token *t1, const struct token *t2) { if (t1->e - t1->b != t2->e - t2->b) return (0); return (!memcmp(t1->b, t2->b, t1->e - t1->b)); } /*-------------------------------------------------------------------- * 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 */ static 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-3.0.5/lib/libjemalloc/0000755000175000017500000000000012247037207013221 500000000000000varnish-3.0.5/lib/libjemalloc/Makefile.am0000644000175000017500000000072012247035455015177 00000000000000# See source code comments to avoid memory leaks when enabling MALLOC_MAG. #CPPFLAGS = -DMALLOC_PRODUCTION -DMALLOC_MAG AM_CPPFLAGS = -DMALLOC_PRODUCTION #all: libjemalloc.so.0 libjemalloc_mt.so.0 noinst_LTLIBRARIES = libjemalloc_mt.la libjemalloc_mt_la_LIBADD = ${PTHREAD_LIBS} libjemalloc_mt_la_LDFLAGS = -static libjemalloc_mt_la_CFLAGS = -D__isthreaded=true libjemalloc_mt_la_SOURCES = jemalloc_linux.c \ rb.h EXTRA_DIST = malloc.3 \ malloc.c \ README varnish-3.0.5/lib/libjemalloc/README0000644000175000017500000000401712247035455014026 00000000000000This is a minimal-effort stand-alone jemalloc distribution for Linux. The main rough spots are: * __isthreaded must be hard-coded, since the pthreads library really needs to be involved in order to toggle it at run time. Therefore, this distribution builds two separate libraries: + libjemalloc_mt.so.0 : Use for multi-threaded applications. + libjemalloc.so.0 : Use for single-threaded applications. Both libraries link against libpthread, though with a bit more code hacking, this dependency could be removed for the single-threaded version. * MALLOC_MAG (thread-specific caching, using magazines) is disabled, because special effort is required to avoid memory leaks when it is enabled. To make cleanup automatic, we would need help from the pthreads library. If you enable MALLOC_MAG, be sure to call _malloc_thread_cleanup() in each thread just before it exits. * The code that determines the number of CPUs is sketchy. The trouble is that we must avoid any memory allocation during early initialization. In order to build: make This generates two shared libraries, which you can either link against, or pre-load. Linking and running, where /path/to is the path to libjemalloc (-lpthread required even for libjemalloc.so): gcc app.o -o app -L/path/to -ljemalloc_mt -lpthread LD_LIBRARY_PATH=/path/to app Pre-loading: LD_PRELOAD=/path/to/libjemalloc_mt.so.0 app jemalloc has a lot of run-time tuning options. See the man page for details: nroff -man malloc.3 | less In particular, take a look at the B, F, and N options. If you enable MALLOC_MAG, look at the G and R options. If your application is crashing, or performance seems to be lacking, enable assertions and statistics gathering by removing MALLOC_PRODUCTION from CPPFLAGS in the Makefile. In order to print a statistics summary at program exit, run your application like: LD_PRELOAD=/path/to/libjemalloc_mt.so.0 MALLOC_OPTIONS=P app Please contact Jason Evans with questions, comments, bug reports, etc. varnish-3.0.5/lib/libjemalloc/Makefile.in0000644000175000017500000004733312247037162015220 00000000000000# Makefile.in generated by automake 1.14 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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/libjemalloc DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/depcomp README ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.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) am__DEPENDENCIES_1 = libjemalloc_mt_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_libjemalloc_mt_la_OBJECTS = libjemalloc_mt_la-jemalloc_linux.lo libjemalloc_mt_la_OBJECTS = $(am_libjemalloc_mt_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libjemalloc_mt_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(libjemalloc_mt_la_CFLAGS) $(CFLAGS) \ $(libjemalloc_mt_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : 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_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/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_CC_1 = 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_CCLD_1 = SOURCES = $(libjemalloc_mt_la_SOURCES) DIST_SOURCES = $(libjemalloc_mt_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIBS = @CURSES_LIBS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ 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@ JEMALLOC_SUBDIR = @JEMALLOC_SUBDIR@ 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@ 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@ XSLTPROC = @XSLTPROC@ 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@ # See source code comments to avoid memory leaks when enabling MALLOC_MAG. #CPPFLAGS = -DMALLOC_PRODUCTION -DMALLOC_MAG AM_CPPFLAGS = -DMALLOC_PRODUCTION #all: libjemalloc.so.0 libjemalloc_mt.so.0 noinst_LTLIBRARIES = libjemalloc_mt.la libjemalloc_mt_la_LIBADD = ${PTHREAD_LIBS} libjemalloc_mt_la_LDFLAGS = -static libjemalloc_mt_la_CFLAGS = -D__isthreaded=true libjemalloc_mt_la_SOURCES = jemalloc_linux.c \ rb.h EXTRA_DIST = malloc.3 \ malloc.c \ README all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(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/libjemalloc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign lib/libjemalloc/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: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(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)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libjemalloc_mt.la: $(libjemalloc_mt_la_OBJECTS) $(libjemalloc_mt_la_DEPENDENCIES) $(EXTRA_libjemalloc_mt_la_DEPENDENCIES) $(AM_V_CCLD)$(libjemalloc_mt_la_LINK) $(libjemalloc_mt_la_OBJECTS) $(libjemalloc_mt_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjemalloc_mt_la-jemalloc_linux.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 -o $@ $< .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 -o $@ `$(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 $@ $< libjemalloc_mt_la-jemalloc_linux.lo: jemalloc_linux.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) $(libjemalloc_mt_la_CFLAGS) $(CFLAGS) -MT libjemalloc_mt_la-jemalloc_linux.lo -MD -MP -MF $(DEPDIR)/libjemalloc_mt_la-jemalloc_linux.Tpo -c -o libjemalloc_mt_la-jemalloc_linux.lo `test -f 'jemalloc_linux.c' || echo '$(srcdir)/'`jemalloc_linux.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libjemalloc_mt_la-jemalloc_linux.Tpo $(DEPDIR)/libjemalloc_mt_la-jemalloc_linux.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='jemalloc_linux.c' object='libjemalloc_mt_la-jemalloc_linux.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) $(libjemalloc_mt_la_CFLAGS) $(CFLAGS) -c -o libjemalloc_mt_la-jemalloc_linux.lo `test -f 'jemalloc_linux.c' || echo '$(srcdir)/'`jemalloc_linux.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ 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-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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: 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 TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ ctags-am 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 tags-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-3.0.5/lib/libjemalloc/malloc.c0000644000175000017500000042503112247035455014564 00000000000000/*- * Copyright (C) 2006-2008 Jason Evans . * 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(s), this list of conditions and the following disclaimer as * the first lines of this file unmodified other than the possible * addition of one or more copyright notices. * 2. Redistributions in binary form must reproduce the above copyright * notice(s), this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY * EXPRESS OR 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 COPYRIGHT HOLDER(S) BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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 allocator implementation is designed to provide scalable performance * for multi-threaded programs on multi-processor systems. The following * features are included for this purpose: * * + Multiple arenas are used if there are multiple CPUs, which reduces lock * contention and cache sloshing. * * + Thread-specific caching is used if there are multiple threads, which * reduces the amount of locking. * * + Cache line sharing between arenas is avoided for internal data * structures. * * + Memory is managed in chunks and runs (chunks can be split into runs), * rather than as individual pages. This provides a constant-time * mechanism for associating allocations with particular arenas. * * Allocation requests are rounded up to the nearest size class, and no record * of the original request size is maintained. Allocations are broken into * categories according to size class. Assuming runtime defaults, 4 kB pages * and a 16 byte quantum on a 32-bit system, the size classes in each category * are as follows: * * |=======================================| * | Category | Subcategory | Size | * |=======================================| * | Small | Tiny | 2 | * | | | 4 | * | | | 8 | * | |------------------+---------| * | | Quantum-spaced | 16 | * | | | 32 | * | | | 48 | * | | | ... | * | | | 96 | * | | | 112 | * | | | 128 | * | |------------------+---------| * | | Cacheline-spaced | 192 | * | | | 256 | * | | | 320 | * | | | 384 | * | | | 448 | * | | | 512 | * | |------------------+---------| * | | Sub-page | 760 | * | | | 1024 | * | | | 1280 | * | | | ... | * | | | 3328 | * | | | 3584 | * | | | 3840 | * |=======================================| * | Large | 4 kB | * | | 8 kB | * | | 12 kB | * | | ... | * | | 1012 kB | * | | 1016 kB | * | | 1020 kB | * |=======================================| * | Huge | 1 MB | * | | 2 MB | * | | 3 MB | * | | ... | * |=======================================| * * A different mechanism is used for each category: * * Small : Each size class is segregated into its own set of runs. Each run * maintains a bitmap of which regions are free/allocated. * * Large : Each allocation is backed by a dedicated run. Metadata are stored * in the associated arena chunk header maps. * * Huge : Each allocation is backed by a dedicated contiguous set of chunks. * Metadata are stored in a separate red-black tree. * ******************************************************************************* */ /* * MALLOC_PRODUCTION disables assertions and statistics gathering. It also * defaults the A and J runtime options to off. These settings are appropriate * for production systems. */ /* #define MALLOC_PRODUCTION */ #ifndef MALLOC_PRODUCTION /* * MALLOC_DEBUG enables assertions and other sanity checks, and disables * inline functions. */ # define MALLOC_DEBUG /* MALLOC_STATS enables statistics calculation. */ # define MALLOC_STATS #endif /* * MALLOC_TINY enables support for tiny objects, which are smaller than one * quantum. */ #define MALLOC_TINY /* * MALLOC_MAG enables a magazine-based thread-specific caching layer for small * objects. This makes it possible to allocate/deallocate objects without any * locking when the cache is in the steady state. */ #define MALLOC_MAG /* * MALLOC_BALANCE enables monitoring of arena lock contention and dynamically * re-balances arena load if exponentially averaged contention exceeds a * certain threshold. */ #define MALLOC_BALANCE /* * MALLOC_DSS enables use of sbrk(2) to allocate chunks from the data storage * segment (DSS). In an ideal world, this functionality would be completely * unnecessary, but we are burdened by history and the lack of resource limits * for anonymous mapped memory. */ #define MALLOC_DSS #include __FBSDID("$FreeBSD: head/lib/libc/stdlib/malloc.c 182225 2008-08-27 02:00:53Z jasone $"); #include "libc_private.h" #ifdef MALLOC_DEBUG # define _LOCK_DEBUG #endif #include "spinlock.h" #include "namespace.h" #include #include #include #include #include #include #include #include /* Must come after several other sys/ includes. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "un-namespace.h" #ifdef MALLOC_DEBUG # ifdef NDEBUG # undef NDEBUG # endif #else # ifndef NDEBUG # define NDEBUG # endif #endif #include #include "rb.h" #ifdef MALLOC_DEBUG /* Disable inlining to make debugging easier. */ # define inline #endif /* Size of stack-allocated buffer passed to strerror_r(). */ #define STRERROR_BUF 64 /* * The const_size2bin table is sized according to PAGESIZE_2POW, but for * correctness reasons, we never assume that * (pagesize == (1U << * PAGESIZE_2POW)). * * Minimum alignment of allocations is 2^QUANTUM_2POW bytes. */ #ifdef __i386__ # define PAGESIZE_2POW 12 # define QUANTUM_2POW 4 # define SIZEOF_PTR_2POW 2 # define CPU_SPINWAIT __asm__ volatile("pause") #endif #ifdef __ia64__ # define PAGESIZE_2POW 12 # define QUANTUM_2POW 4 # define SIZEOF_PTR_2POW 3 #endif #ifdef __alpha__ # define PAGESIZE_2POW 13 # define QUANTUM_2POW 4 # define SIZEOF_PTR_2POW 3 # define NO_TLS #endif #ifdef __sparc64__ # define PAGESIZE_2POW 13 # define QUANTUM_2POW 4 # define SIZEOF_PTR_2POW 3 # define NO_TLS #endif #ifdef __amd64__ # define PAGESIZE_2POW 12 # define QUANTUM_2POW 4 # define SIZEOF_PTR_2POW 3 # define CPU_SPINWAIT __asm__ volatile("pause") #endif #ifdef __arm__ # define PAGESIZE_2POW 12 # define QUANTUM_2POW 3 # define SIZEOF_PTR_2POW 2 # define NO_TLS #endif #ifdef __mips__ # define PAGESIZE_2POW 12 # define QUANTUM_2POW 3 # define SIZEOF_PTR_2POW 2 # define NO_TLS #endif #ifdef __powerpc__ # define PAGESIZE_2POW 12 # define QUANTUM_2POW 4 # define SIZEOF_PTR_2POW 2 #endif #ifdef __sh__ # define PAGESIZE_2POW 12 # define QUANTUM_2POW 3 # define SIZEOF_PTR_2POW 2 # define NO_TLS #endif #define QUANTUM ((size_t)(1U << QUANTUM_2POW)) #define QUANTUM_MASK (QUANTUM - 1) #define SIZEOF_PTR (1U << SIZEOF_PTR_2POW) /* sizeof(int) == (1U << SIZEOF_INT_2POW). */ #ifndef SIZEOF_INT_2POW # define SIZEOF_INT_2POW 2 #endif /* We can't use TLS in non-PIC programs, since TLS relies on loader magic. */ #if (!defined(PIC) && !defined(NO_TLS)) # define NO_TLS #endif #ifdef NO_TLS /* MALLOC_MAG requires TLS. */ # ifdef MALLOC_MAG # undef MALLOC_MAG # endif /* MALLOC_BALANCE requires TLS. */ # ifdef MALLOC_BALANCE # undef MALLOC_BALANCE # endif #endif /* * Size and alignment of memory chunks that are allocated by the OS's virtual * memory system. */ #define CHUNK_2POW_DEFAULT 20 /* Maximum number of dirty pages per arena. */ #define DIRTY_MAX_DEFAULT (1U << 9) /* * Maximum size of L1 cache line. This is used to avoid cache line aliasing. * In addition, this controls the spacing of cacheline-spaced size classes. */ #define CACHELINE_2POW 6 #define CACHELINE ((size_t)(1U << CACHELINE_2POW)) #define CACHELINE_MASK (CACHELINE - 1) /* * Subpages are an artificially designated partitioning of pages. Their only * purpose is to support subpage-spaced size classes. * * There must be at least 4 subpages per page, due to the way size classes are * handled. */ #define SUBPAGE_2POW 8 #define SUBPAGE ((size_t)(1U << SUBPAGE_2POW)) #define SUBPAGE_MASK (SUBPAGE - 1) #ifdef MALLOC_TINY /* Smallest size class to support. */ # define TINY_MIN_2POW 1 #endif /* * Maximum size class that is a multiple of the quantum, but not (necessarily) * a power of 2. Above this size, allocations are rounded up to the nearest * power of 2. */ #define QSPACE_MAX_2POW_DEFAULT 7 /* * Maximum size class that is a multiple of the cacheline, but not (necessarily) * a power of 2. Above this size, allocations are rounded up to the nearest * power of 2. */ #define CSPACE_MAX_2POW_DEFAULT 9 /* * RUN_MAX_OVRHD indicates maximum desired run header overhead. Runs are sized * as small as possible such that this setting is still honored, without * violating other constraints. The goal is to make runs as small as possible * without exceeding a per run external fragmentation threshold. * * We use binary fixed point math for overhead computations, where the binary * point is implicitly RUN_BFP bits to the left. * * Note that it is possible to set RUN_MAX_OVRHD low enough that it cannot be * honored for some/all object sizes, since there is one bit of header overhead * per object (plus a constant). This constraint is relaxed (ignored) for runs * that are so small that the per-region overhead is greater than: * * (RUN_MAX_OVRHD / (reg_size << (3+RUN_BFP)) */ #define RUN_BFP 12 /* \/ Implicit binary fixed point. */ #define RUN_MAX_OVRHD 0x0000003dU #define RUN_MAX_OVRHD_RELAX 0x00001800U /* Put a cap on small object run size. This overrides RUN_MAX_OVRHD. */ #define RUN_MAX_SMALL (12 * pagesize) /* * Hyper-threaded CPUs may need a special instruction inside spin loops in * order to yield to another virtual CPU. If no such instruction is defined * above, make CPU_SPINWAIT a no-op. */ #ifndef CPU_SPINWAIT # define CPU_SPINWAIT #endif /* * Adaptive spinning must eventually switch to blocking, in order to avoid the * potential for priority inversion deadlock. Backing off past a certain point * can actually waste time. */ #define SPIN_LIMIT_2POW 11 /* * Conversion from spinning to blocking is expensive; we use (1U << * BLOCK_COST_2POW) to estimate how many more times costly blocking is than * worst-case spinning. */ #define BLOCK_COST_2POW 4 #ifdef MALLOC_MAG /* * Default magazine size, in bytes. max_rounds is calculated to make * optimal use of the space, leaving just enough room for the magazine * header. */ # define MAG_SIZE_2POW_DEFAULT 9 #endif #ifdef MALLOC_BALANCE /* * We use an exponential moving average to track recent lock contention, * where the size of the history window is N, and alpha=2/(N+1). * * Due to integer math rounding, very small values here can cause * substantial degradation in accuracy, thus making the moving average decay * faster than it would with precise calculation. */ # define BALANCE_ALPHA_INV_2POW 9 /* * Threshold value for the exponential moving contention average at which to * re-assign a thread. */ # define BALANCE_THRESHOLD_DEFAULT (1U << (SPIN_LIMIT_2POW-4)) #endif /******************************************************************************/ /* * Mutexes based on spinlocks. We can't use normal pthread spinlocks in all * places, because they require malloc()ed memory, which causes bootstrapping * issues in some cases. */ typedef struct { spinlock_t lock; } malloc_mutex_t; /* Set to true once the allocator has been initialized. */ static bool malloc_initialized = false; /* Used to avoid initialization races. */ static malloc_mutex_t init_lock = {_SPINLOCK_INITIALIZER}; /******************************************************************************/ /* * Statistics data structures. */ #ifdef MALLOC_STATS typedef struct malloc_bin_stats_s malloc_bin_stats_t; struct malloc_bin_stats_s { /* * Number of allocation requests that corresponded to the size of this * bin. */ uint64_t nrequests; #ifdef MALLOC_MAG /* Number of magazine reloads from this bin. */ uint64_t nmags; #endif /* Total number of runs created for this bin's size class. */ uint64_t nruns; /* * Total number of runs reused by extracting them from the runs tree for * this bin's size class. */ uint64_t reruns; /* High-water mark for this bin. */ unsigned long highruns; /* Current number of runs in this bin. */ unsigned long curruns; }; typedef struct arena_stats_s arena_stats_t; struct arena_stats_s { /* Number of bytes currently mapped. */ size_t mapped; /* * Total number of purge sweeps, total number of madvise calls made, * and total pages purged in order to keep dirty unused memory under * control. */ uint64_t npurge; uint64_t nmadvise; uint64_t purged; /* Per-size-category statistics. */ size_t allocated_small; uint64_t nmalloc_small; uint64_t ndalloc_small; size_t allocated_large; uint64_t nmalloc_large; uint64_t ndalloc_large; #ifdef MALLOC_BALANCE /* Number of times this arena reassigned a thread due to contention. */ uint64_t nbalance; #endif }; typedef struct chunk_stats_s chunk_stats_t; struct chunk_stats_s { /* Number of chunks that were allocated. */ uint64_t nchunks; /* High-water mark for number of chunks allocated. */ unsigned long highchunks; /* * Current number of chunks allocated. This value isn't maintained for * any other purpose, so keep track of it in order to be able to set * highchunks. */ unsigned long curchunks; }; #endif /* #ifdef MALLOC_STATS */ /******************************************************************************/ /* * Extent data structures. */ /* Tree of extents. */ typedef struct extent_node_s extent_node_t; struct extent_node_s { #ifdef MALLOC_DSS /* Linkage for the size/address-ordered tree. */ rb_node(extent_node_t) link_szad; #endif /* Linkage for the address-ordered tree. */ rb_node(extent_node_t) link_ad; /* Pointer to the extent that this tree node is responsible for. */ void *addr; /* Total region size. */ size_t size; }; typedef rb_tree(extent_node_t) extent_tree_t; /******************************************************************************/ /* * Arena data structures. */ typedef struct arena_s arena_t; typedef struct arena_bin_s arena_bin_t; /* Each element of the chunk map corresponds to one page within the chunk. */ typedef struct arena_chunk_map_s arena_chunk_map_t; struct arena_chunk_map_s { /* * Linkage for run trees. There are two disjoint uses: * * 1) arena_t's runs_avail tree. * 2) arena_run_t conceptually uses this linkage for in-use non-full * runs, rather than directly embedding linkage. */ rb_node(arena_chunk_map_t) link; /* * Run address (or size) and various flags are stored together. The bit * layout looks like (assuming 32-bit system): * * ???????? ???????? ????---- ---kdzla * * ? : Unallocated: Run address for first/last pages, unset for internal * pages. * Small: Run address. * Large: Run size for first page, unset for trailing pages. * - : Unused. * k : key? * d : dirty? * z : zeroed? * l : large? * a : allocated? * * Following are example bit patterns for the three types of runs. * * r : run address * s : run size * x : don't care * - : 0 * [dzla] : bit set * * Unallocated: * ssssssss ssssssss ssss---- -------- * xxxxxxxx xxxxxxxx xxxx---- ----d--- * ssssssss ssssssss ssss---- -----z-- * * Small: * rrrrrrrr rrrrrrrr rrrr---- -------a * rrrrrrrr rrrrrrrr rrrr---- -------a * rrrrrrrr rrrrrrrr rrrr---- -------a * * Large: * ssssssss ssssssss ssss---- ------la * -------- -------- -------- ------la * -------- -------- -------- ------la */ size_t bits; #define CHUNK_MAP_KEY ((size_t)0x10U) #define CHUNK_MAP_DIRTY ((size_t)0x08U) #define CHUNK_MAP_ZEROED ((size_t)0x04U) #define CHUNK_MAP_LARGE ((size_t)0x02U) #define CHUNK_MAP_ALLOCATED ((size_t)0x01U) }; typedef rb_tree(arena_chunk_map_t) arena_avail_tree_t; typedef rb_tree(arena_chunk_map_t) arena_run_tree_t; /* Arena chunk header. */ typedef struct arena_chunk_s arena_chunk_t; struct arena_chunk_s { /* Arena that owns the chunk. */ arena_t *arena; /* Linkage for the arena's chunks_dirty tree. */ rb_node(arena_chunk_t) link_dirty; /* Number of dirty pages. */ size_t ndirty; /* Map of pages within chunk that keeps track of free/large/small. */ arena_chunk_map_t map[1]; /* Dynamically sized. */ }; typedef rb_tree(arena_chunk_t) arena_chunk_tree_t; typedef struct arena_run_s arena_run_t; struct arena_run_s { #ifdef MALLOC_DEBUG uint32_t magic; # define ARENA_RUN_MAGIC 0x384adf93 #endif /* Bin this run is associated with. */ arena_bin_t *bin; /* Index of first element that might have a free region. */ unsigned regs_minelm; /* Number of free regions in run. */ unsigned nfree; /* Bitmask of in-use regions (0: in use, 1: free). */ unsigned regs_mask[1]; /* Dynamically sized. */ }; struct arena_bin_s { /* * Current run being used to service allocations of this bin's size * class. */ arena_run_t *runcur; /* * Tree of non-full runs. This tree is used when looking for an * existing run when runcur is no longer usable. We choose the * non-full run that is lowest in memory; this policy tends to keep * objects packed well, and it can also help reduce the number of * almost-empty chunks. */ arena_run_tree_t runs; /* Size of regions in a run for this bin's size class. */ size_t reg_size; /* Total size of a run for this bin's size class. */ size_t run_size; /* Total number of regions in a run for this bin's size class. */ uint32_t nregs; /* Number of elements in a run's regs_mask for this bin's size class. */ uint32_t regs_mask_nelms; /* Offset of first region in a run for this bin's size class. */ uint32_t reg0_offset; #ifdef MALLOC_STATS /* Bin statistics. */ malloc_bin_stats_t stats; #endif }; struct arena_s { #ifdef MALLOC_DEBUG uint32_t magic; # define ARENA_MAGIC 0x947d3d24 #endif /* All operations on this arena require that lock be locked. */ pthread_mutex_t lock; #ifdef MALLOC_STATS arena_stats_t stats; #endif /* Tree of dirty-page-containing chunks this arena manages. */ arena_chunk_tree_t chunks_dirty; /* * In order to avoid rapid chunk allocation/deallocation when an arena * oscillates right on the cusp of needing a new chunk, cache the most * recently freed chunk. The spare is left in the arena's chunk trees * until it is deleted. * * There is one spare chunk per arena, rather than one spare total, in * order to avoid interactions between multiple threads that could make * a single spare inadequate. */ arena_chunk_t *spare; /* * Current count of pages within unused runs that are potentially * dirty, and for which madvise(... MADV_FREE) has not been called. By * tracking this, we can institute a limit on how much dirty unused * memory is mapped for each arena. */ size_t ndirty; /* * Size/address-ordered tree of this arena's available runs. This tree * is used for first-best-fit run allocation. */ arena_avail_tree_t runs_avail; #ifdef MALLOC_BALANCE /* * The arena load balancing machinery needs to keep track of how much * lock contention there is. This value is exponentially averaged. */ uint32_t contention; #endif /* * bins is used to store rings of free regions of the following sizes, * assuming a 16-byte quantum, 4kB pagesize, and default MALLOC_OPTIONS. * * bins[i] | size | * --------+------+ * 0 | 2 | * 1 | 4 | * 2 | 8 | * --------+------+ * 3 | 16 | * 4 | 32 | * 5 | 48 | * 6 | 64 | * : : * : : * 33 | 496 | * 34 | 512 | * --------+------+ * 35 | 1024 | * 36 | 2048 | * --------+------+ */ arena_bin_t bins[1]; /* Dynamically sized. */ }; /******************************************************************************/ /* * Magazine data structures. */ #ifdef MALLOC_MAG typedef struct mag_s mag_t; struct mag_s { size_t binind; /* Index of associated bin. */ size_t nrounds; void *rounds[1]; /* Dynamically sized. */ }; /* * Magazines are lazily allocated, but once created, they remain until the * associated mag_rack is destroyed. */ typedef struct bin_mags_s bin_mags_t; struct bin_mags_s { mag_t *curmag; mag_t *sparemag; }; typedef struct mag_rack_s mag_rack_t; struct mag_rack_s { bin_mags_t bin_mags[1]; /* Dynamically sized. */ }; #endif /******************************************************************************/ /* * Data. */ /* Number of CPUs. */ static unsigned ncpus; /* VM page size. */ static size_t pagesize; static size_t pagesize_mask; static size_t pagesize_2pow; /* Various bin-related settings. */ #ifdef MALLOC_TINY /* Number of (2^n)-spaced tiny bins. */ # define ntbins ((unsigned)(QUANTUM_2POW - TINY_MIN_2POW)) #else # define ntbins 0 #endif static unsigned nqbins; /* Number of quantum-spaced bins. */ static unsigned ncbins; /* Number of cacheline-spaced bins. */ static unsigned nsbins; /* Number of subpage-spaced bins. */ static unsigned nbins; #ifdef MALLOC_TINY # define tspace_max ((size_t)(QUANTUM >> 1)) #endif #define qspace_min QUANTUM static size_t qspace_max; static size_t cspace_min; static size_t cspace_max; static size_t sspace_min; static size_t sspace_max; #define bin_maxclass sspace_max static uint8_t const *size2bin; /* * const_size2bin is a static constant lookup table that in the common case can * be used as-is for size2bin. For dynamically linked programs, this avoids * a page of memory overhead per process. */ #define S2B_1(i) i, #define S2B_2(i) S2B_1(i) S2B_1(i) #define S2B_4(i) S2B_2(i) S2B_2(i) #define S2B_8(i) S2B_4(i) S2B_4(i) #define S2B_16(i) S2B_8(i) S2B_8(i) #define S2B_32(i) S2B_16(i) S2B_16(i) #define S2B_64(i) S2B_32(i) S2B_32(i) #define S2B_128(i) S2B_64(i) S2B_64(i) #define S2B_256(i) S2B_128(i) S2B_128(i) static const uint8_t const_size2bin[(1U << PAGESIZE_2POW) - 255] = { S2B_1(0xffU) /* 0 */ #if (QUANTUM_2POW == 4) /* 64-bit system ************************/ # ifdef MALLOC_TINY S2B_2(0) /* 2 */ S2B_2(1) /* 4 */ S2B_4(2) /* 8 */ S2B_8(3) /* 16 */ # define S2B_QMIN 3 # else S2B_16(0) /* 16 */ # define S2B_QMIN 0 # endif S2B_16(S2B_QMIN + 1) /* 32 */ S2B_16(S2B_QMIN + 2) /* 48 */ S2B_16(S2B_QMIN + 3) /* 64 */ S2B_16(S2B_QMIN + 4) /* 80 */ S2B_16(S2B_QMIN + 5) /* 96 */ S2B_16(S2B_QMIN + 6) /* 112 */ S2B_16(S2B_QMIN + 7) /* 128 */ # define S2B_CMIN (S2B_QMIN + 8) #else /* 32-bit system ************************/ # ifdef MALLOC_TINY S2B_2(0) /* 2 */ S2B_2(1) /* 4 */ S2B_4(2) /* 8 */ # define S2B_QMIN 2 # else S2B_8(0) /* 8 */ # define S2B_QMIN 0 # endif S2B_8(S2B_QMIN + 1) /* 16 */ S2B_8(S2B_QMIN + 2) /* 24 */ S2B_8(S2B_QMIN + 3) /* 32 */ S2B_8(S2B_QMIN + 4) /* 40 */ S2B_8(S2B_QMIN + 5) /* 48 */ S2B_8(S2B_QMIN + 6) /* 56 */ S2B_8(S2B_QMIN + 7) /* 64 */ S2B_8(S2B_QMIN + 8) /* 72 */ S2B_8(S2B_QMIN + 9) /* 80 */ S2B_8(S2B_QMIN + 10) /* 88 */ S2B_8(S2B_QMIN + 11) /* 96 */ S2B_8(S2B_QMIN + 12) /* 104 */ S2B_8(S2B_QMIN + 13) /* 112 */ S2B_8(S2B_QMIN + 14) /* 120 */ S2B_8(S2B_QMIN + 15) /* 128 */ # define S2B_CMIN (S2B_QMIN + 16) #endif /****************************************/ S2B_64(S2B_CMIN + 0) /* 192 */ S2B_64(S2B_CMIN + 1) /* 256 */ S2B_64(S2B_CMIN + 2) /* 320 */ S2B_64(S2B_CMIN + 3) /* 384 */ S2B_64(S2B_CMIN + 4) /* 448 */ S2B_64(S2B_CMIN + 5) /* 512 */ # define S2B_SMIN (S2B_CMIN + 6) S2B_256(S2B_SMIN + 0) /* 768 */ S2B_256(S2B_SMIN + 1) /* 1024 */ S2B_256(S2B_SMIN + 2) /* 1280 */ S2B_256(S2B_SMIN + 3) /* 1536 */ S2B_256(S2B_SMIN + 4) /* 1792 */ S2B_256(S2B_SMIN + 5) /* 2048 */ S2B_256(S2B_SMIN + 6) /* 2304 */ S2B_256(S2B_SMIN + 7) /* 2560 */ S2B_256(S2B_SMIN + 8) /* 2816 */ S2B_256(S2B_SMIN + 9) /* 3072 */ S2B_256(S2B_SMIN + 10) /* 3328 */ S2B_256(S2B_SMIN + 11) /* 3584 */ S2B_256(S2B_SMIN + 12) /* 3840 */ #if (PAGESIZE_2POW == 13) S2B_256(S2B_SMIN + 13) /* 4096 */ S2B_256(S2B_SMIN + 14) /* 4352 */ S2B_256(S2B_SMIN + 15) /* 4608 */ S2B_256(S2B_SMIN + 16) /* 4864 */ S2B_256(S2B_SMIN + 17) /* 5120 */ S2B_256(S2B_SMIN + 18) /* 5376 */ S2B_256(S2B_SMIN + 19) /* 5632 */ S2B_256(S2B_SMIN + 20) /* 5888 */ S2B_256(S2B_SMIN + 21) /* 6144 */ S2B_256(S2B_SMIN + 22) /* 6400 */ S2B_256(S2B_SMIN + 23) /* 6656 */ S2B_256(S2B_SMIN + 24) /* 6912 */ S2B_256(S2B_SMIN + 25) /* 7168 */ S2B_256(S2B_SMIN + 26) /* 7424 */ S2B_256(S2B_SMIN + 27) /* 7680 */ S2B_256(S2B_SMIN + 28) /* 7936 */ #endif }; #undef S2B_1 #undef S2B_2 #undef S2B_4 #undef S2B_8 #undef S2B_16 #undef S2B_32 #undef S2B_64 #undef S2B_128 #undef S2B_256 #undef S2B_QMIN #undef S2B_CMIN #undef S2B_SMIN #ifdef MALLOC_MAG static size_t max_rounds; #endif /* Various chunk-related settings. */ static size_t chunksize; static size_t chunksize_mask; /* (chunksize - 1). */ static size_t chunk_npages; static size_t arena_chunk_header_npages; static size_t arena_maxclass; /* Max size class for arenas. */ /********/ /* * Chunks. */ /* Protects chunk-related data structures. */ static malloc_mutex_t huge_mtx; /* Tree of chunks that are stand-alone huge allocations. */ static extent_tree_t huge; #ifdef MALLOC_DSS /* * Protects sbrk() calls. This avoids malloc races among threads, though it * does not protect against races with threads that call sbrk() directly. */ static malloc_mutex_t dss_mtx; /* Base address of the DSS. */ static void *dss_base; /* Current end of the DSS, or ((void *)-1) if the DSS is exhausted. */ static void *dss_prev; /* Current upper limit on DSS addresses. */ static void *dss_max; /* * Trees of chunks that were previously allocated (trees differ only in node * ordering). These are used when allocating chunks, in an attempt to re-use * address space. Depending on function, different tree orderings are needed, * which is why there are two trees with the same contents. */ static extent_tree_t dss_chunks_szad; static extent_tree_t dss_chunks_ad; #endif #ifdef MALLOC_STATS /* Huge allocation statistics. */ static uint64_t huge_nmalloc; static uint64_t huge_ndalloc; static size_t huge_allocated; #endif /****************************/ /* * base (internal allocation). */ /* * Current pages that are being used for internal memory allocations. These * pages are carved up in cacheline-size quanta, so that there is no chance of * false cache line sharing. */ static void *base_pages; static void *base_next_addr; static void *base_past_addr; /* Addr immediately past base_pages. */ static extent_node_t *base_nodes; static malloc_mutex_t base_mtx; #ifdef MALLOC_STATS static size_t base_mapped; #endif /********/ /* * Arenas. */ /* * Arenas that are used to service external requests. Not all elements of the * arenas array are necessarily used; arenas are created lazily as needed. */ static arena_t **arenas; static unsigned narenas; #ifndef NO_TLS # ifdef MALLOC_BALANCE static unsigned narenas_2pow; # else static unsigned next_arena; # endif #endif static pthread_mutex_t arenas_lock; /* Protects arenas initialization. */ #ifndef NO_TLS /* * Map of pthread_self() --> arenas[???], used for selecting an arena to use * for allocations. */ static __thread arena_t *arenas_map; #endif #ifdef MALLOC_MAG /* * Map of thread-specific magazine racks, used for thread-specific object * caching. */ static __thread mag_rack_t *mag_rack; #endif #ifdef MALLOC_STATS /* Chunk statistics. */ static chunk_stats_t stats_chunks; #endif /*******************************/ /* * Runtime configuration options. */ const char *_malloc_options; #ifndef MALLOC_PRODUCTION static bool opt_abort = true; static bool opt_junk = true; #else static bool opt_abort = false; static bool opt_junk = false; #endif #ifdef MALLOC_DSS static bool opt_dss = true; static bool opt_mmap = true; #endif #ifdef MALLOC_MAG static bool opt_mag = true; static size_t opt_mag_size_2pow = MAG_SIZE_2POW_DEFAULT; #endif static size_t opt_dirty_max = DIRTY_MAX_DEFAULT; #ifdef MALLOC_BALANCE static uint64_t opt_balance_threshold = BALANCE_THRESHOLD_DEFAULT; #endif static bool opt_print_stats = false; static size_t opt_qspace_max_2pow = QSPACE_MAX_2POW_DEFAULT; static size_t opt_cspace_max_2pow = CSPACE_MAX_2POW_DEFAULT; static size_t opt_chunk_2pow = CHUNK_2POW_DEFAULT; static bool opt_utrace = false; static bool opt_sysv = false; static bool opt_xmalloc = false; static bool opt_zero = false; static int opt_narenas_lshift = 0; typedef struct { void *p; size_t s; void *r; } malloc_utrace_t; #define UTRACE(a, b, c) \ if (opt_utrace) { \ malloc_utrace_t ut; \ ut.p = (a); \ ut.s = (b); \ ut.r = (c); \ utrace(&ut, sizeof(ut)); \ } /******************************************************************************/ /* * Begin function prototypes for non-inline static functions. */ static void malloc_mutex_init(malloc_mutex_t *mutex); static bool malloc_spin_init(pthread_mutex_t *lock); static void wrtmessage(const char *p1, const char *p2, const char *p3, const char *p4); #ifdef MALLOC_STATS static void malloc_printf(const char *format, ...); #endif static char *umax2s(uintmax_t x, char *s); #ifdef MALLOC_DSS static bool base_pages_alloc_dss(size_t minsize); #endif static bool base_pages_alloc_mmap(size_t minsize); static bool base_pages_alloc(size_t minsize); static void *base_alloc(size_t size); static void *base_calloc(size_t number, size_t size); static extent_node_t *base_node_alloc(void); static void base_node_dealloc(extent_node_t *node); #ifdef MALLOC_STATS static void stats_print(arena_t *arena); #endif static void *pages_map(void *addr, size_t size); static void pages_unmap(void *addr, size_t size); #ifdef MALLOC_DSS static void *chunk_alloc_dss(size_t size); static void *chunk_recycle_dss(size_t size, bool zero); #endif static void *chunk_alloc_mmap(size_t size); static void *chunk_alloc(size_t size, bool zero); #ifdef MALLOC_DSS static extent_node_t *chunk_dealloc_dss_record(void *chunk, size_t size); static bool chunk_dealloc_dss(void *chunk, size_t size); #endif static void chunk_dealloc_mmap(void *chunk, size_t size); static void chunk_dealloc(void *chunk, size_t size); #ifndef NO_TLS static arena_t *choose_arena_hard(void); #endif static void arena_run_split(arena_t *arena, arena_run_t *run, size_t size, bool large, bool zero); static arena_chunk_t *arena_chunk_alloc(arena_t *arena); static void arena_chunk_dealloc(arena_t *arena, arena_chunk_t *chunk); static arena_run_t *arena_run_alloc(arena_t *arena, size_t size, bool large, bool zero); static void arena_purge(arena_t *arena); static void arena_run_dalloc(arena_t *arena, arena_run_t *run, bool dirty); static void arena_run_trim_head(arena_t *arena, arena_chunk_t *chunk, arena_run_t *run, size_t oldsize, size_t newsize); static void arena_run_trim_tail(arena_t *arena, arena_chunk_t *chunk, arena_run_t *run, size_t oldsize, size_t newsize, bool dirty); static arena_run_t *arena_bin_nonfull_run_get(arena_t *arena, arena_bin_t *bin); static void *arena_bin_malloc_hard(arena_t *arena, arena_bin_t *bin); static size_t arena_bin_run_size_calc(arena_bin_t *bin, size_t min_run_size); #ifdef MALLOC_BALANCE static void arena_lock_balance_hard(arena_t *arena); #endif #ifdef MALLOC_MAG static void mag_load(mag_t *mag); #endif static void *arena_malloc_large(arena_t *arena, size_t size, bool zero); static void *arena_palloc(arena_t *arena, size_t alignment, size_t size, size_t alloc_size); static size_t arena_salloc(const void *ptr); #ifdef MALLOC_MAG static void mag_unload(mag_t *mag); #endif static void arena_dalloc_large(arena_t *arena, arena_chunk_t *chunk, void *ptr); static void arena_ralloc_large_shrink(arena_t *arena, arena_chunk_t *chunk, void *ptr, size_t size, size_t oldsize); static bool arena_ralloc_large_grow(arena_t *arena, arena_chunk_t *chunk, void *ptr, size_t size, size_t oldsize); static bool arena_ralloc_large(void *ptr, size_t size, size_t oldsize); static void *arena_ralloc(void *ptr, size_t size, size_t oldsize); static bool arena_new(arena_t *arena); static arena_t *arenas_extend(unsigned ind); #ifdef MALLOC_MAG static mag_t *mag_create(arena_t *arena, size_t binind); static void mag_destroy(mag_t *mag); static mag_rack_t *mag_rack_create(arena_t *arena); static void mag_rack_destroy(mag_rack_t *rack); #endif static void *huge_malloc(size_t size, bool zero); static void *huge_palloc(size_t alignment, size_t size); static void *huge_ralloc(void *ptr, size_t size, size_t oldsize); static void huge_dalloc(void *ptr); static void malloc_print_stats(void); #ifdef MALLOC_DEBUG static void size2bin_validate(void); #endif static bool size2bin_init(void); static bool size2bin_init_hard(void); static bool malloc_init_hard(void); /* * End function prototypes. */ /******************************************************************************/ /* * Begin mutex. We can't use normal pthread mutexes in all places, because * they require malloc()ed memory, which causes bootstrapping issues in some * cases. */ static void malloc_mutex_init(malloc_mutex_t *mutex) { static const spinlock_t lock = _SPINLOCK_INITIALIZER; mutex->lock = lock; } static inline void malloc_mutex_lock(malloc_mutex_t *mutex) { if (__isthreaded) _SPINLOCK(&mutex->lock); } static inline void malloc_mutex_unlock(malloc_mutex_t *mutex) { if (__isthreaded) _SPINUNLOCK(&mutex->lock); } /* * End mutex. */ /******************************************************************************/ /* * Begin spin lock. Spin locks here are actually adaptive mutexes that block * after a period of spinning, because unbounded spinning would allow for * priority inversion. */ /* * We use an unpublished interface to initialize pthread mutexes with an * allocation callback, in order to avoid infinite recursion. */ int _pthread_mutex_init_calloc_cb(pthread_mutex_t *mutex, void *(calloc_cb)(size_t, size_t)); __weak_reference(_pthread_mutex_init_calloc_cb_stub, _pthread_mutex_init_calloc_cb); int _pthread_mutex_init_calloc_cb_stub(pthread_mutex_t *mutex, void *(calloc_cb)(size_t, size_t)) { return (0); } static bool malloc_spin_init(pthread_mutex_t *lock) { if (_pthread_mutex_init_calloc_cb(lock, base_calloc) != 0) return (true); return (false); } static inline unsigned malloc_spin_lock(pthread_mutex_t *lock) { unsigned ret = 0; if (__isthreaded) { if (_pthread_mutex_trylock(lock) != 0) { unsigned i; volatile unsigned j; /* Exponentially back off. */ for (i = 1; i <= SPIN_LIMIT_2POW; i++) { for (j = 0; j < (1U << i); j++) { ret++; CPU_SPINWAIT; } if (_pthread_mutex_trylock(lock) == 0) return (ret); } /* * Spinning failed. Block until the lock becomes * available, in order to avoid indefinite priority * inversion. */ _pthread_mutex_lock(lock); assert((ret << BLOCK_COST_2POW) != 0); return (ret << BLOCK_COST_2POW); } } return (ret); } static inline void malloc_spin_unlock(pthread_mutex_t *lock) { if (__isthreaded) _pthread_mutex_unlock(lock); } /* * End spin lock. */ /******************************************************************************/ /* * Begin Utility functions/macros. */ /* Return the chunk address for allocation address a. */ #define CHUNK_ADDR2BASE(a) \ ((void *)((uintptr_t)(a) & ~chunksize_mask)) /* Return the chunk offset of address a. */ #define CHUNK_ADDR2OFFSET(a) \ ((size_t)((uintptr_t)(a) & chunksize_mask)) /* Return the smallest chunk multiple that is >= s. */ #define CHUNK_CEILING(s) \ (((s) + chunksize_mask) & ~chunksize_mask) /* Return the smallest quantum multiple that is >= a. */ #define QUANTUM_CEILING(a) \ (((a) + QUANTUM_MASK) & ~QUANTUM_MASK) /* Return the smallest cacheline multiple that is >= s. */ #define CACHELINE_CEILING(s) \ (((s) + CACHELINE_MASK) & ~CACHELINE_MASK) /* Return the smallest subpage multiple that is >= s. */ #define SUBPAGE_CEILING(s) \ (((s) + SUBPAGE_MASK) & ~SUBPAGE_MASK) /* Return the smallest pagesize multiple that is >= s. */ #define PAGE_CEILING(s) \ (((s) + pagesize_mask) & ~pagesize_mask) #ifdef MALLOC_TINY /* Compute the smallest power of 2 that is >= x. */ static inline size_t pow2_ceil(size_t x) { x--; x |= x >> 1; x |= x >> 2; x |= x >> 4; x |= x >> 8; x |= x >> 16; #if (SIZEOF_PTR == 8) x |= x >> 32; #endif x++; return (x); } #endif #ifdef MALLOC_BALANCE /* * Use a simple linear congruential pseudo-random number generator: * * prn(y) = (a*x + c) % m * * where the following constants ensure maximal period: * * a == Odd number (relatively prime to 2^n), and (a-1) is a multiple of 4. * c == Odd number (relatively prime to 2^n). * m == 2^32 * * See Knuth's TAOCP 3rd Ed., Vol. 2, pg. 17 for details on these constraints. * * This choice of m has the disadvantage that the quality of the bits is * proportional to bit position. For example. the lowest bit has a cycle of 2, * the next has a cycle of 4, etc. For this reason, we prefer to use the upper * bits. */ # define PRN_DEFINE(suffix, var, a, c) \ static inline void \ sprn_##suffix(uint32_t seed) \ { \ var = seed; \ } \ \ static inline uint32_t \ prn_##suffix(uint32_t lg_range) \ { \ uint32_t ret, x; \ \ assert(lg_range > 0); \ assert(lg_range <= 32); \ \ x = (var * (a)) + (c); \ var = x; \ ret = x >> (32 - lg_range); \ \ return (ret); \ } # define SPRN(suffix, seed) sprn_##suffix(seed) # define PRN(suffix, lg_range) prn_##suffix(lg_range) #endif #ifdef MALLOC_BALANCE /* Define the PRNG used for arena assignment. */ static __thread uint32_t balance_x; PRN_DEFINE(balance, balance_x, 1297, 1301) #endif static void wrtmessage(const char *p1, const char *p2, const char *p3, const char *p4) { _write(STDERR_FILENO, p1, strlen(p1)); _write(STDERR_FILENO, p2, strlen(p2)); _write(STDERR_FILENO, p3, strlen(p3)); _write(STDERR_FILENO, p4, strlen(p4)); } void (*_malloc_message)(const char *p1, const char *p2, const char *p3, const char *p4) = wrtmessage; #ifdef MALLOC_STATS /* * Print to stderr in such a way as to (hopefully) avoid memory allocation. */ static void malloc_printf(const char *format, ...) { char buf[4096]; va_list ap; va_start(ap, format); vsnprintf(buf, sizeof(buf), format, ap); va_end(ap); _malloc_message(buf, "", "", ""); } #endif /* * We don't want to depend on vsnprintf() for production builds, since that can * cause unnecessary bloat for static binaries. umax2s() provides minimal * integer printing functionality, so that malloc_printf() use can be limited to * MALLOC_STATS code. */ #define UMAX2S_BUFSIZE 21 static char * umax2s(uintmax_t x, char *s) { unsigned i; /* Make sure UMAX2S_BUFSIZE is large enough. */ assert(sizeof(uintmax_t) <= 8); i = UMAX2S_BUFSIZE - 1; s[i] = '\0'; do { i--; s[i] = "0123456789"[x % 10]; x /= 10; } while (x > 0); return (&s[i]); } /******************************************************************************/ #ifdef MALLOC_DSS static bool base_pages_alloc_dss(size_t minsize) { /* * Do special DSS allocation here, since base allocations don't need to * be chunk-aligned. */ malloc_mutex_lock(&dss_mtx); if (dss_prev != (void *)-1) { intptr_t incr; size_t csize = CHUNK_CEILING(minsize); do { /* Get the current end of the DSS. */ dss_max = sbrk(0); /* * Calculate how much padding is necessary to * chunk-align the end of the DSS. Don't worry about * dss_max not being chunk-aligned though. */ incr = (intptr_t)chunksize - (intptr_t)CHUNK_ADDR2OFFSET(dss_max); assert(incr >= 0); if ((size_t)incr < minsize) incr += csize; dss_prev = sbrk(incr); if (dss_prev == dss_max) { /* Success. */ dss_max = (void *)((intptr_t)dss_prev + incr); base_pages = dss_prev; base_next_addr = base_pages; base_past_addr = dss_max; #ifdef MALLOC_STATS base_mapped += incr; #endif malloc_mutex_unlock(&dss_mtx); return (false); } } while (dss_prev != (void *)-1); } malloc_mutex_unlock(&dss_mtx); return (true); } #endif static bool base_pages_alloc_mmap(size_t minsize) { size_t csize; assert(minsize != 0); csize = PAGE_CEILING(minsize); base_pages = pages_map(NULL, csize); if (base_pages == NULL) return (true); base_next_addr = base_pages; base_past_addr = (void *)((uintptr_t)base_pages + csize); #ifdef MALLOC_STATS base_mapped += csize; #endif return (false); } static bool base_pages_alloc(size_t minsize) { #ifdef MALLOC_DSS if (opt_dss) { if (base_pages_alloc_dss(minsize) == false) return (false); } if (opt_mmap && minsize != 0) #endif { if (base_pages_alloc_mmap(minsize) == false) return (false); } return (true); } static void * base_alloc(size_t size) { void *ret; size_t csize; /* Round size up to nearest multiple of the cacheline size. */ csize = CACHELINE_CEILING(size); malloc_mutex_lock(&base_mtx); /* Make sure there's enough space for the allocation. */ if ((uintptr_t)base_next_addr + csize > (uintptr_t)base_past_addr) { if (base_pages_alloc(csize)) { malloc_mutex_unlock(&base_mtx); return (NULL); } } /* Allocate. */ ret = base_next_addr; base_next_addr = (void *)((uintptr_t)base_next_addr + csize); malloc_mutex_unlock(&base_mtx); return (ret); } static void * base_calloc(size_t number, size_t size) { void *ret; ret = base_alloc(number * size); memset(ret, 0, number * size); return (ret); } static extent_node_t * base_node_alloc(void) { extent_node_t *ret; malloc_mutex_lock(&base_mtx); if (base_nodes != NULL) { ret = base_nodes; base_nodes = *(extent_node_t **)ret; malloc_mutex_unlock(&base_mtx); } else { malloc_mutex_unlock(&base_mtx); ret = (extent_node_t *)base_alloc(sizeof(extent_node_t)); } return (ret); } static void base_node_dealloc(extent_node_t *node) { malloc_mutex_lock(&base_mtx); *(extent_node_t **)node = base_nodes; base_nodes = node; malloc_mutex_unlock(&base_mtx); } /******************************************************************************/ #ifdef MALLOC_STATS static void stats_print(arena_t *arena) { unsigned i, gap_start; malloc_printf("dirty: %zu page%s dirty, %llu sweep%s," " %llu madvise%s, %llu page%s purged\n", arena->ndirty, arena->ndirty == 1 ? "" : "s", arena->stats.npurge, arena->stats.npurge == 1 ? "" : "s", arena->stats.nmadvise, arena->stats.nmadvise == 1 ? "" : "s", arena->stats.purged, arena->stats.purged == 1 ? "" : "s"); malloc_printf(" allocated nmalloc ndalloc\n"); malloc_printf("small: %12zu %12llu %12llu\n", arena->stats.allocated_small, arena->stats.nmalloc_small, arena->stats.ndalloc_small); malloc_printf("large: %12zu %12llu %12llu\n", arena->stats.allocated_large, arena->stats.nmalloc_large, arena->stats.ndalloc_large); malloc_printf("total: %12zu %12llu %12llu\n", arena->stats.allocated_small + arena->stats.allocated_large, arena->stats.nmalloc_small + arena->stats.nmalloc_large, arena->stats.ndalloc_small + arena->stats.ndalloc_large); malloc_printf("mapped: %12zu\n", arena->stats.mapped); #ifdef MALLOC_MAG if (__isthreaded && opt_mag) { malloc_printf("bins: bin size regs pgs mags " "newruns reruns maxruns curruns\n"); } else { #endif malloc_printf("bins: bin size regs pgs requests " "newruns reruns maxruns curruns\n"); #ifdef MALLOC_MAG } #endif for (i = 0, gap_start = UINT_MAX; i < nbins; i++) { if (arena->bins[i].stats.nruns == 0) { if (gap_start == UINT_MAX) gap_start = i; } else { if (gap_start != UINT_MAX) { if (i > gap_start + 1) { /* Gap of more than one size class. */ malloc_printf("[%u..%u]\n", gap_start, i - 1); } else { /* Gap of one size class. */ malloc_printf("[%u]\n", gap_start); } gap_start = UINT_MAX; } malloc_printf( "%13u %1s %4u %4u %3u %9llu %9llu" " %9llu %7lu %7lu\n", i, i < ntbins ? "T" : i < ntbins + nqbins ? "Q" : i < ntbins + nqbins + ncbins ? "C" : "S", arena->bins[i].reg_size, arena->bins[i].nregs, arena->bins[i].run_size >> pagesize_2pow, #ifdef MALLOC_MAG (__isthreaded && opt_mag) ? arena->bins[i].stats.nmags : #endif arena->bins[i].stats.nrequests, arena->bins[i].stats.nruns, arena->bins[i].stats.reruns, arena->bins[i].stats.highruns, arena->bins[i].stats.curruns); } } if (gap_start != UINT_MAX) { if (i > gap_start + 1) { /* Gap of more than one size class. */ malloc_printf("[%u..%u]\n", gap_start, i - 1); } else { /* Gap of one size class. */ malloc_printf("[%u]\n", gap_start); } } } #endif /* * End Utility functions/macros. */ /******************************************************************************/ /* * Begin extent tree code. */ #ifdef MALLOC_DSS static inline int extent_szad_comp(extent_node_t *a, extent_node_t *b) { int ret; size_t a_size = a->size; size_t b_size = b->size; ret = (a_size > b_size) - (a_size < b_size); if (ret == 0) { uintptr_t a_addr = (uintptr_t)a->addr; uintptr_t b_addr = (uintptr_t)b->addr; ret = (a_addr > b_addr) - (a_addr < b_addr); } return (ret); } /* Wrap red-black tree macros in functions. */ rb_wrap(__unused static, extent_tree_szad_, extent_tree_t, extent_node_t, link_szad, extent_szad_comp) #endif static inline int extent_ad_comp(extent_node_t *a, extent_node_t *b) { uintptr_t a_addr = (uintptr_t)a->addr; uintptr_t b_addr = (uintptr_t)b->addr; return ((a_addr > b_addr) - (a_addr < b_addr)); } /* Wrap red-black tree macros in functions. */ rb_wrap(__unused static, extent_tree_ad_, extent_tree_t, extent_node_t, link_ad, extent_ad_comp) /* * End extent tree code. */ /******************************************************************************/ /* * Begin chunk management functions. */ static void * pages_map(void *addr, size_t size) { void *ret; /* * We don't use MAP_FIXED here, because it can cause the *replacement* * of existing mappings, and we only want to create new mappings. */ ret = mmap(addr, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); assert(ret != NULL); if (ret == MAP_FAILED) ret = NULL; else if (addr != NULL && ret != addr) { /* * We succeeded in mapping memory, but not in the right place. */ if (munmap(ret, size) == -1) { char buf[STRERROR_BUF]; strerror_r(errno, buf, sizeof(buf)); _malloc_message(_getprogname(), ": (malloc) Error in munmap(): ", buf, "\n"); if (opt_abort) abort(); } ret = NULL; } assert(ret == NULL || (addr == NULL && ret != addr) || (addr != NULL && ret == addr)); return (ret); } static void pages_unmap(void *addr, size_t size) { if (munmap(addr, size) == -1) { char buf[STRERROR_BUF]; strerror_r(errno, buf, sizeof(buf)); _malloc_message(_getprogname(), ": (malloc) Error in munmap(): ", buf, "\n"); if (opt_abort) abort(); } } #ifdef MALLOC_DSS static void * chunk_alloc_dss(size_t size) { /* * sbrk() uses a signed increment argument, so take care not to * interpret a huge allocation request as a negative increment. */ if ((intptr_t)size < 0) return (NULL); malloc_mutex_lock(&dss_mtx); if (dss_prev != (void *)-1) { intptr_t incr; /* * The loop is necessary to recover from races with other * threads that are using the DSS for something other than * malloc. */ do { void *ret; /* Get the current end of the DSS. */ dss_max = sbrk(0); /* * Calculate how much padding is necessary to * chunk-align the end of the DSS. */ incr = (intptr_t)size - (intptr_t)CHUNK_ADDR2OFFSET(dss_max); if (incr == (intptr_t)size) ret = dss_max; else { ret = (void *)((intptr_t)dss_max + incr); incr += size; } dss_prev = sbrk(incr); if (dss_prev == dss_max) { /* Success. */ dss_max = (void *)((intptr_t)dss_prev + incr); malloc_mutex_unlock(&dss_mtx); return (ret); } } while (dss_prev != (void *)-1); } malloc_mutex_unlock(&dss_mtx); return (NULL); } static void * chunk_recycle_dss(size_t size, bool zero) { extent_node_t *node, key; key.addr = NULL; key.size = size; malloc_mutex_lock(&dss_mtx); node = extent_tree_szad_nsearch(&dss_chunks_szad, &key); if (node != NULL) { void *ret = node->addr; /* Remove node from the tree. */ extent_tree_szad_remove(&dss_chunks_szad, node); if (node->size == size) { extent_tree_ad_remove(&dss_chunks_ad, node); base_node_dealloc(node); } else { /* * Insert the remainder of node's address range as a * smaller chunk. Its position within dss_chunks_ad * does not change. */ assert(node->size > size); node->addr = (void *)((uintptr_t)node->addr + size); node->size -= size; extent_tree_szad_insert(&dss_chunks_szad, node); } malloc_mutex_unlock(&dss_mtx); if (zero) memset(ret, 0, size); return (ret); } malloc_mutex_unlock(&dss_mtx); return (NULL); } #endif static void * chunk_alloc_mmap(size_t size) { void *ret; size_t offset; /* * Ideally, there would be a way to specify alignment to mmap() (like * NetBSD has), but in the absence of such a feature, we have to work * hard to efficiently create aligned mappings. The reliable, but * expensive method is to create a mapping that is over-sized, then * trim the excess. However, that always results in at least one call * to pages_unmap(). * * A more optimistic approach is to try mapping precisely the right * amount, then try to append another mapping if alignment is off. In * practice, this works out well as long as the application is not * interleaving mappings via direct mmap() calls. If we do run into a * situation where there is an interleaved mapping and we are unable to * extend an unaligned mapping, our best option is to momentarily * revert to the reliable-but-expensive method. This will tend to * leave a gap in the memory map that is too small to cause later * problems for the optimistic method. */ ret = pages_map(NULL, size); if (ret == NULL) return (NULL); offset = CHUNK_ADDR2OFFSET(ret); if (offset != 0) { /* Try to extend chunk boundary. */ if (pages_map((void *)((uintptr_t)ret + size), chunksize - offset) == NULL) { /* * Extension failed. Clean up, then revert to the * reliable-but-expensive method. */ pages_unmap(ret, size); /* Beware size_t wrap-around. */ if (size + chunksize <= size) return NULL; ret = pages_map(NULL, size + chunksize); if (ret == NULL) return (NULL); /* Clean up unneeded leading/trailing space. */ offset = CHUNK_ADDR2OFFSET(ret); if (offset != 0) { /* Leading space. */ pages_unmap(ret, chunksize - offset); ret = (void *)((uintptr_t)ret + (chunksize - offset)); /* Trailing space. */ pages_unmap((void *)((uintptr_t)ret + size), offset); } else { /* Trailing space only. */ pages_unmap((void *)((uintptr_t)ret + size), chunksize); } } else { /* Clean up unneeded leading space. */ pages_unmap(ret, chunksize - offset); ret = (void *)((uintptr_t)ret + (chunksize - offset)); } } return (ret); } static void * chunk_alloc(size_t size, bool zero) { void *ret; assert(size != 0); assert((size & chunksize_mask) == 0); #ifdef MALLOC_DSS if (opt_dss) { ret = chunk_recycle_dss(size, zero); if (ret != NULL) { goto RETURN; } ret = chunk_alloc_dss(size); if (ret != NULL) goto RETURN; } if (opt_mmap) #endif { ret = chunk_alloc_mmap(size); if (ret != NULL) goto RETURN; } /* All strategies for allocation failed. */ ret = NULL; RETURN: #ifdef MALLOC_STATS if (ret != NULL) { stats_chunks.nchunks += (size / chunksize); stats_chunks.curchunks += (size / chunksize); } if (stats_chunks.curchunks > stats_chunks.highchunks) stats_chunks.highchunks = stats_chunks.curchunks; #endif assert(CHUNK_ADDR2BASE(ret) == ret); return (ret); } #ifdef MALLOC_DSS static extent_node_t * chunk_dealloc_dss_record(void *chunk, size_t size) { extent_node_t *node, *prev, key; key.addr = (void *)((uintptr_t)chunk + size); node = extent_tree_ad_nsearch(&dss_chunks_ad, &key); /* Try to coalesce forward. */ if (node != NULL && node->addr == key.addr) { /* * Coalesce chunk with the following address range. This does * not change the position within dss_chunks_ad, so only * remove/insert from/into dss_chunks_szad. */ extent_tree_szad_remove(&dss_chunks_szad, node); node->addr = chunk; node->size += size; extent_tree_szad_insert(&dss_chunks_szad, node); } else { /* * Coalescing forward failed, so insert a new node. Drop * dss_mtx during node allocation, since it is possible that a * new base chunk will be allocated. */ malloc_mutex_unlock(&dss_mtx); node = base_node_alloc(); malloc_mutex_lock(&dss_mtx); if (node == NULL) return (NULL); node->addr = chunk; node->size = size; extent_tree_ad_insert(&dss_chunks_ad, node); extent_tree_szad_insert(&dss_chunks_szad, node); } /* Try to coalesce backward. */ prev = extent_tree_ad_prev(&dss_chunks_ad, node); if (prev != NULL && (void *)((uintptr_t)prev->addr + prev->size) == chunk) { /* * Coalesce chunk with the previous address range. This does * not change the position within dss_chunks_ad, so only * remove/insert node from/into dss_chunks_szad. */ extent_tree_szad_remove(&dss_chunks_szad, prev); extent_tree_ad_remove(&dss_chunks_ad, prev); extent_tree_szad_remove(&dss_chunks_szad, node); node->addr = prev->addr; node->size += prev->size; extent_tree_szad_insert(&dss_chunks_szad, node); base_node_dealloc(prev); } return (node); } static bool chunk_dealloc_dss(void *chunk, size_t size) { malloc_mutex_lock(&dss_mtx); if ((uintptr_t)chunk >= (uintptr_t)dss_base && (uintptr_t)chunk < (uintptr_t)dss_max) { extent_node_t *node; /* Try to coalesce with other unused chunks. */ node = chunk_dealloc_dss_record(chunk, size); if (node != NULL) { chunk = node->addr; size = node->size; } /* Get the current end of the DSS. */ dss_max = sbrk(0); /* * Try to shrink the DSS if this chunk is at the end of the * DSS. The sbrk() call here is subject to a race condition * with threads that use brk(2) or sbrk(2) directly, but the * alternative would be to leak memory for the sake of poorly * designed multi-threaded programs. */ if ((void *)((uintptr_t)chunk + size) == dss_max && (dss_prev = sbrk(-(intptr_t)size)) == dss_max) { /* Success. */ dss_max = (void *)((intptr_t)dss_prev - (intptr_t)size); if (node != NULL) { extent_tree_szad_remove(&dss_chunks_szad, node); extent_tree_ad_remove(&dss_chunks_ad, node); base_node_dealloc(node); } malloc_mutex_unlock(&dss_mtx); } else { malloc_mutex_unlock(&dss_mtx); madvise(chunk, size, MADV_FREE); } return (false); } malloc_mutex_unlock(&dss_mtx); return (true); } #endif static void chunk_dealloc_mmap(void *chunk, size_t size) { pages_unmap(chunk, size); } static void chunk_dealloc(void *chunk, size_t size) { assert(chunk != NULL); assert(CHUNK_ADDR2BASE(chunk) == chunk); assert(size != 0); assert((size & chunksize_mask) == 0); #ifdef MALLOC_STATS stats_chunks.curchunks -= (size / chunksize); #endif #ifdef MALLOC_DSS if (opt_dss) { if (chunk_dealloc_dss(chunk, size) == false) return; } if (opt_mmap) #endif chunk_dealloc_mmap(chunk, size); } /* * End chunk management functions. */ /******************************************************************************/ /* * Begin arena. */ /* * Choose an arena based on a per-thread value (fast-path code, calls slow-path * code if necessary). */ static inline arena_t * choose_arena(void) { arena_t *ret; /* * We can only use TLS if this is a PIC library, since for the static * library version, libc's malloc is used by TLS allocation, which * introduces a bootstrapping issue. */ #ifndef NO_TLS if (__isthreaded == false) { /* Avoid the overhead of TLS for single-threaded operation. */ return (arenas[0]); } ret = arenas_map; if (ret == NULL) { ret = choose_arena_hard(); assert(ret != NULL); } #else if (__isthreaded && narenas > 1) { unsigned long ind; /* * Hash _pthread_self() to one of the arenas. There is a prime * number of arenas, so this has a reasonable chance of * working. Even so, the hashing can be easily thwarted by * inconvenient _pthread_self() values. Without specific * knowledge of how _pthread_self() calculates values, we can't * easily do much better than this. */ ind = (unsigned long) _pthread_self() % narenas; /* * Optimistially assume that arenas[ind] has been initialized. * At worst, we find out that some other thread has already * done so, after acquiring the lock in preparation. Note that * this lazy locking also has the effect of lazily forcing * cache coherency; without the lock acquisition, there's no * guarantee that modification of arenas[ind] by another thread * would be seen on this CPU for an arbitrary amount of time. * * In general, this approach to modifying a synchronized value * isn't a good idea, but in this case we only ever modify the * value once, so things work out well. */ ret = arenas[ind]; if (ret == NULL) { /* * Avoid races with another thread that may have already * initialized arenas[ind]. */ malloc_spin_lock(&arenas_lock); if (arenas[ind] == NULL) ret = arenas_extend((unsigned)ind); else ret = arenas[ind]; malloc_spin_unlock(&arenas_lock); } } else ret = arenas[0]; #endif assert(ret != NULL); return (ret); } #ifndef NO_TLS /* * Choose an arena based on a per-thread value (slow-path code only, called * only by choose_arena()). */ static arena_t * choose_arena_hard(void) { arena_t *ret; assert(__isthreaded); #ifdef MALLOC_BALANCE /* Seed the PRNG used for arena load balancing. */ SPRN(balance, (uint32_t)(uintptr_t)(_pthread_self())); #endif if (narenas > 1) { #ifdef MALLOC_BALANCE unsigned ind; ind = PRN(balance, narenas_2pow); if ((ret = arenas[ind]) == NULL) { malloc_spin_lock(&arenas_lock); if ((ret = arenas[ind]) == NULL) ret = arenas_extend(ind); malloc_spin_unlock(&arenas_lock); } #else malloc_spin_lock(&arenas_lock); if ((ret = arenas[next_arena]) == NULL) ret = arenas_extend(next_arena); next_arena = (next_arena + 1) % narenas; malloc_spin_unlock(&arenas_lock); #endif } else ret = arenas[0]; arenas_map = ret; return (ret); } #endif static inline int arena_chunk_comp(arena_chunk_t *a, arena_chunk_t *b) { uintptr_t a_chunk = (uintptr_t)a; uintptr_t b_chunk = (uintptr_t)b; assert(a != NULL); assert(b != NULL); return ((a_chunk > b_chunk) - (a_chunk < b_chunk)); } /* Wrap red-black tree macros in functions. */ rb_wrap(__unused static, arena_chunk_tree_dirty_, arena_chunk_tree_t, arena_chunk_t, link_dirty, arena_chunk_comp) static inline int arena_run_comp(arena_chunk_map_t *a, arena_chunk_map_t *b) { uintptr_t a_mapelm = (uintptr_t)a; uintptr_t b_mapelm = (uintptr_t)b; assert(a != NULL); assert(b != NULL); return ((a_mapelm > b_mapelm) - (a_mapelm < b_mapelm)); } /* Wrap red-black tree macros in functions. */ rb_wrap(__unused static, arena_run_tree_, arena_run_tree_t, arena_chunk_map_t, link, arena_run_comp) static inline int arena_avail_comp(arena_chunk_map_t *a, arena_chunk_map_t *b) { int ret; size_t a_size = a->bits & ~pagesize_mask; size_t b_size = b->bits & ~pagesize_mask; ret = (a_size > b_size) - (a_size < b_size); if (ret == 0) { uintptr_t a_mapelm, b_mapelm; if ((a->bits & CHUNK_MAP_KEY) == 0) a_mapelm = (uintptr_t)a; else { /* * Treat keys as though they are lower than anything * else. */ a_mapelm = 0; } b_mapelm = (uintptr_t)b; ret = (a_mapelm > b_mapelm) - (a_mapelm < b_mapelm); } return (ret); } /* Wrap red-black tree macros in functions. */ rb_wrap(__unused static, arena_avail_tree_, arena_avail_tree_t, arena_chunk_map_t, link, arena_avail_comp) static inline void * arena_run_reg_alloc(arena_run_t *run, arena_bin_t *bin) { void *ret; unsigned i, mask, bit, regind; assert(run->magic == ARENA_RUN_MAGIC); assert(run->regs_minelm < bin->regs_mask_nelms); /* * Move the first check outside the loop, so that run->regs_minelm can * be updated unconditionally, without the possibility of updating it * multiple times. */ i = run->regs_minelm; mask = run->regs_mask[i]; if (mask != 0) { /* Usable allocation found. */ bit = ffs((int)mask) - 1; regind = ((i << (SIZEOF_INT_2POW + 3)) + bit); assert(regind < bin->nregs); ret = (void *)(((uintptr_t)run) + bin->reg0_offset + (bin->reg_size * regind)); /* Clear bit. */ mask ^= (1U << bit); run->regs_mask[i] = mask; return (ret); } for (i++; i < bin->regs_mask_nelms; i++) { mask = run->regs_mask[i]; if (mask != 0) { /* Usable allocation found. */ bit = ffs((int)mask) - 1; regind = ((i << (SIZEOF_INT_2POW + 3)) + bit); assert(regind < bin->nregs); ret = (void *)(((uintptr_t)run) + bin->reg0_offset + (bin->reg_size * regind)); /* Clear bit. */ mask ^= (1U << bit); run->regs_mask[i] = mask; /* * Make a note that nothing before this element * contains a free region. */ run->regs_minelm = i; /* Low payoff: + (mask == 0); */ return (ret); } } /* Not reached. */ assert(0); return (NULL); } static inline void arena_run_reg_dalloc(arena_run_t *run, arena_bin_t *bin, void *ptr, size_t size) { unsigned diff, regind, elm, bit; assert(run->magic == ARENA_RUN_MAGIC); /* * Avoid doing division with a variable divisor if possible. Using * actual division here can reduce allocator throughput by over 20%! */ diff = (unsigned)((uintptr_t)ptr - (uintptr_t)run - bin->reg0_offset); if ((size & (size - 1)) == 0) { /* * log2_table allows fast division of a power of two in the * [1..128] range. * * (x / divisor) becomes (x >> log2_table[divisor - 1]). */ static const unsigned char log2_table[] = { 0, 1, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 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, 6, 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, 7 }; if (size <= 128) regind = (diff >> log2_table[size - 1]); else if (size <= 32768) regind = diff >> (8 + log2_table[(size >> 8) - 1]); else regind = diff / size; } else if (size < qspace_max) { /* * To divide by a number D that is not a power of two we * multiply by (2^21 / D) and then right shift by 21 positions. * * X / D * * becomes * * (X * qsize_invs[(D >> QUANTUM_2POW) - 3]) * >> SIZE_INV_SHIFT * * We can omit the first three elements, because we never * divide by 0, and QUANTUM and 2*QUANTUM are both powers of * two, which are handled above. */ #define SIZE_INV_SHIFT 21 #define QSIZE_INV(s) (((1U << SIZE_INV_SHIFT) / (s << QUANTUM_2POW)) + 1) static const unsigned qsize_invs[] = { QSIZE_INV(3), QSIZE_INV(4), QSIZE_INV(5), QSIZE_INV(6), QSIZE_INV(7) #if (QUANTUM_2POW < 4) , QSIZE_INV(8), QSIZE_INV(9), QSIZE_INV(10), QSIZE_INV(11), QSIZE_INV(12),QSIZE_INV(13), QSIZE_INV(14), QSIZE_INV(15) #endif }; assert(QUANTUM * (((sizeof(qsize_invs)) / sizeof(unsigned)) + 3) >= (1U << QSPACE_MAX_2POW_DEFAULT)); if (size <= (((sizeof(qsize_invs) / sizeof(unsigned)) + 2) << QUANTUM_2POW)) { regind = qsize_invs[(size >> QUANTUM_2POW) - 3] * diff; regind >>= SIZE_INV_SHIFT; } else regind = diff / size; #undef QSIZE_INV } else if (size < cspace_max) { #define CSIZE_INV(s) (((1U << SIZE_INV_SHIFT) / (s << CACHELINE_2POW)) + 1) static const unsigned csize_invs[] = { CSIZE_INV(3), CSIZE_INV(4), CSIZE_INV(5), CSIZE_INV(6), CSIZE_INV(7) }; assert(CACHELINE * (((sizeof(csize_invs)) / sizeof(unsigned)) + 3) >= (1U << CSPACE_MAX_2POW_DEFAULT)); if (size <= (((sizeof(csize_invs) / sizeof(unsigned)) + 2) << CACHELINE_2POW)) { regind = csize_invs[(size >> CACHELINE_2POW) - 3] * diff; regind >>= SIZE_INV_SHIFT; } else regind = diff / size; #undef CSIZE_INV } else { #define SSIZE_INV(s) (((1U << SIZE_INV_SHIFT) / (s << SUBPAGE_2POW)) + 1) static const unsigned ssize_invs[] = { SSIZE_INV(3), SSIZE_INV(4), SSIZE_INV(5), SSIZE_INV(6), SSIZE_INV(7), SSIZE_INV(8), SSIZE_INV(9), SSIZE_INV(10), SSIZE_INV(11), SSIZE_INV(12), SSIZE_INV(13), SSIZE_INV(14), SSIZE_INV(15) #if (PAGESIZE_2POW == 13) , SSIZE_INV(16), SSIZE_INV(17), SSIZE_INV(18), SSIZE_INV(19), SSIZE_INV(20), SSIZE_INV(21), SSIZE_INV(22), SSIZE_INV(23), SSIZE_INV(24), SSIZE_INV(25), SSIZE_INV(26), SSIZE_INV(27), SSIZE_INV(28), SSIZE_INV(29), SSIZE_INV(29), SSIZE_INV(30) #endif }; assert(SUBPAGE * (((sizeof(ssize_invs)) / sizeof(unsigned)) + 3) >= (1U << PAGESIZE_2POW)); if (size < (((sizeof(ssize_invs) / sizeof(unsigned)) + 2) << SUBPAGE_2POW)) { regind = ssize_invs[(size >> SUBPAGE_2POW) - 3] * diff; regind >>= SIZE_INV_SHIFT; } else regind = diff / size; #undef SSIZE_INV } #undef SIZE_INV_SHIFT assert(diff == regind * size); assert(regind < bin->nregs); elm = regind >> (SIZEOF_INT_2POW + 3); if (elm < run->regs_minelm) run->regs_minelm = elm; bit = regind - (elm << (SIZEOF_INT_2POW + 3)); assert((run->regs_mask[elm] & (1U << bit)) == 0); run->regs_mask[elm] |= (1U << bit); } static void arena_run_split(arena_t *arena, arena_run_t *run, size_t size, bool large, bool zero) { arena_chunk_t *chunk; size_t old_ndirty, run_ind, total_pages, need_pages, rem_pages, i; chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(run); old_ndirty = chunk->ndirty; run_ind = (unsigned)(((uintptr_t)run - (uintptr_t)chunk) >> pagesize_2pow); total_pages = (chunk->map[run_ind].bits & ~pagesize_mask) >> pagesize_2pow; need_pages = (size >> pagesize_2pow); assert(need_pages > 0); assert(need_pages <= total_pages); rem_pages = total_pages - need_pages; arena_avail_tree_remove(&arena->runs_avail, &chunk->map[run_ind]); /* Keep track of trailing unused pages for later use. */ if (rem_pages > 0) { chunk->map[run_ind+need_pages].bits = (rem_pages << pagesize_2pow) | (chunk->map[run_ind+need_pages].bits & pagesize_mask); chunk->map[run_ind+total_pages-1].bits = (rem_pages << pagesize_2pow) | (chunk->map[run_ind+total_pages-1].bits & pagesize_mask); arena_avail_tree_insert(&arena->runs_avail, &chunk->map[run_ind+need_pages]); } for (i = 0; i < need_pages; i++) { /* Zero if necessary. */ if (zero) { if ((chunk->map[run_ind + i].bits & CHUNK_MAP_ZEROED) == 0) { memset((void *)((uintptr_t)chunk + ((run_ind + i) << pagesize_2pow)), 0, pagesize); /* CHUNK_MAP_ZEROED is cleared below. */ } } /* Update dirty page accounting. */ if (chunk->map[run_ind + i].bits & CHUNK_MAP_DIRTY) { chunk->ndirty--; arena->ndirty--; /* CHUNK_MAP_DIRTY is cleared below. */ } /* Initialize the chunk map. */ if (large) { chunk->map[run_ind + i].bits = CHUNK_MAP_LARGE | CHUNK_MAP_ALLOCATED; } else { chunk->map[run_ind + i].bits = (size_t)run | CHUNK_MAP_ALLOCATED; } } /* * Set the run size only in the first element for large runs. This is * primarily a debugging aid, since the lack of size info for trailing * pages only matters if the application tries to operate on an * interior pointer. */ if (large) chunk->map[run_ind].bits |= size; if (chunk->ndirty == 0 && old_ndirty > 0) arena_chunk_tree_dirty_remove(&arena->chunks_dirty, chunk); } static arena_chunk_t * arena_chunk_alloc(arena_t *arena) { arena_chunk_t *chunk; size_t i; if (arena->spare != NULL) { chunk = arena->spare; arena->spare = NULL; } else { chunk = (arena_chunk_t *)chunk_alloc(chunksize, true); if (chunk == NULL) return (NULL); #ifdef MALLOC_STATS arena->stats.mapped += chunksize; #endif chunk->arena = arena; /* * Claim that no pages are in use, since the header is merely * overhead. */ chunk->ndirty = 0; /* * Initialize the map to contain one maximal free untouched run. */ for (i = 0; i < arena_chunk_header_npages; i++) chunk->map[i].bits = 0; chunk->map[i].bits = arena_maxclass | CHUNK_MAP_ZEROED; for (i++; i < chunk_npages-1; i++) { chunk->map[i].bits = CHUNK_MAP_ZEROED; } chunk->map[chunk_npages-1].bits = arena_maxclass | CHUNK_MAP_ZEROED; } /* Insert the run into the runs_avail tree. */ arena_avail_tree_insert(&arena->runs_avail, &chunk->map[arena_chunk_header_npages]); return (chunk); } static void arena_chunk_dealloc(arena_t *arena, arena_chunk_t *chunk) { if (arena->spare != NULL) { if (arena->spare->ndirty > 0) { arena_chunk_tree_dirty_remove( &chunk->arena->chunks_dirty, arena->spare); arena->ndirty -= arena->spare->ndirty; } chunk_dealloc((void *)arena->spare, chunksize); #ifdef MALLOC_STATS arena->stats.mapped -= chunksize; #endif } /* * Remove run from runs_avail, regardless of whether this chunk * will be cached, so that the arena does not use it. Dirty page * flushing only uses the chunks_dirty tree, so leaving this chunk in * the chunks_* trees is sufficient for that purpose. */ arena_avail_tree_remove(&arena->runs_avail, &chunk->map[arena_chunk_header_npages]); arena->spare = chunk; } static arena_run_t * arena_run_alloc(arena_t *arena, size_t size, bool large, bool zero) { arena_chunk_t *chunk; arena_run_t *run; arena_chunk_map_t *mapelm, key; assert(size <= arena_maxclass); assert((size & pagesize_mask) == 0); /* Search the arena's chunks for the lowest best fit. */ key.bits = size | CHUNK_MAP_KEY; mapelm = arena_avail_tree_nsearch(&arena->runs_avail, &key); if (mapelm != NULL) { arena_chunk_t *run_chunk = CHUNK_ADDR2BASE(mapelm); size_t pageind = ((uintptr_t)mapelm - (uintptr_t)run_chunk->map) / sizeof(arena_chunk_map_t); run = (arena_run_t *)((uintptr_t)run_chunk + (pageind << pagesize_2pow)); arena_run_split(arena, run, size, large, zero); return (run); } /* * No usable runs. Create a new chunk from which to allocate the run. */ chunk = arena_chunk_alloc(arena); if (chunk == NULL) return (NULL); run = (arena_run_t *)((uintptr_t)chunk + (arena_chunk_header_npages << pagesize_2pow)); /* Update page map. */ arena_run_split(arena, run, size, large, zero); return (run); } static void arena_purge(arena_t *arena) { arena_chunk_t *chunk; size_t i, npages; #ifdef MALLOC_DEBUG size_t ndirty = 0; rb_foreach_begin(arena_chunk_t, link_dirty, &arena->chunks_dirty, chunk) { ndirty += chunk->ndirty; } rb_foreach_end(arena_chunk_t, link_dirty, &arena->chunks_dirty, chunk) assert(ndirty == arena->ndirty); #endif assert(arena->ndirty > opt_dirty_max); #ifdef MALLOC_STATS arena->stats.npurge++; #endif /* * Iterate downward through chunks until enough dirty memory has been * purged. Terminate as soon as possible in order to minimize the * number of system calls, even if a chunk has only been partially * purged. */ while (arena->ndirty > (opt_dirty_max >> 1)) { chunk = arena_chunk_tree_dirty_last(&arena->chunks_dirty); assert(chunk != NULL); for (i = chunk_npages - 1; chunk->ndirty > 0; i--) { assert(i >= arena_chunk_header_npages); if (chunk->map[i].bits & CHUNK_MAP_DIRTY) { chunk->map[i].bits ^= CHUNK_MAP_DIRTY; /* Find adjacent dirty run(s). */ for (npages = 1; i > arena_chunk_header_npages && (chunk->map[i - 1].bits & CHUNK_MAP_DIRTY); npages++) { i--; chunk->map[i].bits ^= CHUNK_MAP_DIRTY; } chunk->ndirty -= npages; arena->ndirty -= npages; madvise((void *)((uintptr_t)chunk + (i << pagesize_2pow)), (npages << pagesize_2pow), MADV_FREE); #ifdef MALLOC_STATS arena->stats.nmadvise++; arena->stats.purged += npages; #endif if (arena->ndirty <= (opt_dirty_max >> 1)) break; } } if (chunk->ndirty == 0) { arena_chunk_tree_dirty_remove(&arena->chunks_dirty, chunk); } } } static void arena_run_dalloc(arena_t *arena, arena_run_t *run, bool dirty) { arena_chunk_t *chunk; size_t size, run_ind, run_pages; chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(run); run_ind = (size_t)(((uintptr_t)run - (uintptr_t)chunk) >> pagesize_2pow); assert(run_ind >= arena_chunk_header_npages); assert(run_ind < chunk_npages); if ((chunk->map[run_ind].bits & CHUNK_MAP_LARGE) != 0) size = chunk->map[run_ind].bits & ~pagesize_mask; else size = run->bin->run_size; run_pages = (size >> pagesize_2pow); /* Mark pages as unallocated in the chunk map. */ if (dirty) { size_t i; for (i = 0; i < run_pages; i++) { assert((chunk->map[run_ind + i].bits & CHUNK_MAP_DIRTY) == 0); chunk->map[run_ind + i].bits = CHUNK_MAP_DIRTY; } if (chunk->ndirty == 0) { arena_chunk_tree_dirty_insert(&arena->chunks_dirty, chunk); } chunk->ndirty += run_pages; arena->ndirty += run_pages; } else { size_t i; for (i = 0; i < run_pages; i++) { chunk->map[run_ind + i].bits &= ~(CHUNK_MAP_LARGE | CHUNK_MAP_ALLOCATED); } } chunk->map[run_ind].bits = size | (chunk->map[run_ind].bits & pagesize_mask); chunk->map[run_ind+run_pages-1].bits = size | (chunk->map[run_ind+run_pages-1].bits & pagesize_mask); /* Try to coalesce forward. */ if (run_ind + run_pages < chunk_npages && (chunk->map[run_ind+run_pages].bits & CHUNK_MAP_ALLOCATED) == 0) { size_t nrun_size = chunk->map[run_ind+run_pages].bits & ~pagesize_mask; /* * Remove successor from runs_avail; the coalesced run is * inserted later. */ arena_avail_tree_remove(&arena->runs_avail, &chunk->map[run_ind+run_pages]); size += nrun_size; run_pages = size >> pagesize_2pow; assert((chunk->map[run_ind+run_pages-1].bits & ~pagesize_mask) == nrun_size); chunk->map[run_ind].bits = size | (chunk->map[run_ind].bits & pagesize_mask); chunk->map[run_ind+run_pages-1].bits = size | (chunk->map[run_ind+run_pages-1].bits & pagesize_mask); } /* Try to coalesce backward. */ if (run_ind > arena_chunk_header_npages && (chunk->map[run_ind-1].bits & CHUNK_MAP_ALLOCATED) == 0) { size_t prun_size = chunk->map[run_ind-1].bits & ~pagesize_mask; run_ind -= prun_size >> pagesize_2pow; /* * Remove predecessor from runs_avail; the coalesced run is * inserted later. */ arena_avail_tree_remove(&arena->runs_avail, &chunk->map[run_ind]); size += prun_size; run_pages = size >> pagesize_2pow; assert((chunk->map[run_ind].bits & ~pagesize_mask) == prun_size); chunk->map[run_ind].bits = size | (chunk->map[run_ind].bits & pagesize_mask); chunk->map[run_ind+run_pages-1].bits = size | (chunk->map[run_ind+run_pages-1].bits & pagesize_mask); } /* Insert into runs_avail, now that coalescing is complete. */ arena_avail_tree_insert(&arena->runs_avail, &chunk->map[run_ind]); /* Deallocate chunk if it is now completely unused. */ if ((chunk->map[arena_chunk_header_npages].bits & (~pagesize_mask | CHUNK_MAP_ALLOCATED)) == arena_maxclass) arena_chunk_dealloc(arena, chunk); /* Enforce opt_dirty_max. */ if (arena->ndirty > opt_dirty_max) arena_purge(arena); } static void arena_run_trim_head(arena_t *arena, arena_chunk_t *chunk, arena_run_t *run, size_t oldsize, size_t newsize) { size_t pageind = ((uintptr_t)run - (uintptr_t)chunk) >> pagesize_2pow; size_t head_npages = (oldsize - newsize) >> pagesize_2pow; assert(oldsize > newsize); /* * Update the chunk map so that arena_run_dalloc() can treat the * leading run as separately allocated. */ chunk->map[pageind].bits = (oldsize - newsize) | CHUNK_MAP_LARGE | CHUNK_MAP_ALLOCATED; chunk->map[pageind+head_npages].bits = newsize | CHUNK_MAP_LARGE | CHUNK_MAP_ALLOCATED; arena_run_dalloc(arena, run, false); } static void arena_run_trim_tail(arena_t *arena, arena_chunk_t *chunk, arena_run_t *run, size_t oldsize, size_t newsize, bool dirty) { size_t pageind = ((uintptr_t)run - (uintptr_t)chunk) >> pagesize_2pow; size_t npages = newsize >> pagesize_2pow; assert(oldsize > newsize); /* * Update the chunk map so that arena_run_dalloc() can treat the * trailing run as separately allocated. */ chunk->map[pageind].bits = newsize | CHUNK_MAP_LARGE | CHUNK_MAP_ALLOCATED; chunk->map[pageind+npages].bits = (oldsize - newsize) | CHUNK_MAP_LARGE | CHUNK_MAP_ALLOCATED; arena_run_dalloc(arena, (arena_run_t *)((uintptr_t)run + newsize), dirty); } static arena_run_t * arena_bin_nonfull_run_get(arena_t *arena, arena_bin_t *bin) { arena_chunk_map_t *mapelm; arena_run_t *run; unsigned i, remainder; /* Look for a usable run. */ mapelm = arena_run_tree_first(&bin->runs); if (mapelm != NULL) { /* run is guaranteed to have available space. */ arena_run_tree_remove(&bin->runs, mapelm); run = (arena_run_t *)(mapelm->bits & ~pagesize_mask); #ifdef MALLOC_STATS bin->stats.reruns++; #endif return (run); } /* No existing runs have any space available. */ /* Allocate a new run. */ run = arena_run_alloc(arena, bin->run_size, false, false); if (run == NULL) return (NULL); /* Initialize run internals. */ run->bin = bin; for (i = 0; i < bin->regs_mask_nelms - 1; i++) run->regs_mask[i] = UINT_MAX; remainder = bin->nregs & ((1U << (SIZEOF_INT_2POW + 3)) - 1); if (remainder == 0) run->regs_mask[i] = UINT_MAX; else { /* The last element has spare bits that need to be unset. */ run->regs_mask[i] = (UINT_MAX >> ((1U << (SIZEOF_INT_2POW + 3)) - remainder)); } run->regs_minelm = 0; run->nfree = bin->nregs; #ifdef MALLOC_DEBUG run->magic = ARENA_RUN_MAGIC; #endif #ifdef MALLOC_STATS bin->stats.nruns++; bin->stats.curruns++; if (bin->stats.curruns > bin->stats.highruns) bin->stats.highruns = bin->stats.curruns; #endif return (run); } /* bin->runcur must have space available before this function is called. */ static inline void * arena_bin_malloc_easy(arena_t *arena, arena_bin_t *bin, arena_run_t *run) { void *ret; assert(run->magic == ARENA_RUN_MAGIC); assert(run->nfree > 0); ret = arena_run_reg_alloc(run, bin); assert(ret != NULL); run->nfree--; return (ret); } /* Re-fill bin->runcur, then call arena_bin_malloc_easy(). */ static void * arena_bin_malloc_hard(arena_t *arena, arena_bin_t *bin) { bin->runcur = arena_bin_nonfull_run_get(arena, bin); if (bin->runcur == NULL) return (NULL); assert(bin->runcur->magic == ARENA_RUN_MAGIC); assert(bin->runcur->nfree > 0); return (arena_bin_malloc_easy(arena, bin, bin->runcur)); } /* * Calculate bin->run_size such that it meets the following constraints: * * *) bin->run_size >= min_run_size * *) bin->run_size <= arena_maxclass * *) bin->run_size <= RUN_MAX_SMALL * *) run header overhead <= RUN_MAX_OVRHD (or header overhead relaxed). * * bin->nregs, bin->regs_mask_nelms, and bin->reg0_offset are * also calculated here, since these settings are all interdependent. */ static size_t arena_bin_run_size_calc(arena_bin_t *bin, size_t min_run_size) { size_t try_run_size, good_run_size; unsigned good_nregs, good_mask_nelms, good_reg0_offset; unsigned try_nregs, try_mask_nelms, try_reg0_offset; assert(min_run_size >= pagesize); assert(min_run_size <= arena_maxclass); assert(min_run_size <= RUN_MAX_SMALL); /* * Calculate known-valid settings before entering the run_size * expansion loop, so that the first part of the loop always copies * valid settings. * * The do..while loop iteratively reduces the number of regions until * the run header and the regions no longer overlap. A closed formula * would be quite messy, since there is an interdependency between the * header's mask length and the number of regions. */ try_run_size = min_run_size; try_nregs = ((try_run_size - sizeof(arena_run_t)) / bin->reg_size) + 1; /* Counter-act try_nregs-- in loop. */ do { try_nregs--; try_mask_nelms = (try_nregs >> (SIZEOF_INT_2POW + 3)) + ((try_nregs & ((1U << (SIZEOF_INT_2POW + 3)) - 1)) ? 1 : 0); try_reg0_offset = try_run_size - (try_nregs * bin->reg_size); } while (sizeof(arena_run_t) + (sizeof(unsigned) * (try_mask_nelms - 1)) > try_reg0_offset); /* run_size expansion loop. */ do { /* * Copy valid settings before trying more aggressive settings. */ good_run_size = try_run_size; good_nregs = try_nregs; good_mask_nelms = try_mask_nelms; good_reg0_offset = try_reg0_offset; /* Try more aggressive settings. */ try_run_size += pagesize; try_nregs = ((try_run_size - sizeof(arena_run_t)) / bin->reg_size) + 1; /* Counter-act try_nregs-- in loop. */ do { try_nregs--; try_mask_nelms = (try_nregs >> (SIZEOF_INT_2POW + 3)) + ((try_nregs & ((1U << (SIZEOF_INT_2POW + 3)) - 1)) ? 1 : 0); try_reg0_offset = try_run_size - (try_nregs * bin->reg_size); } while (sizeof(arena_run_t) + (sizeof(unsigned) * (try_mask_nelms - 1)) > try_reg0_offset); } while (try_run_size <= arena_maxclass && try_run_size <= RUN_MAX_SMALL && RUN_MAX_OVRHD * (bin->reg_size << 3) > RUN_MAX_OVRHD_RELAX && (try_reg0_offset << RUN_BFP) > RUN_MAX_OVRHD * try_run_size); assert(sizeof(arena_run_t) + (sizeof(unsigned) * (good_mask_nelms - 1)) <= good_reg0_offset); assert((good_mask_nelms << (SIZEOF_INT_2POW + 3)) >= good_nregs); /* Copy final settings. */ bin->run_size = good_run_size; bin->nregs = good_nregs; bin->regs_mask_nelms = good_mask_nelms; bin->reg0_offset = good_reg0_offset; return (good_run_size); } #ifdef MALLOC_BALANCE static inline void arena_lock_balance(arena_t *arena) { unsigned contention; contention = malloc_spin_lock(&arena->lock); if (narenas > 1) { /* * Calculate the exponentially averaged contention for this * arena. Due to integer math always rounding down, this value * decays somewhat faster than normal. */ arena->contention = (((uint64_t)arena->contention * (uint64_t)((1U << BALANCE_ALPHA_INV_2POW)-1)) + (uint64_t)contention) >> BALANCE_ALPHA_INV_2POW; if (arena->contention >= opt_balance_threshold) arena_lock_balance_hard(arena); } } static void arena_lock_balance_hard(arena_t *arena) { uint32_t ind; arena->contention = 0; #ifdef MALLOC_STATS arena->stats.nbalance++; #endif ind = PRN(balance, narenas_2pow); if (arenas[ind] != NULL) arenas_map = arenas[ind]; else { malloc_spin_lock(&arenas_lock); if (arenas[ind] != NULL) arenas_map = arenas[ind]; else arenas_map = arenas_extend(ind); malloc_spin_unlock(&arenas_lock); } } #endif #ifdef MALLOC_MAG static inline void * mag_alloc(mag_t *mag) { if (mag->nrounds == 0) return (NULL); mag->nrounds--; return (mag->rounds[mag->nrounds]); } static void mag_load(mag_t *mag) { arena_t *arena; arena_bin_t *bin; arena_run_t *run; void *round; size_t i; arena = choose_arena(); bin = &arena->bins[mag->binind]; #ifdef MALLOC_BALANCE arena_lock_balance(arena); #else malloc_spin_lock(&arena->lock); #endif for (i = mag->nrounds; i < max_rounds; i++) { if ((run = bin->runcur) != NULL && run->nfree > 0) round = arena_bin_malloc_easy(arena, bin, run); else round = arena_bin_malloc_hard(arena, bin); if (round == NULL) break; mag->rounds[i] = round; } #ifdef MALLOC_STATS bin->stats.nmags++; arena->stats.nmalloc_small += (i - mag->nrounds); arena->stats.allocated_small += (i - mag->nrounds) * bin->reg_size; #endif malloc_spin_unlock(&arena->lock); mag->nrounds = i; } static inline void * mag_rack_alloc(mag_rack_t *rack, size_t size, bool zero) { void *ret; bin_mags_t *bin_mags; mag_t *mag; size_t binind; binind = size2bin[size]; assert(binind < nbins); bin_mags = &rack->bin_mags[binind]; mag = bin_mags->curmag; if (mag == NULL) { /* Create an initial magazine for this size class. */ assert(bin_mags->sparemag == NULL); mag = mag_create(choose_arena(), binind); if (mag == NULL) return (NULL); bin_mags->curmag = mag; mag_load(mag); } ret = mag_alloc(mag); if (ret == NULL) { if (bin_mags->sparemag != NULL) { if (bin_mags->sparemag->nrounds > 0) { /* Swap magazines. */ bin_mags->curmag = bin_mags->sparemag; bin_mags->sparemag = mag; mag = bin_mags->curmag; } else { /* Reload the current magazine. */ mag_load(mag); } } else { /* Create a second magazine. */ mag = mag_create(choose_arena(), binind); if (mag == NULL) return (NULL); mag_load(mag); bin_mags->sparemag = bin_mags->curmag; bin_mags->curmag = mag; } ret = mag_alloc(mag); if (ret == NULL) return (NULL); } if (zero == false) { if (opt_junk) memset(ret, 0xa5, size); else if (opt_zero) memset(ret, 0, size); } else memset(ret, 0, size); return (ret); } #endif static inline void * arena_malloc_small(arena_t *arena, size_t size, bool zero) { void *ret; arena_bin_t *bin; arena_run_t *run; size_t binind; binind = size2bin[size]; assert(binind < nbins); bin = &arena->bins[binind]; size = bin->reg_size; #ifdef MALLOC_BALANCE arena_lock_balance(arena); #else malloc_spin_lock(&arena->lock); #endif if ((run = bin->runcur) != NULL && run->nfree > 0) ret = arena_bin_malloc_easy(arena, bin, run); else ret = arena_bin_malloc_hard(arena, bin); if (ret == NULL) { malloc_spin_unlock(&arena->lock); return (NULL); } #ifdef MALLOC_STATS bin->stats.nrequests++; arena->stats.nmalloc_small++; arena->stats.allocated_small += size; #endif malloc_spin_unlock(&arena->lock); if (zero == false) { if (opt_junk) memset(ret, 0xa5, size); else if (opt_zero) memset(ret, 0, size); } else memset(ret, 0, size); return (ret); } static void * arena_malloc_large(arena_t *arena, size_t size, bool zero) { void *ret; /* Large allocation. */ size = PAGE_CEILING(size); #ifdef MALLOC_BALANCE arena_lock_balance(arena); #else malloc_spin_lock(&arena->lock); #endif ret = (void *)arena_run_alloc(arena, size, true, zero); if (ret == NULL) { malloc_spin_unlock(&arena->lock); return (NULL); } #ifdef MALLOC_STATS arena->stats.nmalloc_large++; arena->stats.allocated_large += size; #endif malloc_spin_unlock(&arena->lock); if (zero == false) { if (opt_junk) memset(ret, 0xa5, size); else if (opt_zero) memset(ret, 0, size); } return (ret); } static inline void * arena_malloc(arena_t *arena, size_t size, bool zero) { assert(arena != NULL); assert(arena->magic == ARENA_MAGIC); assert(size != 0); assert(QUANTUM_CEILING(size) <= arena_maxclass); if (size <= bin_maxclass) { #ifdef MALLOC_MAG if (__isthreaded && opt_mag) { mag_rack_t *rack = mag_rack; if (rack == NULL) { rack = mag_rack_create(arena); if (rack == NULL) return (NULL); mag_rack = rack; } return (mag_rack_alloc(rack, size, zero)); } else #endif return (arena_malloc_small(arena, size, zero)); } else return (arena_malloc_large(arena, size, zero)); } static inline void * imalloc(size_t size) { assert(size != 0); if (size <= arena_maxclass) return (arena_malloc(choose_arena(), size, false)); else return (huge_malloc(size, false)); } static inline void * icalloc(size_t size) { if (size <= arena_maxclass) return (arena_malloc(choose_arena(), size, true)); else return (huge_malloc(size, true)); } /* Only handles large allocations that require more than page alignment. */ static void * arena_palloc(arena_t *arena, size_t alignment, size_t size, size_t alloc_size) { void *ret; size_t offset; arena_chunk_t *chunk; assert((size & pagesize_mask) == 0); assert((alignment & pagesize_mask) == 0); #ifdef MALLOC_BALANCE arena_lock_balance(arena); #else malloc_spin_lock(&arena->lock); #endif ret = (void *)arena_run_alloc(arena, alloc_size, true, false); if (ret == NULL) { malloc_spin_unlock(&arena->lock); return (NULL); } chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ret); offset = (uintptr_t)ret & (alignment - 1); assert((offset & pagesize_mask) == 0); assert(offset < alloc_size); if (offset == 0) arena_run_trim_tail(arena, chunk, ret, alloc_size, size, false); else { size_t leadsize, trailsize; leadsize = alignment - offset; if (leadsize > 0) { arena_run_trim_head(arena, chunk, ret, alloc_size, alloc_size - leadsize); ret = (void *)((uintptr_t)ret + leadsize); } trailsize = alloc_size - leadsize - size; if (trailsize != 0) { /* Trim trailing space. */ assert(trailsize < alloc_size); arena_run_trim_tail(arena, chunk, ret, size + trailsize, size, false); } } #ifdef MALLOC_STATS arena->stats.nmalloc_large++; arena->stats.allocated_large += size; #endif malloc_spin_unlock(&arena->lock); if (opt_junk) memset(ret, 0xa5, size); else if (opt_zero) memset(ret, 0, size); return (ret); } static inline void * ipalloc(size_t alignment, size_t size) { void *ret; size_t ceil_size; /* * Round size up to the nearest multiple of alignment. * * This done, we can take advantage of the fact that for each small * size class, every object is aligned at the smallest power of two * that is non-zero in the base two representation of the size. For * example: * * Size | Base 2 | Minimum alignment * -----+----------+------------------ * 96 | 1100000 | 32 * 144 | 10100000 | 32 * 192 | 11000000 | 64 * * Depending on runtime settings, it is possible that arena_malloc() * will further round up to a power of two, but that never causes * correctness issues. */ ceil_size = (size + (alignment - 1)) & (-alignment); /* * (ceil_size < size) protects against the combination of maximal * alignment and size greater than maximal alignment. */ if (ceil_size < size) { /* size_t overflow. */ return (NULL); } if (ceil_size <= pagesize || (alignment <= pagesize && ceil_size <= arena_maxclass)) ret = arena_malloc(choose_arena(), ceil_size, false); else { size_t run_size; /* * We can't achieve subpage alignment, so round up alignment * permanently; it makes later calculations simpler. */ alignment = PAGE_CEILING(alignment); ceil_size = PAGE_CEILING(size); /* * (ceil_size < size) protects against very large sizes within * pagesize of SIZE_T_MAX. * * (ceil_size + alignment < ceil_size) protects against the * combination of maximal alignment and ceil_size large enough * to cause overflow. This is similar to the first overflow * check above, but it needs to be repeated due to the new * ceil_size value, which may now be *equal* to maximal * alignment, whereas before we only detected overflow if the * original size was *greater* than maximal alignment. */ if (ceil_size < size || ceil_size + alignment < ceil_size) { /* size_t overflow. */ return (NULL); } /* * Calculate the size of the over-size run that arena_palloc() * would need to allocate in order to guarantee the alignment. */ if (ceil_size >= alignment) run_size = ceil_size + alignment - pagesize; else { /* * It is possible that (alignment << 1) will cause * overflow, but it doesn't matter because we also * subtract pagesize, which in the case of overflow * leaves us with a very large run_size. That causes * the first conditional below to fail, which means * that the bogus run_size value never gets used for * anything important. */ run_size = (alignment << 1) - pagesize; } if (run_size <= arena_maxclass) { ret = arena_palloc(choose_arena(), alignment, ceil_size, run_size); } else if (alignment <= chunksize) ret = huge_malloc(ceil_size, false); else ret = huge_palloc(alignment, ceil_size); } assert(((uintptr_t)ret & (alignment - 1)) == 0); return (ret); } /* Return the size of the allocation pointed to by ptr. */ static size_t arena_salloc(const void *ptr) { size_t ret; arena_chunk_t *chunk; size_t pageind, mapbits; assert(ptr != NULL); assert(CHUNK_ADDR2BASE(ptr) != ptr); chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); pageind = (((uintptr_t)ptr - (uintptr_t)chunk) >> pagesize_2pow); mapbits = chunk->map[pageind].bits; assert((mapbits & CHUNK_MAP_ALLOCATED) != 0); if ((mapbits & CHUNK_MAP_LARGE) == 0) { arena_run_t *run = (arena_run_t *)(mapbits & ~pagesize_mask); assert(run->magic == ARENA_RUN_MAGIC); ret = run->bin->reg_size; } else { ret = mapbits & ~pagesize_mask; assert(ret != 0); } return (ret); } static inline size_t isalloc(const void *ptr) { size_t ret; arena_chunk_t *chunk; assert(ptr != NULL); chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); if (chunk != ptr) { /* Region. */ assert(chunk->arena->magic == ARENA_MAGIC); ret = arena_salloc(ptr); } else { extent_node_t *node, key; /* Chunk (huge allocation). */ malloc_mutex_lock(&huge_mtx); /* Extract from tree of huge allocations. */ key.addr = __DECONST(void *, ptr); node = extent_tree_ad_search(&huge, &key); assert(node != NULL); ret = node->size; malloc_mutex_unlock(&huge_mtx); } return (ret); } static inline void arena_dalloc_small(arena_t *arena, arena_chunk_t *chunk, void *ptr, arena_chunk_map_t *mapelm) { arena_run_t *run; arena_bin_t *bin; size_t size; run = (arena_run_t *)(mapelm->bits & ~pagesize_mask); assert(run->magic == ARENA_RUN_MAGIC); bin = run->bin; size = bin->reg_size; if (opt_junk) memset(ptr, 0x5a, size); arena_run_reg_dalloc(run, bin, ptr, size); run->nfree++; if (run->nfree == bin->nregs) { /* Deallocate run. */ if (run == bin->runcur) bin->runcur = NULL; else if (bin->nregs != 1) { size_t run_pageind = (((uintptr_t)run - (uintptr_t)chunk)) >> pagesize_2pow; arena_chunk_map_t *run_mapelm = &chunk->map[run_pageind]; /* * This block's conditional is necessary because if the * run only contains one region, then it never gets * inserted into the non-full runs tree. */ arena_run_tree_remove(&bin->runs, run_mapelm); } #ifdef MALLOC_DEBUG run->magic = 0; #endif arena_run_dalloc(arena, run, true); #ifdef MALLOC_STATS bin->stats.curruns--; #endif } else if (run->nfree == 1 && run != bin->runcur) { /* * Make sure that bin->runcur always refers to the lowest * non-full run, if one exists. */ if (bin->runcur == NULL) bin->runcur = run; else if ((uintptr_t)run < (uintptr_t)bin->runcur) { /* Switch runcur. */ if (bin->runcur->nfree > 0) { arena_chunk_t *runcur_chunk = CHUNK_ADDR2BASE(bin->runcur); size_t runcur_pageind = (((uintptr_t)bin->runcur - (uintptr_t)runcur_chunk)) >> pagesize_2pow; arena_chunk_map_t *runcur_mapelm = &runcur_chunk->map[runcur_pageind]; /* Insert runcur. */ arena_run_tree_insert(&bin->runs, runcur_mapelm); } bin->runcur = run; } else { size_t run_pageind = (((uintptr_t)run - (uintptr_t)chunk)) >> pagesize_2pow; arena_chunk_map_t *run_mapelm = &chunk->map[run_pageind]; assert(arena_run_tree_search(&bin->runs, run_mapelm) == NULL); arena_run_tree_insert(&bin->runs, run_mapelm); } } #ifdef MALLOC_STATS arena->stats.allocated_small -= size; arena->stats.ndalloc_small++; #endif } #ifdef MALLOC_MAG static void mag_unload(mag_t *mag) { arena_chunk_t *chunk; arena_t *arena; void *round; size_t i, ndeferred, nrounds; for (ndeferred = mag->nrounds; ndeferred > 0;) { nrounds = ndeferred; /* Lock the arena associated with the first round. */ chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(mag->rounds[0]); arena = chunk->arena; #ifdef MALLOC_BALANCE arena_lock_balance(arena); #else malloc_spin_lock(&arena->lock); #endif /* Deallocate every round that belongs to the locked arena. */ for (i = ndeferred = 0; i < nrounds; i++) { round = mag->rounds[i]; chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(round); if (chunk->arena == arena) { size_t pageind = (((uintptr_t)round - (uintptr_t)chunk) >> pagesize_2pow); arena_chunk_map_t *mapelm = &chunk->map[pageind]; arena_dalloc_small(arena, chunk, round, mapelm); } else { /* * This round was allocated via a different * arena than the one that is currently locked. * Stash the round, so that it can be handled * in a future pass. */ mag->rounds[ndeferred] = round; ndeferred++; } } malloc_spin_unlock(&arena->lock); } mag->nrounds = 0; } static inline void mag_rack_dalloc(mag_rack_t *rack, void *ptr) { arena_t *arena; arena_chunk_t *chunk; arena_run_t *run; arena_bin_t *bin; bin_mags_t *bin_mags; mag_t *mag; size_t pageind, binind; arena_chunk_map_t *mapelm; chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); arena = chunk->arena; pageind = (((uintptr_t)ptr - (uintptr_t)chunk) >> pagesize_2pow); mapelm = &chunk->map[pageind]; run = (arena_run_t *)(mapelm->bits & ~pagesize_mask); assert(run->magic == ARENA_RUN_MAGIC); bin = run->bin; binind = ((uintptr_t)bin - (uintptr_t)&arena->bins) / sizeof(arena_bin_t); assert(binind < nbins); if (opt_junk) memset(ptr, 0x5a, arena->bins[binind].reg_size); bin_mags = &rack->bin_mags[binind]; mag = bin_mags->curmag; if (mag == NULL) { /* Create an initial magazine for this size class. */ assert(bin_mags->sparemag == NULL); mag = mag_create(choose_arena(), binind); if (mag == NULL) { malloc_spin_lock(&arena->lock); arena_dalloc_small(arena, chunk, ptr, mapelm); malloc_spin_unlock(&arena->lock); return; } bin_mags->curmag = mag; } if (mag->nrounds == max_rounds) { if (bin_mags->sparemag != NULL) { if (bin_mags->sparemag->nrounds < max_rounds) { /* Swap magazines. */ bin_mags->curmag = bin_mags->sparemag; bin_mags->sparemag = mag; mag = bin_mags->curmag; } else { /* Unload the current magazine. */ mag_unload(mag); } } else { /* Create a second magazine. */ mag = mag_create(choose_arena(), binind); if (mag == NULL) { mag = rack->bin_mags[binind].curmag; mag_unload(mag); } else { bin_mags->sparemag = bin_mags->curmag; bin_mags->curmag = mag; } } assert(mag->nrounds < max_rounds); } mag->rounds[mag->nrounds] = ptr; mag->nrounds++; } #endif static void arena_dalloc_large(arena_t *arena, arena_chunk_t *chunk, void *ptr) { /* Large allocation. */ malloc_spin_lock(&arena->lock); #ifndef MALLOC_STATS if (opt_junk) #endif { size_t pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> pagesize_2pow; size_t size = chunk->map[pageind].bits & ~pagesize_mask; #ifdef MALLOC_STATS if (opt_junk) #endif memset(ptr, 0x5a, size); #ifdef MALLOC_STATS arena->stats.allocated_large -= size; #endif } #ifdef MALLOC_STATS arena->stats.ndalloc_large++; #endif arena_run_dalloc(arena, (arena_run_t *)ptr, true); malloc_spin_unlock(&arena->lock); } static inline void arena_dalloc(arena_t *arena, arena_chunk_t *chunk, void *ptr) { size_t pageind; arena_chunk_map_t *mapelm; assert(arena != NULL); assert(arena->magic == ARENA_MAGIC); assert(chunk->arena == arena); assert(ptr != NULL); assert(CHUNK_ADDR2BASE(ptr) != ptr); pageind = (((uintptr_t)ptr - (uintptr_t)chunk) >> pagesize_2pow); mapelm = &chunk->map[pageind]; assert((mapelm->bits & CHUNK_MAP_ALLOCATED) != 0); if ((mapelm->bits & CHUNK_MAP_LARGE) == 0) { /* Small allocation. */ #ifdef MALLOC_MAG if (__isthreaded && opt_mag) { mag_rack_t *rack = mag_rack; if (rack == NULL) { rack = mag_rack_create(arena); if (rack == NULL) { malloc_spin_lock(&arena->lock); arena_dalloc_small(arena, chunk, ptr, mapelm); malloc_spin_unlock(&arena->lock); } mag_rack = rack; } mag_rack_dalloc(rack, ptr); } else { #endif malloc_spin_lock(&arena->lock); arena_dalloc_small(arena, chunk, ptr, mapelm); malloc_spin_unlock(&arena->lock); #ifdef MALLOC_MAG } #endif } else arena_dalloc_large(arena, chunk, ptr); } static inline void idalloc(void *ptr) { arena_chunk_t *chunk; assert(ptr != NULL); chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); if (chunk != ptr) arena_dalloc(chunk->arena, chunk, ptr); else huge_dalloc(ptr); } static void arena_ralloc_large_shrink(arena_t *arena, arena_chunk_t *chunk, void *ptr, size_t size, size_t oldsize) { assert(size < oldsize); /* * Shrink the run, and make trailing pages available for other * allocations. */ #ifdef MALLOC_BALANCE arena_lock_balance(arena); #else malloc_spin_lock(&arena->lock); #endif arena_run_trim_tail(arena, chunk, (arena_run_t *)ptr, oldsize, size, true); #ifdef MALLOC_STATS arena->stats.allocated_large -= oldsize - size; #endif malloc_spin_unlock(&arena->lock); } static bool arena_ralloc_large_grow(arena_t *arena, arena_chunk_t *chunk, void *ptr, size_t size, size_t oldsize) { size_t pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> pagesize_2pow; size_t npages = oldsize >> pagesize_2pow; assert(oldsize == (chunk->map[pageind].bits & ~pagesize_mask)); /* Try to extend the run. */ assert(size > oldsize); #ifdef MALLOC_BALANCE arena_lock_balance(arena); #else malloc_spin_lock(&arena->lock); #endif if (pageind + npages < chunk_npages && (chunk->map[pageind+npages].bits & CHUNK_MAP_ALLOCATED) == 0 && (chunk->map[pageind+npages].bits & ~pagesize_mask) >= size - oldsize) { /* * The next run is available and sufficiently large. Split the * following run, then merge the first part with the existing * allocation. */ arena_run_split(arena, (arena_run_t *)((uintptr_t)chunk + ((pageind+npages) << pagesize_2pow)), size - oldsize, true, false); chunk->map[pageind].bits = size | CHUNK_MAP_LARGE | CHUNK_MAP_ALLOCATED; chunk->map[pageind+npages].bits = CHUNK_MAP_LARGE | CHUNK_MAP_ALLOCATED; #ifdef MALLOC_STATS arena->stats.allocated_large += size - oldsize; #endif malloc_spin_unlock(&arena->lock); return (false); } malloc_spin_unlock(&arena->lock); return (true); } /* * Try to resize a large allocation, in order to avoid copying. This will * always fail if growing an object, and the following run is already in use. */ static bool arena_ralloc_large(void *ptr, size_t size, size_t oldsize) { size_t psize; psize = PAGE_CEILING(size); if (psize == oldsize) { /* Same size class. */ if (opt_junk && size < oldsize) { memset((void *)((uintptr_t)ptr + size), 0x5a, oldsize - size); } return (false); } else { arena_chunk_t *chunk; arena_t *arena; chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); arena = chunk->arena; assert(arena->magic == ARENA_MAGIC); if (psize < oldsize) { /* Fill before shrinking in order avoid a race. */ if (opt_junk) { memset((void *)((uintptr_t)ptr + size), 0x5a, oldsize - size); } arena_ralloc_large_shrink(arena, chunk, ptr, psize, oldsize); return (false); } else { bool ret = arena_ralloc_large_grow(arena, chunk, ptr, psize, oldsize); if (ret == false && opt_zero) { memset((void *)((uintptr_t)ptr + oldsize), 0, size - oldsize); } return (ret); } } } static void * arena_ralloc(void *ptr, size_t size, size_t oldsize) { void *ret; size_t copysize; /* Try to avoid moving the allocation. */ if (size <= bin_maxclass) { if (oldsize <= bin_maxclass && size2bin[size] == size2bin[oldsize]) goto IN_PLACE; } else { if (oldsize > bin_maxclass && oldsize <= arena_maxclass) { assert(size > bin_maxclass); if (arena_ralloc_large(ptr, size, oldsize) == false) return (ptr); } } /* * If we get here, then size and oldsize are different enough that we * need to move the object. In that case, fall back to allocating new * space and copying. */ ret = arena_malloc(choose_arena(), size, false); if (ret == NULL) return (NULL); /* Junk/zero-filling were already done by arena_malloc(). */ copysize = (size < oldsize) ? size : oldsize; memcpy(ret, ptr, copysize); idalloc(ptr); return (ret); IN_PLACE: if (opt_junk && size < oldsize) memset((void *)((uintptr_t)ptr + size), 0x5a, oldsize - size); else if (opt_zero && size > oldsize) memset((void *)((uintptr_t)ptr + oldsize), 0, size - oldsize); return (ptr); } static inline void * iralloc(void *ptr, size_t size) { size_t oldsize; assert(ptr != NULL); assert(size != 0); oldsize = isalloc(ptr); if (size <= arena_maxclass) return (arena_ralloc(ptr, size, oldsize)); else return (huge_ralloc(ptr, size, oldsize)); } static bool arena_new(arena_t *arena) { unsigned i; arena_bin_t *bin; size_t prev_run_size; if (malloc_spin_init(&arena->lock)) return (true); #ifdef MALLOC_STATS memset(&arena->stats, 0, sizeof(arena_stats_t)); #endif /* Initialize chunks. */ arena_chunk_tree_dirty_new(&arena->chunks_dirty); arena->spare = NULL; arena->ndirty = 0; arena_avail_tree_new(&arena->runs_avail); #ifdef MALLOC_BALANCE arena->contention = 0; #endif /* Initialize bins. */ prev_run_size = pagesize; i = 0; #ifdef MALLOC_TINY /* (2^n)-spaced tiny bins. */ for (; i < ntbins; i++) { bin = &arena->bins[i]; bin->runcur = NULL; arena_run_tree_new(&bin->runs); bin->reg_size = (1U << (TINY_MIN_2POW + i)); prev_run_size = arena_bin_run_size_calc(bin, prev_run_size); #ifdef MALLOC_STATS memset(&bin->stats, 0, sizeof(malloc_bin_stats_t)); #endif } #endif /* Quantum-spaced bins. */ for (; i < ntbins + nqbins; i++) { bin = &arena->bins[i]; bin->runcur = NULL; arena_run_tree_new(&bin->runs); bin->reg_size = (i - ntbins + 1) << QUANTUM_2POW; prev_run_size = arena_bin_run_size_calc(bin, prev_run_size); #ifdef MALLOC_STATS memset(&bin->stats, 0, sizeof(malloc_bin_stats_t)); #endif } /* Cacheline-spaced bins. */ for (; i < ntbins + nqbins + ncbins; i++) { bin = &arena->bins[i]; bin->runcur = NULL; arena_run_tree_new(&bin->runs); bin->reg_size = cspace_min + ((i - (ntbins + nqbins)) << CACHELINE_2POW); prev_run_size = arena_bin_run_size_calc(bin, prev_run_size); #ifdef MALLOC_STATS memset(&bin->stats, 0, sizeof(malloc_bin_stats_t)); #endif } /* Subpage-spaced bins. */ for (; i < nbins; i++) { bin = &arena->bins[i]; bin->runcur = NULL; arena_run_tree_new(&bin->runs); bin->reg_size = sspace_min + ((i - (ntbins + nqbins + ncbins)) << SUBPAGE_2POW); prev_run_size = arena_bin_run_size_calc(bin, prev_run_size); #ifdef MALLOC_STATS memset(&bin->stats, 0, sizeof(malloc_bin_stats_t)); #endif } #ifdef MALLOC_DEBUG arena->magic = ARENA_MAGIC; #endif return (false); } /* Create a new arena and insert it into the arenas array at index ind. */ static arena_t * arenas_extend(unsigned ind) { arena_t *ret; /* Allocate enough space for trailing bins. */ ret = (arena_t *)base_alloc(sizeof(arena_t) + (sizeof(arena_bin_t) * (nbins - 1))); if (ret != NULL && arena_new(ret) == false) { arenas[ind] = ret; return (ret); } /* Only reached if there is an OOM error. */ /* * OOM here is quite inconvenient to propagate, since dealing with it * would require a check for failure in the fast path. Instead, punt * by using arenas[0]. In practice, this is an extremely unlikely * failure. */ _malloc_message(_getprogname(), ": (malloc) Error initializing arena\n", "", ""); if (opt_abort) abort(); return (arenas[0]); } #ifdef MALLOC_MAG static mag_t * mag_create(arena_t *arena, size_t binind) { mag_t *ret; if (sizeof(mag_t) + (sizeof(void *) * (max_rounds - 1)) <= bin_maxclass) { ret = arena_malloc_small(arena, sizeof(mag_t) + (sizeof(void *) * (max_rounds - 1)), false); } else { ret = imalloc(sizeof(mag_t) + (sizeof(void *) * (max_rounds - 1))); } if (ret == NULL) return (NULL); ret->binind = binind; ret->nrounds = 0; return (ret); } static void mag_destroy(mag_t *mag) { arena_t *arena; arena_chunk_t *chunk; size_t pageind; arena_chunk_map_t *mapelm; chunk = CHUNK_ADDR2BASE(mag); arena = chunk->arena; pageind = (((uintptr_t)mag - (uintptr_t)chunk) >> pagesize_2pow); mapelm = &chunk->map[pageind]; assert(mag->nrounds == 0); if (sizeof(mag_t) + (sizeof(void *) * (max_rounds - 1)) <= bin_maxclass) { malloc_spin_lock(&arena->lock); arena_dalloc_small(arena, chunk, mag, mapelm); malloc_spin_unlock(&arena->lock); } else idalloc(mag); } static mag_rack_t * mag_rack_create(arena_t *arena) { assert(sizeof(mag_rack_t) + (sizeof(bin_mags_t *) * (nbins - 1)) <= bin_maxclass); return (arena_malloc_small(arena, sizeof(mag_rack_t) + (sizeof(bin_mags_t) * (nbins - 1)), true)); } static void mag_rack_destroy(mag_rack_t *rack) { arena_t *arena; arena_chunk_t *chunk; bin_mags_t *bin_mags; size_t i, pageind; arena_chunk_map_t *mapelm; for (i = 0; i < nbins; i++) { bin_mags = &rack->bin_mags[i]; if (bin_mags->curmag != NULL) { assert(bin_mags->curmag->binind == i); mag_unload(bin_mags->curmag); mag_destroy(bin_mags->curmag); } if (bin_mags->sparemag != NULL) { assert(bin_mags->sparemag->binind == i); mag_unload(bin_mags->sparemag); mag_destroy(bin_mags->sparemag); } } chunk = CHUNK_ADDR2BASE(rack); arena = chunk->arena; pageind = (((uintptr_t)rack - (uintptr_t)chunk) >> pagesize_2pow); mapelm = &chunk->map[pageind]; malloc_spin_lock(&arena->lock); arena_dalloc_small(arena, chunk, rack, mapelm); malloc_spin_unlock(&arena->lock); } #endif /* * End arena. */ /******************************************************************************/ /* * Begin general internal functions. */ static void * huge_malloc(size_t size, bool zero) { void *ret; size_t csize; extent_node_t *node; /* Allocate one or more contiguous chunks for this request. */ csize = CHUNK_CEILING(size); if (csize == 0) { /* size is large enough to cause size_t wrap-around. */ return (NULL); } /* Allocate an extent node with which to track the chunk. */ node = base_node_alloc(); if (node == NULL) return (NULL); ret = chunk_alloc(csize, zero); if (ret == NULL) { base_node_dealloc(node); return (NULL); } /* Insert node into huge. */ node->addr = ret; node->size = csize; malloc_mutex_lock(&huge_mtx); extent_tree_ad_insert(&huge, node); #ifdef MALLOC_STATS huge_nmalloc++; huge_allocated += csize; #endif malloc_mutex_unlock(&huge_mtx); if (zero == false) { if (opt_junk) memset(ret, 0xa5, csize); else if (opt_zero) memset(ret, 0, csize); } return (ret); } /* Only handles large allocations that require more than chunk alignment. */ static void * huge_palloc(size_t alignment, size_t size) { void *ret; size_t alloc_size, chunk_size, offset; extent_node_t *node; /* * This allocation requires alignment that is even larger than chunk * alignment. This means that huge_malloc() isn't good enough. * * Allocate almost twice as many chunks as are demanded by the size or * alignment, in order to assure the alignment can be achieved, then * unmap leading and trailing chunks. */ assert(alignment >= chunksize); chunk_size = CHUNK_CEILING(size); if (size >= alignment) alloc_size = chunk_size + alignment - chunksize; else alloc_size = (alignment << 1) - chunksize; /* Allocate an extent node with which to track the chunk. */ node = base_node_alloc(); if (node == NULL) return (NULL); ret = chunk_alloc(alloc_size, false); if (ret == NULL) { base_node_dealloc(node); return (NULL); } offset = (uintptr_t)ret & (alignment - 1); assert((offset & chunksize_mask) == 0); assert(offset < alloc_size); if (offset == 0) { /* Trim trailing space. */ chunk_dealloc((void *)((uintptr_t)ret + chunk_size), alloc_size - chunk_size); } else { size_t trailsize; /* Trim leading space. */ chunk_dealloc(ret, alignment - offset); ret = (void *)((uintptr_t)ret + (alignment - offset)); trailsize = alloc_size - (alignment - offset) - chunk_size; if (trailsize != 0) { /* Trim trailing space. */ assert(trailsize < alloc_size); chunk_dealloc((void *)((uintptr_t)ret + chunk_size), trailsize); } } /* Insert node into huge. */ node->addr = ret; node->size = chunk_size; malloc_mutex_lock(&huge_mtx); extent_tree_ad_insert(&huge, node); #ifdef MALLOC_STATS huge_nmalloc++; huge_allocated += chunk_size; #endif malloc_mutex_unlock(&huge_mtx); if (opt_junk) memset(ret, 0xa5, chunk_size); else if (opt_zero) memset(ret, 0, chunk_size); return (ret); } static void * huge_ralloc(void *ptr, size_t size, size_t oldsize) { void *ret; size_t copysize; /* Avoid moving the allocation if the size class would not change. */ if (oldsize > arena_maxclass && CHUNK_CEILING(size) == CHUNK_CEILING(oldsize)) { if (opt_junk && size < oldsize) { memset((void *)((uintptr_t)ptr + size), 0x5a, oldsize - size); } else if (opt_zero && size > oldsize) { memset((void *)((uintptr_t)ptr + oldsize), 0, size - oldsize); } return (ptr); } /* * If we get here, then size and oldsize are different enough that we * need to use a different size class. In that case, fall back to * allocating new space and copying. */ ret = huge_malloc(size, false); if (ret == NULL) return (NULL); copysize = (size < oldsize) ? size : oldsize; memcpy(ret, ptr, copysize); idalloc(ptr); return (ret); } static void huge_dalloc(void *ptr) { extent_node_t *node, key; malloc_mutex_lock(&huge_mtx); /* Extract from tree of huge allocations. */ key.addr = ptr; node = extent_tree_ad_search(&huge, &key); assert(node != NULL); assert(node->addr == ptr); extent_tree_ad_remove(&huge, node); #ifdef MALLOC_STATS huge_ndalloc++; huge_allocated -= node->size; #endif malloc_mutex_unlock(&huge_mtx); /* Unmap chunk. */ #ifdef MALLOC_DSS if (opt_dss && opt_junk) memset(node->addr, 0x5a, node->size); #endif chunk_dealloc(node->addr, node->size); base_node_dealloc(node); } static void malloc_print_stats(void) { if (opt_print_stats) { char s[UMAX2S_BUFSIZE]; _malloc_message("___ Begin malloc statistics ___\n", "", "", ""); _malloc_message("Assertions ", #ifdef NDEBUG "disabled", #else "enabled", #endif "\n", ""); _malloc_message("Boolean MALLOC_OPTIONS: ", opt_abort ? "A" : "a", "", ""); #ifdef MALLOC_DSS _malloc_message(opt_dss ? "D" : "d", "", "", ""); #endif #ifdef MALLOC_MAG _malloc_message(opt_mag ? "G" : "g", "", "", ""); #endif _malloc_message(opt_junk ? "J" : "j", "", "", ""); #ifdef MALLOC_DSS _malloc_message(opt_mmap ? "M" : "m", "", "", ""); #endif _malloc_message(opt_utrace ? "PU" : "Pu", opt_sysv ? "V" : "v", opt_xmalloc ? "X" : "x", opt_zero ? "Z\n" : "z\n"); _malloc_message("CPUs: ", umax2s(ncpus, s), "\n", ""); _malloc_message("Max arenas: ", umax2s(narenas, s), "\n", ""); #ifdef MALLOC_BALANCE _malloc_message("Arena balance threshold: ", umax2s(opt_balance_threshold, s), "\n", ""); #endif _malloc_message("Pointer size: ", umax2s(sizeof(void *), s), "\n", ""); _malloc_message("Quantum size: ", umax2s(QUANTUM, s), "\n", ""); _malloc_message("Cacheline size (assumed): ", umax2s(CACHELINE, s), "\n", ""); #ifdef MALLOC_TINY _malloc_message("Tiny 2^n-spaced sizes: [", umax2s((1U << TINY_MIN_2POW), s), "..", ""); _malloc_message(umax2s((qspace_min >> 1), s), "]\n", "", ""); #endif _malloc_message("Quantum-spaced sizes: [", umax2s(qspace_min, s), "..", ""); _malloc_message(umax2s(qspace_max, s), "]\n", "", ""); _malloc_message("Cacheline-spaced sizes: [", umax2s(cspace_min, s), "..", ""); _malloc_message(umax2s(cspace_max, s), "]\n", "", ""); _malloc_message("Subpage-spaced sizes: [", umax2s(sspace_min, s), "..", ""); _malloc_message(umax2s(sspace_max, s), "]\n", "", ""); #ifdef MALLOC_MAG _malloc_message("Rounds per magazine: ", umax2s(max_rounds, s), "\n", ""); #endif _malloc_message("Max dirty pages per arena: ", umax2s(opt_dirty_max, s), "\n", ""); _malloc_message("Chunk size: ", umax2s(chunksize, s), "", ""); _malloc_message(" (2^", umax2s(opt_chunk_2pow, s), ")\n", ""); #ifdef MALLOC_STATS { size_t allocated, mapped; #ifdef MALLOC_BALANCE uint64_t nbalance = 0; #endif unsigned i; arena_t *arena; /* Calculate and print allocated/mapped stats. */ /* arenas. */ for (i = 0, allocated = 0; i < narenas; i++) { if (arenas[i] != NULL) { malloc_spin_lock(&arenas[i]->lock); allocated += arenas[i]->stats.allocated_small; allocated += arenas[i]->stats.allocated_large; #ifdef MALLOC_BALANCE nbalance += arenas[i]->stats.nbalance; #endif malloc_spin_unlock(&arenas[i]->lock); } } /* huge/base. */ malloc_mutex_lock(&huge_mtx); allocated += huge_allocated; mapped = stats_chunks.curchunks * chunksize; malloc_mutex_unlock(&huge_mtx); malloc_mutex_lock(&base_mtx); mapped += base_mapped; malloc_mutex_unlock(&base_mtx); malloc_printf("Allocated: %zu, mapped: %zu\n", allocated, mapped); #ifdef MALLOC_BALANCE malloc_printf("Arena balance reassignments: %llu\n", nbalance); #endif /* Print chunk stats. */ { chunk_stats_t chunks_stats; malloc_mutex_lock(&huge_mtx); chunks_stats = stats_chunks; malloc_mutex_unlock(&huge_mtx); malloc_printf("chunks: nchunks " "highchunks curchunks\n"); malloc_printf(" %13llu%13lu%13lu\n", chunks_stats.nchunks, chunks_stats.highchunks, chunks_stats.curchunks); } /* Print chunk stats. */ malloc_printf( "huge: nmalloc ndalloc allocated\n"); malloc_printf(" %12llu %12llu %12zu\n", huge_nmalloc, huge_ndalloc, huge_allocated); /* Print stats for each arena. */ for (i = 0; i < narenas; i++) { arena = arenas[i]; if (arena != NULL) { malloc_printf( "\narenas[%u]:\n", i); malloc_spin_lock(&arena->lock); stats_print(arena); malloc_spin_unlock(&arena->lock); } } } #endif /* #ifdef MALLOC_STATS */ _malloc_message("--- End malloc statistics ---\n", "", "", ""); } } #ifdef MALLOC_DEBUG static void size2bin_validate(void) { size_t i, size, binind; assert(size2bin[0] == 0xffU); i = 1; # ifdef MALLOC_TINY /* Tiny. */ for (; i < (1U << TINY_MIN_2POW); i++) { size = pow2_ceil(1U << TINY_MIN_2POW); binind = ffs((int)(size >> (TINY_MIN_2POW + 1))); assert(size2bin[i] == binind); } for (; i < qspace_min; i++) { size = pow2_ceil(i); binind = ffs((int)(size >> (TINY_MIN_2POW + 1))); assert(size2bin[i] == binind); } # endif /* Quantum-spaced. */ for (; i <= qspace_max; i++) { size = QUANTUM_CEILING(i); binind = ntbins + (size >> QUANTUM_2POW) - 1; assert(size2bin[i] == binind); } /* Cacheline-spaced. */ for (; i <= cspace_max; i++) { size = CACHELINE_CEILING(i); binind = ntbins + nqbins + ((size - cspace_min) >> CACHELINE_2POW); assert(size2bin[i] == binind); } /* Sub-page. */ for (; i <= sspace_max; i++) { size = SUBPAGE_CEILING(i); binind = ntbins + nqbins + ncbins + ((size - sspace_min) >> SUBPAGE_2POW); assert(size2bin[i] == binind); } } #endif static bool size2bin_init(void) { if (opt_qspace_max_2pow != QSPACE_MAX_2POW_DEFAULT || opt_cspace_max_2pow != CSPACE_MAX_2POW_DEFAULT) return (size2bin_init_hard()); size2bin = const_size2bin; #ifdef MALLOC_DEBUG assert(sizeof(const_size2bin) == bin_maxclass + 1); size2bin_validate(); #endif return (false); } static bool size2bin_init_hard(void) { size_t i, size, binind; uint8_t *custom_size2bin; assert(opt_qspace_max_2pow != QSPACE_MAX_2POW_DEFAULT || opt_cspace_max_2pow != CSPACE_MAX_2POW_DEFAULT); custom_size2bin = (uint8_t *)base_alloc(bin_maxclass + 1); if (custom_size2bin == NULL) return (true); custom_size2bin[0] = 0xffU; i = 1; #ifdef MALLOC_TINY /* Tiny. */ for (; i < (1U << TINY_MIN_2POW); i++) { size = pow2_ceil(1U << TINY_MIN_2POW); binind = ffs((int)(size >> (TINY_MIN_2POW + 1))); custom_size2bin[i] = binind; } for (; i < qspace_min; i++) { size = pow2_ceil(i); binind = ffs((int)(size >> (TINY_MIN_2POW + 1))); custom_size2bin[i] = binind; } #endif /* Quantum-spaced. */ for (; i <= qspace_max; i++) { size = QUANTUM_CEILING(i); binind = ntbins + (size >> QUANTUM_2POW) - 1; custom_size2bin[i] = binind; } /* Cacheline-spaced. */ for (; i <= cspace_max; i++) { size = CACHELINE_CEILING(i); binind = ntbins + nqbins + ((size - cspace_min) >> CACHELINE_2POW); custom_size2bin[i] = binind; } /* Sub-page. */ for (; i <= sspace_max; i++) { size = SUBPAGE_CEILING(i); binind = ntbins + nqbins + ncbins + ((size - sspace_min) >> SUBPAGE_2POW); custom_size2bin[i] = binind; } size2bin = custom_size2bin; #ifdef MALLOC_DEBUG size2bin_validate(); #endif return (false); } /* * FreeBSD's pthreads implementation calls malloc(3), so the malloc * implementation has to take pains to avoid infinite recursion during * initialization. */ static inline bool malloc_init(void) { if (malloc_initialized == false) return (malloc_init_hard()); return (false); } static bool malloc_init_hard(void) { unsigned i; int linklen; char buf[PATH_MAX + 1]; const char *opts; malloc_mutex_lock(&init_lock); if (malloc_initialized) { /* * Another thread initialized the allocator before this one * acquired init_lock. */ malloc_mutex_unlock(&init_lock); return (false); } /* Get number of CPUs. */ { int mib[2]; size_t len; mib[0] = CTL_HW; mib[1] = HW_NCPU; len = sizeof(ncpus); if (sysctl(mib, 2, &ncpus, &len, (void *) 0, 0) == -1) { /* Error. */ ncpus = 1; } } /* Get page size. */ { long result; result = sysconf(_SC_PAGESIZE); assert(result != -1); pagesize = (unsigned)result; /* * We assume that pagesize is a power of 2 when calculating * pagesize_mask and pagesize_2pow. */ assert(((result - 1) & result) == 0); pagesize_mask = result - 1; pagesize_2pow = ffs((int)result) - 1; } for (i = 0; i < 3; i++) { unsigned j; /* Get runtime configuration. */ switch (i) { case 0: if ((linklen = readlink("/etc/malloc.conf", buf, sizeof(buf) - 1)) != -1) { /* * Use the contents of the "/etc/malloc.conf" * symbolic link's name. */ buf[linklen] = '\0'; opts = buf; } else { /* No configuration specified. */ buf[0] = '\0'; opts = buf; } break; case 1: if (issetugid() == 0 && (opts = getenv("MALLOC_OPTIONS")) != NULL) { /* * Do nothing; opts is already initialized to * the value of the MALLOC_OPTIONS environment * variable. */ } else { /* No configuration specified. */ buf[0] = '\0'; opts = buf; } break; case 2: if (_malloc_options != NULL) { /* * Use options that were compiled into the * program. */ opts = _malloc_options; } else { /* No configuration specified. */ buf[0] = '\0'; opts = buf; } break; default: /* NOTREACHED */ assert(false); } for (j = 0; opts[j] != '\0'; j++) { unsigned k, nreps; bool nseen; /* Parse repetition count, if any. */ for (nreps = 0, nseen = false;; j++, nseen = true) { switch (opts[j]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': nreps *= 10; nreps += opts[j] - '0'; break; default: goto MALLOC_OUT; } } MALLOC_OUT: if (nseen == false) nreps = 1; for (k = 0; k < nreps; k++) { switch (opts[j]) { case 'a': opt_abort = false; break; case 'A': opt_abort = true; break; case 'b': #ifdef MALLOC_BALANCE opt_balance_threshold >>= 1; #endif break; case 'B': #ifdef MALLOC_BALANCE if (opt_balance_threshold == 0) opt_balance_threshold = 1; else if ((opt_balance_threshold << 1) > opt_balance_threshold) opt_balance_threshold <<= 1; #endif break; case 'c': if (opt_cspace_max_2pow - 1 > opt_qspace_max_2pow && opt_cspace_max_2pow > CACHELINE_2POW) opt_cspace_max_2pow--; break; case 'C': if (opt_cspace_max_2pow < pagesize_2pow - 1) opt_cspace_max_2pow++; break; case 'd': #ifdef MALLOC_DSS opt_dss = false; #endif break; case 'D': #ifdef MALLOC_DSS opt_dss = true; #endif break; case 'f': opt_dirty_max >>= 1; break; case 'F': if (opt_dirty_max == 0) opt_dirty_max = 1; else if ((opt_dirty_max << 1) != 0) opt_dirty_max <<= 1; break; #ifdef MALLOC_MAG case 'g': opt_mag = false; break; case 'G': opt_mag = true; break; #endif case 'j': opt_junk = false; break; case 'J': opt_junk = true; break; case 'k': /* * Chunks always require at least one * header page, so chunks can never be * smaller than two pages. */ if (opt_chunk_2pow > pagesize_2pow + 1) opt_chunk_2pow--; break; case 'K': if (opt_chunk_2pow + 1 < (sizeof(size_t) << 3)) opt_chunk_2pow++; break; case 'm': #ifdef MALLOC_DSS opt_mmap = false; #endif break; case 'M': #ifdef MALLOC_DSS opt_mmap = true; #endif break; case 'n': opt_narenas_lshift--; break; case 'N': opt_narenas_lshift++; break; case 'p': opt_print_stats = false; break; case 'P': opt_print_stats = true; break; case 'q': if (opt_qspace_max_2pow > QUANTUM_2POW) opt_qspace_max_2pow--; break; case 'Q': if (opt_qspace_max_2pow + 1 < opt_cspace_max_2pow) opt_qspace_max_2pow++; break; #ifdef MALLOC_MAG case 'R': if (opt_mag_size_2pow + 1 < (8U << SIZEOF_PTR_2POW)) opt_mag_size_2pow++; break; case 'r': /* * Make sure there's always at least * one round per magazine. */ if ((1U << (opt_mag_size_2pow-1)) >= sizeof(mag_t)) opt_mag_size_2pow--; break; #endif case 'u': opt_utrace = false; break; case 'U': opt_utrace = true; break; case 'v': opt_sysv = false; break; case 'V': opt_sysv = true; break; case 'x': opt_xmalloc = false; break; case 'X': opt_xmalloc = true; break; case 'z': opt_zero = false; break; case 'Z': opt_zero = true; break; default: { char cbuf[2]; cbuf[0] = opts[j]; cbuf[1] = '\0'; _malloc_message(_getprogname(), ": (malloc) Unsupported character " "in malloc options: '", cbuf, "'\n"); } } } } } #ifdef MALLOC_DSS /* Make sure that there is some method for acquiring memory. */ if (opt_dss == false && opt_mmap == false) opt_mmap = true; #endif /* Take care to call atexit() only once. */ if (opt_print_stats) { /* Print statistics at exit. */ atexit(malloc_print_stats); } #ifdef MALLOC_MAG /* * Calculate the actual number of rounds per magazine, taking into * account header overhead. */ max_rounds = (1LLU << (opt_mag_size_2pow - SIZEOF_PTR_2POW)) - (sizeof(mag_t) >> SIZEOF_PTR_2POW) + 1; #endif /* Set variables according to the value of opt_[qc]space_max_2pow. */ qspace_max = (1U << opt_qspace_max_2pow); cspace_min = CACHELINE_CEILING(qspace_max); if (cspace_min == qspace_max) cspace_min += CACHELINE; cspace_max = (1U << opt_cspace_max_2pow); sspace_min = SUBPAGE_CEILING(cspace_max); if (sspace_min == cspace_max) sspace_min += SUBPAGE; assert(sspace_min < pagesize); sspace_max = pagesize - SUBPAGE; #ifdef MALLOC_TINY assert(QUANTUM_2POW >= TINY_MIN_2POW); #endif assert(ntbins <= QUANTUM_2POW); nqbins = qspace_max >> QUANTUM_2POW; ncbins = ((cspace_max - cspace_min) >> CACHELINE_2POW) + 1; nsbins = ((sspace_max - sspace_min) >> SUBPAGE_2POW) + 1; nbins = ntbins + nqbins + ncbins + nsbins; if (size2bin_init()) { malloc_mutex_unlock(&init_lock); return (true); } /* Set variables according to the value of opt_chunk_2pow. */ chunksize = (1LU << opt_chunk_2pow); chunksize_mask = chunksize - 1; chunk_npages = (chunksize >> pagesize_2pow); { size_t header_size; /* * Compute the header size such that it is large enough to * contain the page map. */ header_size = sizeof(arena_chunk_t) + (sizeof(arena_chunk_map_t) * (chunk_npages - 1)); arena_chunk_header_npages = (header_size >> pagesize_2pow) + ((header_size & pagesize_mask) != 0); } arena_maxclass = chunksize - (arena_chunk_header_npages << pagesize_2pow); UTRACE(0, 0, 0); #ifdef MALLOC_STATS memset(&stats_chunks, 0, sizeof(chunk_stats_t)); #endif /* Various sanity checks that regard configuration. */ assert(chunksize >= pagesize); /* Initialize chunks data. */ malloc_mutex_init(&huge_mtx); extent_tree_ad_new(&huge); #ifdef MALLOC_DSS malloc_mutex_init(&dss_mtx); dss_base = sbrk(0); dss_prev = dss_base; dss_max = dss_base; extent_tree_szad_new(&dss_chunks_szad); extent_tree_ad_new(&dss_chunks_ad); #endif #ifdef MALLOC_STATS huge_nmalloc = 0; huge_ndalloc = 0; huge_allocated = 0; #endif /* Initialize base allocation data structures. */ #ifdef MALLOC_STATS base_mapped = 0; #endif #ifdef MALLOC_DSS /* * Allocate a base chunk here, since it doesn't actually have to be * chunk-aligned. Doing this before allocating any other chunks allows * the use of space that would otherwise be wasted. */ if (opt_dss) base_pages_alloc(0); #endif base_nodes = NULL; malloc_mutex_init(&base_mtx); if (ncpus > 1) { /* * For SMP systems, create twice as many arenas as there are * CPUs by default. */ opt_narenas_lshift++; } /* Determine how many arenas to use. */ narenas = ncpus; if (opt_narenas_lshift > 0) { if ((narenas << opt_narenas_lshift) > narenas) narenas <<= opt_narenas_lshift; /* * Make sure not to exceed the limits of what base_alloc() can * handle. */ if (narenas * sizeof(arena_t *) > chunksize) narenas = chunksize / sizeof(arena_t *); } else if (opt_narenas_lshift < 0) { if ((narenas >> -opt_narenas_lshift) < narenas) narenas >>= -opt_narenas_lshift; /* Make sure there is at least one arena. */ if (narenas == 0) narenas = 1; } #ifdef MALLOC_BALANCE assert(narenas != 0); for (narenas_2pow = 0; (narenas >> (narenas_2pow + 1)) != 0; narenas_2pow++); #endif #ifdef NO_TLS if (narenas > 1) { static const unsigned primes[] = {1, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263}; unsigned nprimes, parenas; /* * Pick a prime number of hash arenas that is more than narenas * so that direct hashing of pthread_self() pointers tends to * spread allocations evenly among the arenas. */ assert((narenas & 1) == 0); /* narenas must be even. */ nprimes = (sizeof(primes) >> SIZEOF_INT_2POW); parenas = primes[nprimes - 1]; /* In case not enough primes. */ for (i = 1; i < nprimes; i++) { if (primes[i] > narenas) { parenas = primes[i]; break; } } narenas = parenas; } #endif #ifndef NO_TLS # ifndef MALLOC_BALANCE next_arena = 0; # endif #endif /* Allocate and initialize arenas. */ arenas = (arena_t **)base_alloc(sizeof(arena_t *) * narenas); if (arenas == NULL) { malloc_mutex_unlock(&init_lock); return (true); } /* * Zero the array. In practice, this should always be pre-zeroed, * since it was just mmap()ed, but let's be sure. */ memset(arenas, 0, sizeof(arena_t *) * narenas); /* * Initialize one arena here. The rest are lazily created in * choose_arena_hard(). */ arenas_extend(0); if (arenas[0] == NULL) { malloc_mutex_unlock(&init_lock); return (true); } #ifndef NO_TLS /* * Assign the initial arena to the initial thread, in order to avoid * spurious creation of an extra arena if the application switches to * threaded mode. */ arenas_map = arenas[0]; #endif /* * Seed here for the initial thread, since choose_arena_hard() is only * called for other threads. The seed value doesn't really matter. */ #ifdef MALLOC_BALANCE SPRN(balance, 42); #endif malloc_spin_init(&arenas_lock); malloc_initialized = true; malloc_mutex_unlock(&init_lock); return (false); } /* * End general internal functions. */ /******************************************************************************/ /* * Begin malloc(3)-compatible functions. */ void * malloc(size_t size) { void *ret; if (malloc_init()) { ret = NULL; goto RETURN; } if (size == 0) { if (opt_sysv == false) size = 1; else { ret = NULL; goto RETURN; } } ret = imalloc(size); RETURN: if (ret == NULL) { if (opt_xmalloc) { _malloc_message(_getprogname(), ": (malloc) Error in malloc(): out of memory\n", "", ""); abort(); } errno = ENOMEM; } UTRACE(0, size, ret); return (ret); } int posix_memalign(void **memptr, size_t alignment, size_t size) { int ret; void *result; if (malloc_init()) result = NULL; else { /* Make sure that alignment is a large enough power of 2. */ if (((alignment - 1) & alignment) != 0 || alignment < sizeof(void *)) { if (opt_xmalloc) { _malloc_message(_getprogname(), ": (malloc) Error in posix_memalign(): " "invalid alignment\n", "", ""); abort(); } result = NULL; ret = EINVAL; goto RETURN; } result = ipalloc(alignment, size); } if (result == NULL) { if (opt_xmalloc) { _malloc_message(_getprogname(), ": (malloc) Error in posix_memalign(): out of memory\n", "", ""); abort(); } ret = ENOMEM; goto RETURN; } *memptr = result; ret = 0; RETURN: UTRACE(0, size, result); return (ret); } void * calloc(size_t num, size_t size) { void *ret; size_t num_size; if (malloc_init()) { num_size = 0; ret = NULL; goto RETURN; } num_size = num * size; if (num_size == 0) { if ((opt_sysv == false) && ((num == 0) || (size == 0))) num_size = 1; else { ret = NULL; goto RETURN; } /* * Try to avoid division here. We know that it isn't possible to * overflow during multiplication if neither operand uses any of the * most significant half of the bits in a size_t. */ } else if (((num | size) & (SIZE_T_MAX << (sizeof(size_t) << 2))) && (num_size / size != num)) { /* size_t overflow. */ ret = NULL; goto RETURN; } ret = icalloc(num_size); RETURN: if (ret == NULL) { if (opt_xmalloc) { _malloc_message(_getprogname(), ": (malloc) Error in calloc(): out of memory\n", "", ""); abort(); } errno = ENOMEM; } UTRACE(0, num_size, ret); return (ret); } void * realloc(void *ptr, size_t size) { void *ret; if (size == 0) { if (opt_sysv == false) size = 1; else { if (ptr != NULL) idalloc(ptr); ret = NULL; goto RETURN; } } if (ptr != NULL) { assert(malloc_initialized); ret = iralloc(ptr, size); if (ret == NULL) { if (opt_xmalloc) { _malloc_message(_getprogname(), ": (malloc) Error in realloc(): out of " "memory\n", "", ""); abort(); } errno = ENOMEM; } } else { if (malloc_init()) ret = NULL; else ret = imalloc(size); if (ret == NULL) { if (opt_xmalloc) { _malloc_message(_getprogname(), ": (malloc) Error in realloc(): out of " "memory\n", "", ""); abort(); } errno = ENOMEM; } } RETURN: UTRACE(ptr, size, ret); return (ret); } void free(void *ptr) { UTRACE(ptr, 0, 0); if (ptr != NULL) { assert(malloc_initialized); idalloc(ptr); } } /* * End malloc(3)-compatible functions. */ /******************************************************************************/ /* * Begin non-standard functions. */ size_t malloc_usable_size(const void *ptr) { assert(ptr != NULL); return (isalloc(ptr)); } /* * End non-standard functions. */ /******************************************************************************/ /* * Begin library-private functions. */ /******************************************************************************/ /* * Begin thread cache. */ /* * We provide an unpublished interface in order to receive notifications from * the pthreads library whenever a thread exits. This allows us to clean up * thread caches. */ void _malloc_thread_cleanup(void) { #ifdef MALLOC_MAG if (mag_rack != NULL) { assert(mag_rack != (void *)-1); mag_rack_destroy(mag_rack); #ifdef MALLOC_DEBUG mag_rack = (void *)-1; #endif } #endif } /* * The following functions are used by threading libraries for protection of * malloc during fork(). These functions are only called if the program is * running in threaded mode, so there is no need to check whether the program * is threaded here. */ void _malloc_prefork(void) { unsigned i; /* Acquire all mutexes in a safe order. */ malloc_spin_lock(&arenas_lock); for (i = 0; i < narenas; i++) { if (arenas[i] != NULL) malloc_spin_lock(&arenas[i]->lock); } malloc_spin_unlock(&arenas_lock); malloc_mutex_lock(&base_mtx); malloc_mutex_lock(&huge_mtx); #ifdef MALLOC_DSS malloc_mutex_lock(&dss_mtx); #endif } void _malloc_postfork(void) { unsigned i; /* Release all mutexes, now that fork() has completed. */ #ifdef MALLOC_DSS malloc_mutex_unlock(&dss_mtx); #endif malloc_mutex_unlock(&huge_mtx); malloc_mutex_unlock(&base_mtx); malloc_spin_lock(&arenas_lock); for (i = 0; i < narenas; i++) { if (arenas[i] != NULL) malloc_spin_unlock(&arenas[i]->lock); } malloc_spin_unlock(&arenas_lock); } /* * End library-private functions. */ /******************************************************************************/ varnish-3.0.5/lib/libjemalloc/jemalloc_linux.c0000644000175000017500000043217212247035455016326 00000000000000/*- * Copyright (C) 2006-2008 Jason Evans . * 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(s), this list of conditions and the following disclaimer as * the first lines of this file unmodified other than the possible * addition of one or more copyright notices. * 2. Redistributions in binary form must reproduce the above copyright * notice(s), this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY * EXPRESS OR 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 COPYRIGHT HOLDER(S) BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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 allocator implementation is designed to provide scalable performance * for multi-threaded programs on multi-processor systems. The following * features are included for this purpose: * * + Multiple arenas are used if there are multiple CPUs, which reduces lock * contention and cache sloshing. * * + Thread-specific caching is used if there are multiple threads, which * reduces the amount of locking. * * + Cache line sharing between arenas is avoided for internal data * structures. * * + Memory is managed in chunks and runs (chunks can be split into runs), * rather than as individual pages. This provides a constant-time * mechanism for associating allocations with particular arenas. * * Allocation requests are rounded up to the nearest size class, and no record * of the original request size is maintained. Allocations are broken into * categories according to size class. Assuming runtime defaults, 4 kB pages * and a 16 byte quantum on a 32-bit system, the size classes in each category * are as follows: * * |=======================================| * | Category | Subcategory | Size | * |=======================================| * | Small | Tiny | 2 | * | | | 4 | * | | | 8 | * | |------------------+---------| * | | Quantum-spaced | 16 | * | | | 32 | * | | | 48 | * | | | ... | * | | | 96 | * | | | 112 | * | | | 128 | * | |------------------+---------| * | | Cacheline-spaced | 192 | * | | | 256 | * | | | 320 | * | | | 384 | * | | | 448 | * | | | 512 | * | |------------------+---------| * | | Sub-page | 760 | * | | | 1024 | * | | | 1280 | * | | | ... | * | | | 3328 | * | | | 3584 | * | | | 3840 | * |=======================================| * | Large | 4 kB | * | | 8 kB | * | | 12 kB | * | | ... | * | | 1012 kB | * | | 1016 kB | * | | 1020 kB | * |=======================================| * | Huge | 1 MB | * | | 2 MB | * | | 3 MB | * | | ... | * |=======================================| * * A different mechanism is used for each category: * * Small : Each size class is segregated into its own set of runs. Each run * maintains a bitmap of which regions are free/allocated. * * Large : Each allocation is backed by a dedicated run. Metadata are stored * in the associated arena chunk header maps. * * Huge : Each allocation is backed by a dedicated contiguous set of chunks. * Metadata are stored in a separate red-black tree. * ******************************************************************************* */ /* * Set to false if single-threaded. Even better, rip out all of the code that * doesn't get used if __isthreaded is false, so that libpthread isn't * necessary. */ #ifndef __isthreaded # define __isthreaded true #endif /* * MALLOC_PRODUCTION disables assertions and statistics gathering. It also * defaults the A and J runtime options to off. These settings are appropriate * for production systems. */ /* #define MALLOC_PRODUCTION */ #ifndef MALLOC_PRODUCTION /* * MALLOC_DEBUG enables assertions and other sanity checks, and disables * inline functions. */ # define MALLOC_DEBUG /* MALLOC_STATS enables statistics calculation. */ # define MALLOC_STATS #endif /* * MALLOC_TINY enables support for tiny objects, which are smaller than one * quantum. */ #define MALLOC_TINY /* * MALLOC_MAG enables a magazine-based thread-specific caching layer for small * objects. This makes it possible to allocate/deallocate objects without any * locking when the cache is in the steady state. * * If MALLOC_MAG is enabled, make sure that _malloc_thread_cleanup() is called * by each thread just before it exits. */ /* #define MALLOC_MAG */ /* * MALLOC_BALANCE enables monitoring of arena lock contention and dynamically * re-balances arena load if exponentially averaged contention exceeds a * certain threshold. */ #define MALLOC_BALANCE /* * MALLOC_DSS enables use of sbrk(2) to allocate chunks from the data storage * segment (DSS). In an ideal world, this functionality would be completely * unnecessary, but we are burdened by history and the lack of resource limits * for anonymous mapped memory. */ /* #define MALLOC_DSS */ #define _GNU_SOURCE /* For mremap(2). */ #define issetugid() 0 #define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var)) /* __FBSDID("$FreeBSD: head/lib/libc/stdlib/malloc.c 182225 2008-08-27 02:00:53Z jasone $"); */ #include #include #include #include #include #include #include #include #ifndef SIZE_T_MAX # define SIZE_T_MAX SIZE_MAX #endif #include #include #include #include #include #include #include #include #include #include #include #include "rb.h" /* * Prevent gcc from complaining about unused parameters. Added directly * here instead of including ansidecl.h to save a build dependency on * binutils-dev. */ #if __GNUC__ >= 3 #ifndef ATTRIBUTE_UNUSED #define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) #endif /* ATTRIBUTE_UNUSED */ #else #define ATTRIBUTE_UNUSED #endif #ifdef MALLOC_DEBUG /* Disable inlining to make debugging easier. */ # define inline #endif /* Size of stack-allocated buffer passed to strerror_r(). */ #define STRERROR_BUF 64 /* * The const_size2bin table is sized according to PAGESIZE_2POW, but for * correctness reasons, we never assume that * (pagesize == (1U << * PAGESIZE_2POW)). * * Minimum alignment of allocations is 2^QUANTUM_2POW bytes. */ #ifdef __i386__ # define PAGESIZE_2POW 12 # define QUANTUM_2POW 4 # define SIZEOF_PTR_2POW 2 # define CPU_SPINWAIT __asm__ volatile("pause") #endif #ifdef __ia64__ # define PAGESIZE_2POW 12 # define QUANTUM_2POW 4 # define SIZEOF_PTR_2POW 3 #endif #ifdef __alpha__ # define PAGESIZE_2POW 13 # define QUANTUM_2POW 4 # define SIZEOF_PTR_2POW 3 # define NO_TLS #endif #ifdef __sparc__ # define PAGESIZE_2POW 13 # define QUANTUM_2POW 4 # define SIZEOF_PTR_2POW 3 # define NO_TLS #endif #ifdef __amd64__ # define PAGESIZE_2POW 12 # define QUANTUM_2POW 4 # define SIZEOF_PTR_2POW 3 # define CPU_SPINWAIT __asm__ volatile("pause") #endif #ifdef __arm__ # define PAGESIZE_2POW 12 # define QUANTUM_2POW 3 # define SIZEOF_PTR_2POW 2 # define NO_TLS #endif #ifdef __mips__ # define PAGESIZE_2POW 12 # define QUANTUM_2POW 3 # define SIZEOF_PTR_2POW 2 # define NO_TLS #endif #ifdef __powerpc__ # define PAGESIZE_2POW 12 # define QUANTUM_2POW 4 # define SIZEOF_PTR_2POW 2 #endif #ifdef __s390__ # define PAGESIZE_2POW 12 # define QUANTUM_2POW 4 # define SIZEOF_PTR_2POW 2 #endif #ifdef __s390x__ # define PAGESIZE_2POW 12 # define QUANTUM_2POW 4 # define SIZEOF_PTR_2POW 3 #endif #ifdef __sh__ # define PAGESIZE_2POW 12 # define QUANTUM_2POW 3 # define SIZEOF_PTR_2POW 2 # define NO_TLS #endif #define QUANTUM ((size_t)(1U << QUANTUM_2POW)) #define QUANTUM_MASK (QUANTUM - 1) #define SIZEOF_PTR (1U << SIZEOF_PTR_2POW) /* sizeof(int) == (1U << SIZEOF_INT_2POW). */ #ifndef SIZEOF_INT_2POW # define SIZEOF_INT_2POW 2 #endif /* We can't use TLS in non-PIC programs, since TLS relies on loader magic. */ #if (!defined(PIC) && !defined(NO_TLS)) # define NO_TLS #endif #ifdef NO_TLS /* MALLOC_MAG requires TLS. */ # ifdef MALLOC_MAG # undef MALLOC_MAG # endif /* MALLOC_BALANCE requires TLS. */ # ifdef MALLOC_BALANCE # undef MALLOC_BALANCE # endif #endif /* * Size and alignment of memory chunks that are allocated by the OS's virtual * memory system. */ #define CHUNK_2POW_DEFAULT 20 /* Maximum number of dirty pages per arena. */ #define DIRTY_MAX_DEFAULT (1U << 9) /* * Maximum size of L1 cache line. This is used to avoid cache line aliasing. * In addition, this controls the spacing of cacheline-spaced size classes. */ #define CACHELINE_2POW 6 #define CACHELINE ((size_t)(1U << CACHELINE_2POW)) #define CACHELINE_MASK (CACHELINE - 1) /* * Subpages are an artificially designated partitioning of pages. Their only * purpose is to support subpage-spaced size classes. * * There must be at least 4 subpages per page, due to the way size classes are * handled. */ #define SUBPAGE_2POW 8 #define SUBPAGE ((size_t)(1U << SUBPAGE_2POW)) #define SUBPAGE_MASK (SUBPAGE - 1) #ifdef MALLOC_TINY /* Smallest size class to support. */ # define TINY_MIN_2POW 1 #endif /* * Maximum size class that is a multiple of the quantum, but not (necessarily) * a power of 2. Above this size, allocations are rounded up to the nearest * power of 2. */ #define QSPACE_MAX_2POW_DEFAULT 7 /* * Maximum size class that is a multiple of the cacheline, but not (necessarily) * a power of 2. Above this size, allocations are rounded up to the nearest * power of 2. */ #define CSPACE_MAX_2POW_DEFAULT 9 /* * RUN_MAX_OVRHD indicates maximum desired run header overhead. Runs are sized * as small as possible such that this setting is still honored, without * violating other constraints. The goal is to make runs as small as possible * without exceeding a per run external fragmentation threshold. * * We use binary fixed point math for overhead computations, where the binary * point is implicitly RUN_BFP bits to the left. * * Note that it is possible to set RUN_MAX_OVRHD low enough that it cannot be * honored for some/all object sizes, since there is one bit of header overhead * per object (plus a constant). This constraint is relaxed (ignored) for runs * that are so small that the per-region overhead is greater than: * * (RUN_MAX_OVRHD / (reg_size << (3+RUN_BFP)) */ #define RUN_BFP 12 /* \/ Implicit binary fixed point. */ #define RUN_MAX_OVRHD 0x0000003dU #define RUN_MAX_OVRHD_RELAX 0x00001800U /* Put a cap on small object run size. This overrides RUN_MAX_OVRHD. */ #define RUN_MAX_SMALL (12 * pagesize) /* * Hyper-threaded CPUs may need a special instruction inside spin loops in * order to yield to another virtual CPU. If no such instruction is defined * above, make CPU_SPINWAIT a no-op. */ #ifndef CPU_SPINWAIT # define CPU_SPINWAIT #endif /* * Adaptive spinning must eventually switch to blocking, in order to avoid the * potential for priority inversion deadlock. Backing off past a certain point * can actually waste time. */ #define SPIN_LIMIT_2POW 11 /* * Conversion from spinning to blocking is expensive; we use (1U << * BLOCK_COST_2POW) to estimate how many more times costly blocking is than * worst-case spinning. */ #define BLOCK_COST_2POW 4 #ifdef MALLOC_MAG /* * Default magazine size, in bytes. max_rounds is calculated to make * optimal use of the space, leaving just enough room for the magazine * header. */ # define MAG_SIZE_2POW_DEFAULT 9 #endif #ifdef MALLOC_BALANCE /* * We use an exponential moving average to track recent lock contention, * where the size of the history window is N, and alpha=2/(N+1). * * Due to integer math rounding, very small values here can cause * substantial degradation in accuracy, thus making the moving average decay * faster than it would with precise calculation. */ # define BALANCE_ALPHA_INV_2POW 9 /* * Threshold value for the exponential moving contention average at which to * re-assign a thread. */ # define BALANCE_THRESHOLD_DEFAULT (1U << (SPIN_LIMIT_2POW-4)) #endif /******************************************************************************/ typedef pthread_mutex_t malloc_mutex_t; typedef pthread_mutex_t malloc_spinlock_t; /* Set to true once the allocator has been initialized. */ static bool malloc_initialized = false; /* Used to avoid initialization races. */ static malloc_mutex_t init_lock = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP; /******************************************************************************/ /* * Statistics data structures. */ #ifdef MALLOC_STATS typedef struct malloc_bin_stats_s malloc_bin_stats_t; struct malloc_bin_stats_s { /* * Number of allocation requests that corresponded to the size of this * bin. */ uint64_t nrequests; #ifdef MALLOC_MAG /* Number of magazine reloads from this bin. */ uint64_t nmags; #endif /* Total number of runs created for this bin's size class. */ uint64_t nruns; /* * Total number of runs reused by extracting them from the runs tree for * this bin's size class. */ uint64_t reruns; /* High-water mark for this bin. */ unsigned long highruns; /* Current number of runs in this bin. */ unsigned long curruns; }; typedef struct arena_stats_s arena_stats_t; struct arena_stats_s { /* Number of bytes currently mapped. */ size_t mapped; /* * Total number of purge sweeps, total number of madvise calls made, * and total pages purged in order to keep dirty unused memory under * control. */ uint64_t npurge; uint64_t nmadvise; uint64_t purged; /* Per-size-category statistics. */ size_t allocated_small; uint64_t nmalloc_small; uint64_t ndalloc_small; size_t allocated_large; uint64_t nmalloc_large; uint64_t ndalloc_large; #ifdef MALLOC_BALANCE /* Number of times this arena reassigned a thread due to contention. */ uint64_t nbalance; #endif }; typedef struct chunk_stats_s chunk_stats_t; struct chunk_stats_s { /* Number of chunks that were allocated. */ uint64_t nchunks; /* High-water mark for number of chunks allocated. */ unsigned long highchunks; /* * Current number of chunks allocated. This value isn't maintained for * any other purpose, so keep track of it in order to be able to set * highchunks. */ unsigned long curchunks; }; #endif /* #ifdef MALLOC_STATS */ /******************************************************************************/ /* * Extent data structures. */ /* Tree of extents. */ typedef struct extent_node_s extent_node_t; struct extent_node_s { #ifdef MALLOC_DSS /* Linkage for the size/address-ordered tree. */ rb_node(extent_node_t) link_szad; #endif /* Linkage for the address-ordered tree. */ rb_node(extent_node_t) link_ad; /* Pointer to the extent that this tree node is responsible for. */ void *addr; /* Total region size. */ size_t size; }; typedef rb_tree(extent_node_t) extent_tree_t; /******************************************************************************/ /* * Arena data structures. */ typedef struct arena_s arena_t; typedef struct arena_bin_s arena_bin_t; /* Each element of the chunk map corresponds to one page within the chunk. */ typedef struct arena_chunk_map_s arena_chunk_map_t; struct arena_chunk_map_s { /* * Linkage for run trees. There are two disjoint uses: * * 1) arena_t's runs_avail tree. * 2) arena_run_t conceptually uses this linkage for in-use non-full * runs, rather than directly embedding linkage. */ rb_node(arena_chunk_map_t) link; /* * Run address (or size) and various flags are stored together. The bit * layout looks like (assuming 32-bit system): * * ???????? ???????? ????---- ---kdzla * * ? : Unallocated: Run address for first/last pages, unset for internal * pages. * Small: Run address. * Large: Run size for first page, unset for trailing pages. * - : Unused. * k : key? * d : dirty? * z : zeroed? * l : large? * a : allocated? * * Following are example bit patterns for the three types of runs. * * r : run address * s : run size * x : don't care * - : 0 * [dzla] : bit set * * Unallocated: * ssssssss ssssssss ssss---- -------- * xxxxxxxx xxxxxxxx xxxx---- ----d--- * ssssssss ssssssss ssss---- -----z-- * * Small: * rrrrrrrr rrrrrrrr rrrr---- -------a * rrrrrrrr rrrrrrrr rrrr---- -------a * rrrrrrrr rrrrrrrr rrrr---- -------a * * Large: * ssssssss ssssssss ssss---- ------la * -------- -------- -------- ------la * -------- -------- -------- ------la */ size_t bits; #define CHUNK_MAP_KEY ((size_t)0x10U) #define CHUNK_MAP_DIRTY ((size_t)0x08U) #define CHUNK_MAP_ZEROED ((size_t)0x04U) #define CHUNK_MAP_LARGE ((size_t)0x02U) #define CHUNK_MAP_ALLOCATED ((size_t)0x01U) }; typedef rb_tree(arena_chunk_map_t) arena_avail_tree_t; typedef rb_tree(arena_chunk_map_t) arena_run_tree_t; /* Arena chunk header. */ typedef struct arena_chunk_s arena_chunk_t; struct arena_chunk_s { /* Arena that owns the chunk. */ arena_t *arena; /* Linkage for the arena's chunks_dirty tree. */ rb_node(arena_chunk_t) link_dirty; /* Number of dirty pages. */ size_t ndirty; /* Map of pages within chunk that keeps track of free/large/small. */ arena_chunk_map_t map[1]; /* Dynamically sized. */ }; typedef rb_tree(arena_chunk_t) arena_chunk_tree_t; typedef struct arena_run_s arena_run_t; struct arena_run_s { #ifdef MALLOC_DEBUG uint32_t magic; # define ARENA_RUN_MAGIC 0x384adf93 #endif /* Bin this run is associated with. */ arena_bin_t *bin; /* Index of first element that might have a free region. */ unsigned regs_minelm; /* Number of free regions in run. */ unsigned nfree; /* Bitmask of in-use regions (0: in use, 1: free). */ unsigned regs_mask[1]; /* Dynamically sized. */ }; struct arena_bin_s { /* * Current run being used to service allocations of this bin's size * class. */ arena_run_t *runcur; /* * Tree of non-full runs. This tree is used when looking for an * existing run when runcur is no longer usable. We choose the * non-full run that is lowest in memory; this policy tends to keep * objects packed well, and it can also help reduce the number of * almost-empty chunks. */ arena_run_tree_t runs; /* Size of regions in a run for this bin's size class. */ size_t reg_size; /* Total size of a run for this bin's size class. */ size_t run_size; /* Total number of regions in a run for this bin's size class. */ uint32_t nregs; /* Number of elements in a run's regs_mask for this bin's size class. */ uint32_t regs_mask_nelms; /* Offset of first region in a run for this bin's size class. */ uint32_t reg0_offset; #ifdef MALLOC_STATS /* Bin statistics. */ malloc_bin_stats_t stats; #endif }; struct arena_s { #ifdef MALLOC_DEBUG uint32_t magic; # define ARENA_MAGIC 0x947d3d24 #endif /* All operations on this arena require that lock be locked. */ pthread_mutex_t lock; #ifdef MALLOC_STATS arena_stats_t stats; #endif /* Tree of dirty-page-containing chunks this arena manages. */ arena_chunk_tree_t chunks_dirty; /* * In order to avoid rapid chunk allocation/deallocation when an arena * oscillates right on the cusp of needing a new chunk, cache the most * recently freed chunk. The spare is left in the arena's chunk trees * until it is deleted. * * There is one spare chunk per arena, rather than one spare total, in * order to avoid interactions between multiple threads that could make * a single spare inadequate. */ arena_chunk_t *spare; /* * Current count of pages within unused runs that are potentially * dirty, and for which madvise(... MADV_DONTNEED) has not been called. * By tracking this, we can institute a limit on how much dirty unused * memory is mapped for each arena. */ size_t ndirty; /* * Size/address-ordered tree of this arena's available runs. This tree * is used for first-best-fit run allocation. */ arena_avail_tree_t runs_avail; #ifdef MALLOC_BALANCE /* * The arena load balancing machinery needs to keep track of how much * lock contention there is. This value is exponentially averaged. */ uint32_t contention; #endif /* * bins is used to store rings of free regions of the following sizes, * assuming a 16-byte quantum, 4kB pagesize, and default MALLOC_OPTIONS. * * bins[i] | size | * --------+------+ * 0 | 2 | * 1 | 4 | * 2 | 8 | * --------+------+ * 3 | 16 | * 4 | 32 | * 5 | 48 | * 6 | 64 | * : : * : : * 33 | 496 | * 34 | 512 | * --------+------+ * 35 | 1024 | * 36 | 2048 | * --------+------+ */ arena_bin_t bins[1]; /* Dynamically sized. */ }; /******************************************************************************/ /* * Magazine data structures. */ #ifdef MALLOC_MAG typedef struct mag_s mag_t; struct mag_s { size_t binind; /* Index of associated bin. */ size_t nrounds; void *rounds[1]; /* Dynamically sized. */ }; /* * Magazines are lazily allocated, but once created, they remain until the * associated mag_rack is destroyed. */ typedef struct bin_mags_s bin_mags_t; struct bin_mags_s { mag_t *curmag; mag_t *sparemag; }; typedef struct mag_rack_s mag_rack_t; struct mag_rack_s { bin_mags_t bin_mags[1]; /* Dynamically sized. */ }; #endif /******************************************************************************/ /* * Data. */ /* Number of CPUs. */ static unsigned ncpus; /* VM page size. */ static size_t pagesize; static size_t pagesize_mask; static size_t pagesize_2pow; /* Various bin-related settings. */ #ifdef MALLOC_TINY /* Number of (2^n)-spaced tiny bins. */ # define ntbins ((unsigned)(QUANTUM_2POW - TINY_MIN_2POW)) #else # define ntbins 0 #endif static unsigned nqbins; /* Number of quantum-spaced bins. */ static unsigned ncbins; /* Number of cacheline-spaced bins. */ static unsigned nsbins; /* Number of subpage-spaced bins. */ static unsigned nbins; #ifdef MALLOC_TINY # define tspace_max ((size_t)(QUANTUM >> 1)) #endif #define qspace_min QUANTUM static size_t qspace_max; static size_t cspace_min; static size_t cspace_max; static size_t sspace_min; static size_t sspace_max; #define bin_maxclass sspace_max static uint8_t const *size2bin; /* * const_size2bin is a static constant lookup table that in the common case can * be used as-is for size2bin. For dynamically linked programs, this avoids * a page of memory overhead per process. */ #define S2B_1(i) i, #define S2B_2(i) S2B_1(i) S2B_1(i) #define S2B_4(i) S2B_2(i) S2B_2(i) #define S2B_8(i) S2B_4(i) S2B_4(i) #define S2B_16(i) S2B_8(i) S2B_8(i) #define S2B_32(i) S2B_16(i) S2B_16(i) #define S2B_64(i) S2B_32(i) S2B_32(i) #define S2B_128(i) S2B_64(i) S2B_64(i) #define S2B_256(i) S2B_128(i) S2B_128(i) static const uint8_t const_size2bin[(1U << PAGESIZE_2POW) - 255] = { S2B_1(0xffU) /* 0 */ #if (QUANTUM_2POW == 4) /* 64-bit system ************************/ # ifdef MALLOC_TINY S2B_2(0) /* 2 */ S2B_2(1) /* 4 */ S2B_4(2) /* 8 */ S2B_8(3) /* 16 */ # define S2B_QMIN 3 # else S2B_16(0) /* 16 */ # define S2B_QMIN 0 # endif S2B_16(S2B_QMIN + 1) /* 32 */ S2B_16(S2B_QMIN + 2) /* 48 */ S2B_16(S2B_QMIN + 3) /* 64 */ S2B_16(S2B_QMIN + 4) /* 80 */ S2B_16(S2B_QMIN + 5) /* 96 */ S2B_16(S2B_QMIN + 6) /* 112 */ S2B_16(S2B_QMIN + 7) /* 128 */ # define S2B_CMIN (S2B_QMIN + 8) #else /* 32-bit system ************************/ # ifdef MALLOC_TINY S2B_2(0) /* 2 */ S2B_2(1) /* 4 */ S2B_4(2) /* 8 */ # define S2B_QMIN 2 # else S2B_8(0) /* 8 */ # define S2B_QMIN 0 # endif S2B_8(S2B_QMIN + 1) /* 16 */ S2B_8(S2B_QMIN + 2) /* 24 */ S2B_8(S2B_QMIN + 3) /* 32 */ S2B_8(S2B_QMIN + 4) /* 40 */ S2B_8(S2B_QMIN + 5) /* 48 */ S2B_8(S2B_QMIN + 6) /* 56 */ S2B_8(S2B_QMIN + 7) /* 64 */ S2B_8(S2B_QMIN + 8) /* 72 */ S2B_8(S2B_QMIN + 9) /* 80 */ S2B_8(S2B_QMIN + 10) /* 88 */ S2B_8(S2B_QMIN + 11) /* 96 */ S2B_8(S2B_QMIN + 12) /* 104 */ S2B_8(S2B_QMIN + 13) /* 112 */ S2B_8(S2B_QMIN + 14) /* 120 */ S2B_8(S2B_QMIN + 15) /* 128 */ # define S2B_CMIN (S2B_QMIN + 16) #endif /****************************************/ S2B_64(S2B_CMIN + 0) /* 192 */ S2B_64(S2B_CMIN + 1) /* 256 */ S2B_64(S2B_CMIN + 2) /* 320 */ S2B_64(S2B_CMIN + 3) /* 384 */ S2B_64(S2B_CMIN + 4) /* 448 */ S2B_64(S2B_CMIN + 5) /* 512 */ # define S2B_SMIN (S2B_CMIN + 6) S2B_256(S2B_SMIN + 0) /* 768 */ S2B_256(S2B_SMIN + 1) /* 1024 */ S2B_256(S2B_SMIN + 2) /* 1280 */ S2B_256(S2B_SMIN + 3) /* 1536 */ S2B_256(S2B_SMIN + 4) /* 1792 */ S2B_256(S2B_SMIN + 5) /* 2048 */ S2B_256(S2B_SMIN + 6) /* 2304 */ S2B_256(S2B_SMIN + 7) /* 2560 */ S2B_256(S2B_SMIN + 8) /* 2816 */ S2B_256(S2B_SMIN + 9) /* 3072 */ S2B_256(S2B_SMIN + 10) /* 3328 */ S2B_256(S2B_SMIN + 11) /* 3584 */ S2B_256(S2B_SMIN + 12) /* 3840 */ #if (PAGESIZE_2POW == 13) S2B_256(S2B_SMIN + 13) /* 4096 */ S2B_256(S2B_SMIN + 14) /* 4352 */ S2B_256(S2B_SMIN + 15) /* 4608 */ S2B_256(S2B_SMIN + 16) /* 4864 */ S2B_256(S2B_SMIN + 17) /* 5120 */ S2B_256(S2B_SMIN + 18) /* 5376 */ S2B_256(S2B_SMIN + 19) /* 5632 */ S2B_256(S2B_SMIN + 20) /* 5888 */ S2B_256(S2B_SMIN + 21) /* 6144 */ S2B_256(S2B_SMIN + 22) /* 6400 */ S2B_256(S2B_SMIN + 23) /* 6656 */ S2B_256(S2B_SMIN + 24) /* 6912 */ S2B_256(S2B_SMIN + 25) /* 7168 */ S2B_256(S2B_SMIN + 26) /* 7424 */ S2B_256(S2B_SMIN + 27) /* 7680 */ S2B_256(S2B_SMIN + 28) /* 7936 */ #endif }; #undef S2B_1 #undef S2B_2 #undef S2B_4 #undef S2B_8 #undef S2B_16 #undef S2B_32 #undef S2B_64 #undef S2B_128 #undef S2B_256 #undef S2B_QMIN #undef S2B_CMIN #undef S2B_SMIN #ifdef MALLOC_MAG static size_t max_rounds; #endif /* Various chunk-related settings. */ static size_t chunksize; static size_t chunksize_mask; /* (chunksize - 1). */ static size_t chunk_npages; static size_t arena_chunk_header_npages; static size_t arena_maxclass; /* Max size class for arenas. */ /********/ /* * Chunks. */ /* Protects chunk-related data structures. */ static malloc_mutex_t huge_mtx; /* Tree of chunks that are stand-alone huge allocations. */ static extent_tree_t huge; #ifdef MALLOC_DSS /* * Protects sbrk() calls. This avoids malloc races among threads, though it * does not protect against races with threads that call sbrk() directly. */ static malloc_mutex_t dss_mtx; /* Base address of the DSS. */ static void *dss_base; /* Current end of the DSS, or ((void *)-1) if the DSS is exhausted. */ static void *dss_prev; /* Current upper limit on DSS addresses. */ static void *dss_max; /* * Trees of chunks that were previously allocated (trees differ only in node * ordering). These are used when allocating chunks, in an attempt to re-use * address space. Depending on function, different tree orderings are needed, * which is why there are two trees with the same contents. */ static extent_tree_t dss_chunks_szad; static extent_tree_t dss_chunks_ad; #endif #ifdef MALLOC_STATS /* Huge allocation statistics. */ static uint64_t huge_nmalloc; static uint64_t huge_ndalloc; static size_t huge_allocated; #endif /****************************/ /* * base (internal allocation). */ /* * Current pages that are being used for internal memory allocations. These * pages are carved up in cacheline-size quanta, so that there is no chance of * false cache line sharing. */ static void *base_pages; static void *base_next_addr; static void *base_past_addr; /* Addr immediately past base_pages. */ static extent_node_t *base_nodes; static malloc_mutex_t base_mtx; #ifdef MALLOC_STATS static size_t base_mapped; #endif /********/ /* * Arenas. */ /* * Arenas that are used to service external requests. Not all elements of the * arenas array are necessarily used; arenas are created lazily as needed. */ static arena_t **arenas; static unsigned narenas; #ifndef NO_TLS # ifdef MALLOC_BALANCE static unsigned narenas_2pow; # else static unsigned next_arena; # endif #endif static pthread_mutex_t arenas_lock; /* Protects arenas initialization. */ #ifndef NO_TLS /* * Map of pthread_self() --> arenas[???], used for selecting an arena to use * for allocations. */ static __thread arena_t *arenas_map; #endif #ifdef MALLOC_MAG /* * Map of thread-specific magazine racks, used for thread-specific object * caching. */ static __thread mag_rack_t *mag_rack; #endif #ifdef MALLOC_STATS /* Chunk statistics. */ static chunk_stats_t stats_chunks; #endif /*******************************/ /* * Runtime configuration options. */ const char *_malloc_options; #ifndef MALLOC_PRODUCTION static bool opt_abort = true; static bool opt_junk = true; #else static bool opt_abort = false; static bool opt_junk = false; #endif #ifdef MALLOC_DSS static bool opt_dss = true; static bool opt_mmap = true; #endif #ifdef MALLOC_MAG static bool opt_mag = true; static size_t opt_mag_size_2pow = MAG_SIZE_2POW_DEFAULT; #endif static size_t opt_dirty_max = DIRTY_MAX_DEFAULT; #ifdef MALLOC_BALANCE static uint64_t opt_balance_threshold = BALANCE_THRESHOLD_DEFAULT; #endif static bool opt_print_stats = false; static size_t opt_qspace_max_2pow = QSPACE_MAX_2POW_DEFAULT; static size_t opt_cspace_max_2pow = CSPACE_MAX_2POW_DEFAULT; static size_t opt_chunk_2pow = CHUNK_2POW_DEFAULT; static bool opt_utrace = false; static bool opt_sysv = false; static bool opt_xmalloc = false; static bool opt_zero = false; static int opt_narenas_lshift = 0; typedef struct { void *p; size_t s; void *r; } malloc_utrace_t; #ifdef MALLOC_STATS #define UTRACE(a, b, c) \ if (opt_utrace) { \ malloc_utrace_t ut; \ ut.p = (a); \ ut.s = (b); \ ut.r = (c); \ utrace(&ut, sizeof(ut)); \ } #else #define UTRACE(a, b, c) #endif /******************************************************************************/ /* * Begin function prototypes for non-inline static functions. */ static bool malloc_mutex_init(malloc_mutex_t *mutex); static bool malloc_spin_init(pthread_mutex_t *lock); static void wrtmessage(const char *p1, const char *p2, const char *p3, const char *p4); #ifdef MALLOC_STATS static void malloc_printf(const char *format, ...); #endif static char *umax2s(uintmax_t x, char *s); #ifdef MALLOC_DSS static bool base_pages_alloc_dss(size_t minsize); #endif static bool base_pages_alloc_mmap(size_t minsize); static bool base_pages_alloc(size_t minsize); static void *base_alloc(size_t size); static extent_node_t *base_node_alloc(void); static void base_node_dealloc(extent_node_t *node); #ifdef MALLOC_STATS static void stats_print(arena_t *arena); #endif static void *pages_map(void *addr, size_t size); static void pages_unmap(void *addr, size_t size); #ifdef MALLOC_DSS static void *chunk_alloc_dss(size_t size); static void *chunk_recycle_dss(size_t size, bool zero); #endif static void *chunk_alloc_mmap(size_t size); static void *chunk_alloc(size_t size, bool zero); #ifdef MALLOC_DSS static extent_node_t *chunk_dealloc_dss_record(void *chunk, size_t size); static bool chunk_dealloc_dss(void *chunk, size_t size); #endif static void chunk_dealloc_mmap(void *chunk, size_t size); static void chunk_dealloc(void *chunk, size_t size); #ifndef NO_TLS static arena_t *choose_arena_hard(void); #endif static void arena_run_split(arena_t *arena, arena_run_t *run, size_t size, bool large, bool zero); static arena_chunk_t *arena_chunk_alloc(arena_t *arena); static void arena_chunk_dealloc(arena_t *arena, arena_chunk_t *chunk); static arena_run_t *arena_run_alloc(arena_t *arena, size_t size, bool large, bool zero); static void arena_purge(arena_t *arena); static void arena_run_dalloc(arena_t *arena, arena_run_t *run, bool dirty); static void arena_run_trim_head(arena_t *arena, arena_chunk_t *chunk, arena_run_t *run, size_t oldsize, size_t newsize); static void arena_run_trim_tail(arena_t *arena, arena_chunk_t *chunk, arena_run_t *run, size_t oldsize, size_t newsize, bool dirty); static arena_run_t *arena_bin_nonfull_run_get(arena_t *arena, arena_bin_t *bin); static void *arena_bin_malloc_hard(arena_t *arena, arena_bin_t *bin); static size_t arena_bin_run_size_calc(arena_bin_t *bin, size_t min_run_size); #ifdef MALLOC_BALANCE static void arena_lock_balance_hard(arena_t *arena); #endif #ifdef MALLOC_MAG static void mag_load(mag_t *mag); #endif static void *arena_malloc_large(arena_t *arena, size_t size, bool zero); static void *arena_palloc(arena_t *arena, size_t alignment, size_t size, size_t alloc_size); static size_t arena_salloc(const void *ptr); #ifdef MALLOC_MAG static void mag_unload(mag_t *mag); #endif static void arena_dalloc_large(arena_t *arena, arena_chunk_t *chunk, void *ptr); static void arena_ralloc_large_shrink(arena_t *arena, arena_chunk_t *chunk, void *ptr, size_t size, size_t oldsize); static bool arena_ralloc_large_grow(arena_t *arena, arena_chunk_t *chunk, void *ptr, size_t size, size_t oldsize); static bool arena_ralloc_large(void *ptr, size_t size, size_t oldsize); static void *arena_ralloc(void *ptr, size_t size, size_t oldsize); static bool arena_new(arena_t *arena); static arena_t *arenas_extend(unsigned ind); #ifdef MALLOC_MAG static mag_t *mag_create(arena_t *arena, size_t binind); static void mag_destroy(mag_t *mag); static mag_rack_t *mag_rack_create(arena_t *arena); static void mag_rack_destroy(mag_rack_t *rack); #endif static void *huge_malloc(size_t size, bool zero); static void *huge_palloc(size_t alignment, size_t size); static void *huge_ralloc(void *ptr, size_t size, size_t oldsize); static void huge_dalloc(void *ptr); static void malloc_print_stats(void); #ifdef MALLOC_DEBUG static void size2bin_validate(void); #endif static bool size2bin_init(void); static bool size2bin_init_hard(void); static unsigned malloc_ncpus(void); static bool malloc_init_hard(void); void _malloc_prefork(void); void _malloc_postfork(void); /* * End function prototypes. */ /******************************************************************************/ /* * Functions missing prototypes which caused -Werror to fail. * Not sure if it has any side effects. * */ size_t malloc_usable_size(const void *ptr); void _malloc_thread_cleanup(void); static void wrtmessage(const char *p1, const char *p2, const char *p3, const char *p4) { write(STDERR_FILENO, p1, strlen(p1)); write(STDERR_FILENO, p2, strlen(p2)); write(STDERR_FILENO, p3, strlen(p3)); write(STDERR_FILENO, p4, strlen(p4)); } #define _malloc_message malloc_message void (*_malloc_message)(const char *p1, const char *p2, const char *p3, const char *p4) = wrtmessage; /* * We don't want to depend on vsnprintf() for production builds, since that can * cause unnecessary bloat for static binaries. umax2s() provides minimal * integer printing functionality, so that malloc_printf() use can be limited to * MALLOC_STATS code. */ #define UMAX2S_BUFSIZE 21 static char * umax2s(uintmax_t x, char *s) { unsigned i; i = UMAX2S_BUFSIZE - 1; s[i] = '\0'; do { i--; s[i] = "0123456789"[x % 10]; x /= 10; } while (x > 0); return (&s[i]); } /* * Define a custom assert() in order to reduce the chances of deadlock during * assertion failure. */ #ifdef MALLOC_DEBUG # define assert(e) do { \ if (!(e)) { \ char line_buf[UMAX2S_BUFSIZE]; \ _malloc_message(__FILE__, ":", umax2s(__LINE__, \ line_buf), ": Failed assertion: "); \ _malloc_message("\"", #e, "\"\n", ""); \ abort(); \ } \ } while (0) #else #define assert(e) #endif #ifdef MALLOC_STATS static int utrace(const void *addr, size_t len) { malloc_utrace_t *ut = (malloc_utrace_t *)addr; assert(len == sizeof(malloc_utrace_t)); if (ut->p == NULL && ut->s == 0 && ut->r == NULL) malloc_printf("%d x USER malloc_init()\n", getpid()); else if (ut->p == NULL && ut->r != NULL) { malloc_printf("%d x USER %p = malloc(%zu)\n", getpid(), ut->r, ut->s); } else if (ut->p != NULL && ut->r != NULL) { malloc_printf("%d x USER %p = realloc(%p, %zu)\n", getpid(), ut->r, ut->p, ut->s); } else malloc_printf("%d x USER free(%p)\n", getpid(), ut->p); return (0); } #endif static inline const char * _getprogname(void) { return (""); } #ifdef MALLOC_STATS /* * Print to stderr in such a way as to (hopefully) avoid memory allocation. */ static void malloc_printf(const char *format, ...) { char buf[4096]; va_list ap; va_start(ap, format); vsnprintf(buf, sizeof(buf), format, ap); va_end(ap); _malloc_message(buf, "", "", ""); } #endif /******************************************************************************/ /* * Begin mutex. */ static bool malloc_mutex_init(malloc_mutex_t *mutex) { pthread_mutexattr_t attr; if (pthread_mutexattr_init(&attr) != 0) return (true); pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP); if (pthread_mutex_init(mutex, &attr) != 0) { pthread_mutexattr_destroy(&attr); return (true); } pthread_mutexattr_destroy(&attr); return (false); } static inline void malloc_mutex_lock(malloc_mutex_t *mutex) { if (__isthreaded) pthread_mutex_lock(mutex); } static inline void malloc_mutex_unlock(malloc_mutex_t *mutex) { if (__isthreaded) pthread_mutex_unlock(mutex); } /* * End mutex. */ /******************************************************************************/ /* * Begin spin lock. Spin locks here are actually adaptive mutexes that block * after a period of spinning, because unbounded spinning would allow for * priority inversion. */ static bool malloc_spin_init(pthread_mutex_t *lock) { if (pthread_mutex_init(lock, NULL) != 0) return (true); return (false); } static inline unsigned malloc_spin_lock(pthread_mutex_t *lock) { unsigned ret = 0; if (__isthreaded) { if (pthread_mutex_trylock(lock) != 0) { unsigned i; volatile unsigned j; /* Exponentially back off. */ for (i = 1; i <= SPIN_LIMIT_2POW; i++) { for (j = 0; j < (1U << i); j++) { ret++; CPU_SPINWAIT; } if (pthread_mutex_trylock(lock) == 0) return (ret); } /* * Spinning failed. Block until the lock becomes * available, in order to avoid indefinite priority * inversion. */ pthread_mutex_lock(lock); assert((ret << BLOCK_COST_2POW) != 0); return (ret << BLOCK_COST_2POW); } } return (ret); } static inline void malloc_spin_unlock(pthread_mutex_t *lock) { if (__isthreaded) pthread_mutex_unlock(lock); } /* * End spin lock. */ /******************************************************************************/ /* * Begin Utility functions/macros. */ /* Return the chunk address for allocation address a. */ #define CHUNK_ADDR2BASE(a) \ ((void *)((uintptr_t)(a) & ~chunksize_mask)) /* Return the chunk offset of address a. */ #define CHUNK_ADDR2OFFSET(a) \ ((size_t)((uintptr_t)(a) & chunksize_mask)) /* Return the smallest chunk multiple that is >= s. */ #define CHUNK_CEILING(s) \ (((s) + chunksize_mask) & ~chunksize_mask) /* Return the smallest quantum multiple that is >= a. */ #define QUANTUM_CEILING(a) \ (((a) + QUANTUM_MASK) & ~QUANTUM_MASK) /* Return the smallest cacheline multiple that is >= s. */ #define CACHELINE_CEILING(s) \ (((s) + CACHELINE_MASK) & ~CACHELINE_MASK) /* Return the smallest subpage multiple that is >= s. */ #define SUBPAGE_CEILING(s) \ (((s) + SUBPAGE_MASK) & ~SUBPAGE_MASK) /* Return the smallest pagesize multiple that is >= s. */ #define PAGE_CEILING(s) \ (((s) + pagesize_mask) & ~pagesize_mask) #ifdef MALLOC_TINY /* Compute the smallest power of 2 that is >= x. */ static inline size_t pow2_ceil(size_t x) { x--; x |= x >> 1; x |= x >> 2; x |= x >> 4; x |= x >> 8; x |= x >> 16; #if (SIZEOF_PTR == 8) x |= x >> 32; #endif x++; return (x); } #endif #ifdef MALLOC_BALANCE /* * Use a simple linear congruential pseudo-random number generator: * * prn(y) = (a*x + c) % m * * where the following constants ensure maximal period: * * a == Odd number (relatively prime to 2^n), and (a-1) is a multiple of 4. * c == Odd number (relatively prime to 2^n). * m == 2^32 * * See Knuth's TAOCP 3rd Ed., Vol. 2, pg. 17 for details on these constraints. * * This choice of m has the disadvantage that the quality of the bits is * proportional to bit position. For example. the lowest bit has a cycle of 2, * the next has a cycle of 4, etc. For this reason, we prefer to use the upper * bits. */ # define PRN_DEFINE(suffix, var, a, c) \ static inline void \ sprn_##suffix(uint32_t seed) \ { \ var = seed; \ } \ \ static inline uint32_t \ prn_##suffix(uint32_t lg_range) \ { \ uint32_t ret, x; \ \ assert(lg_range > 0); \ assert(lg_range <= 32); \ \ x = (var * (a)) + (c); \ var = x; \ ret = x >> (32 - lg_range); \ \ return (ret); \ } # define SPRN(suffix, seed) sprn_##suffix(seed) # define PRN(suffix, lg_range) prn_##suffix(lg_range) #endif #ifdef MALLOC_BALANCE /* Define the PRNG used for arena assignment. */ static __thread uint32_t balance_x; PRN_DEFINE(balance, balance_x, 1297, 1301) #endif /******************************************************************************/ #ifdef MALLOC_DSS static bool base_pages_alloc_dss(size_t minsize) { /* * Do special DSS allocation here, since base allocations don't need to * be chunk-aligned. */ malloc_mutex_lock(&dss_mtx); if (dss_prev != (void *)-1) { intptr_t incr; size_t csize = CHUNK_CEILING(minsize); do { /* Get the current end of the DSS. */ dss_max = sbrk(0); /* * Calculate how much padding is necessary to * chunk-align the end of the DSS. Don't worry about * dss_max not being chunk-aligned though. */ incr = (intptr_t)chunksize - (intptr_t)CHUNK_ADDR2OFFSET(dss_max); assert(incr >= 0); if ((size_t)incr < minsize) incr += csize; dss_prev = sbrk(incr); if (dss_prev == dss_max) { /* Success. */ dss_max = (void *)((intptr_t)dss_prev + incr); base_pages = dss_prev; base_next_addr = base_pages; base_past_addr = dss_max; #ifdef MALLOC_STATS base_mapped += incr; #endif malloc_mutex_unlock(&dss_mtx); return (false); } } while (dss_prev != (void *)-1); } malloc_mutex_unlock(&dss_mtx); return (true); } #endif static bool base_pages_alloc_mmap(size_t minsize) { size_t csize; assert(minsize != 0); csize = PAGE_CEILING(minsize); base_pages = pages_map(NULL, csize); if (base_pages == NULL) return (true); base_next_addr = base_pages; base_past_addr = (void *)((uintptr_t)base_pages + csize); #ifdef MALLOC_STATS base_mapped += csize; #endif return (false); } static bool base_pages_alloc(size_t minsize) { #ifdef MALLOC_DSS if (opt_dss) { if (base_pages_alloc_dss(minsize) == false) return (false); } if (opt_mmap && minsize != 0) #endif { if (base_pages_alloc_mmap(minsize) == false) return (false); } return (true); } static void * base_alloc(size_t size) { void *ret; size_t csize; /* Round size up to nearest multiple of the cacheline size. */ csize = CACHELINE_CEILING(size); malloc_mutex_lock(&base_mtx); /* Make sure there's enough space for the allocation. */ if ((uintptr_t)base_next_addr + csize > (uintptr_t)base_past_addr) { if (base_pages_alloc(csize)) { malloc_mutex_unlock(&base_mtx); return (NULL); } } /* Allocate. */ ret = base_next_addr; base_next_addr = (void *)((uintptr_t)base_next_addr + csize); malloc_mutex_unlock(&base_mtx); return (ret); } static extent_node_t * base_node_alloc(void) { extent_node_t *ret; malloc_mutex_lock(&base_mtx); if (base_nodes != NULL) { ret = base_nodes; base_nodes = *(extent_node_t **)ret; malloc_mutex_unlock(&base_mtx); } else { malloc_mutex_unlock(&base_mtx); ret = (extent_node_t *)base_alloc(sizeof(extent_node_t)); } return (ret); } static void base_node_dealloc(extent_node_t *node) { malloc_mutex_lock(&base_mtx); *(extent_node_t **)node = base_nodes; base_nodes = node; malloc_mutex_unlock(&base_mtx); } /******************************************************************************/ #ifdef MALLOC_STATS static void stats_print(arena_t *arena) { unsigned i, gap_start; malloc_printf("dirty: %zu page%s dirty, %llu sweep%s," " %llu madvise%s, %llu page%s purged\n", arena->ndirty, arena->ndirty == 1 ? "" : "s", arena->stats.npurge, arena->stats.npurge == 1 ? "" : "s", arena->stats.nmadvise, arena->stats.nmadvise == 1 ? "" : "s", arena->stats.purged, arena->stats.purged == 1 ? "" : "s"); malloc_printf(" allocated nmalloc ndalloc\n"); malloc_printf("small: %12zu %12llu %12llu\n", arena->stats.allocated_small, arena->stats.nmalloc_small, arena->stats.ndalloc_small); malloc_printf("large: %12zu %12llu %12llu\n", arena->stats.allocated_large, arena->stats.nmalloc_large, arena->stats.ndalloc_large); malloc_printf("total: %12zu %12llu %12llu\n", arena->stats.allocated_small + arena->stats.allocated_large, arena->stats.nmalloc_small + arena->stats.nmalloc_large, arena->stats.ndalloc_small + arena->stats.ndalloc_large); malloc_printf("mapped: %12zu\n", arena->stats.mapped); #ifdef MALLOC_MAG if (__isthreaded && opt_mag) { malloc_printf("bins: bin size regs pgs mags " "newruns reruns maxruns curruns\n"); } else { #endif malloc_printf("bins: bin size regs pgs requests " "newruns reruns maxruns curruns\n"); #ifdef MALLOC_MAG } #endif for (i = 0, gap_start = UINT_MAX; i < nbins; i++) { if (arena->bins[i].stats.nruns == 0) { if (gap_start == UINT_MAX) gap_start = i; } else { if (gap_start != UINT_MAX) { if (i > gap_start + 1) { /* Gap of more than one size class. */ malloc_printf("[%u..%u]\n", gap_start, i - 1); } else { /* Gap of one size class. */ malloc_printf("[%u]\n", gap_start); } gap_start = UINT_MAX; } malloc_printf( "%13u %1s %4u %4u %3u %9llu %9llu" " %9llu %7lu %7lu\n", i, i < ntbins ? "T" : i < ntbins + nqbins ? "Q" : i < ntbins + nqbins + ncbins ? "C" : "S", arena->bins[i].reg_size, arena->bins[i].nregs, arena->bins[i].run_size >> pagesize_2pow, #ifdef MALLOC_MAG (__isthreaded && opt_mag) ? arena->bins[i].stats.nmags : #endif arena->bins[i].stats.nrequests, arena->bins[i].stats.nruns, arena->bins[i].stats.reruns, arena->bins[i].stats.highruns, arena->bins[i].stats.curruns); } } if (gap_start != UINT_MAX) { if (i > gap_start + 1) { /* Gap of more than one size class. */ malloc_printf("[%u..%u]\n", gap_start, i - 1); } else { /* Gap of one size class. */ malloc_printf("[%u]\n", gap_start); } } } #endif /* * End Utility functions/macros. */ /******************************************************************************/ /* * Begin extent tree code. */ #ifdef MALLOC_DSS static inline int extent_szad_comp(extent_node_t *a, extent_node_t *b) { int ret; size_t a_size = a->size; size_t b_size = b->size; ret = (a_size > b_size) - (a_size < b_size); if (ret == 0) { uintptr_t a_addr = (uintptr_t)a->addr; uintptr_t b_addr = (uintptr_t)b->addr; ret = (a_addr > b_addr) - (a_addr < b_addr); } return (ret); } /* Wrap red-black tree macros in functions. */ rb_wrap(static ATTRIBUTE_UNUSED, extent_tree_szad_, extent_tree_t, extent_node_t, link_szad, extent_szad_comp) #endif static inline int extent_ad_comp(extent_node_t *a, extent_node_t *b) { uintptr_t a_addr = (uintptr_t)a->addr; uintptr_t b_addr = (uintptr_t)b->addr; return ((a_addr > b_addr) - (a_addr < b_addr)); } /* Wrap red-black tree macros in functions. */ rb_wrap(static ATTRIBUTE_UNUSED, extent_tree_ad_, extent_tree_t, extent_node_t, link_ad, extent_ad_comp) /* * End extent tree code. */ /******************************************************************************/ /* * Begin chunk management functions. */ static void * pages_map(void *addr, size_t size) { void *ret; /* * We don't use MAP_FIXED here, because it can cause the *replacement* * of existing mappings, and we only want to create new mappings. */ ret = mmap(addr, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); assert(ret != NULL); if (ret == MAP_FAILED) ret = NULL; else if (addr != NULL && ret != addr) { /* * We succeeded in mapping memory, but not in the right place. */ if (munmap(ret, size) == -1) { char buf[STRERROR_BUF]; strerror_r(errno, buf, sizeof(buf)); _malloc_message(_getprogname(), ": (malloc) Error in munmap(): ", buf, "\n"); if (opt_abort) abort(); } ret = NULL; } assert(ret == NULL || (addr == NULL && ret != addr) || (addr != NULL && ret == addr)); return (ret); } static void pages_unmap(void *addr, size_t size) { if (munmap(addr, size) == -1) { char buf[STRERROR_BUF]; strerror_r(errno, buf, sizeof(buf)); _malloc_message(_getprogname(), ": (malloc) Error in munmap(): ", buf, "\n"); if (opt_abort) abort(); } } #ifdef MALLOC_DSS static void * chunk_alloc_dss(size_t size) { /* * sbrk() uses a signed increment argument, so take care not to * interpret a huge allocation request as a negative increment. */ if ((intptr_t)size < 0) return (NULL); malloc_mutex_lock(&dss_mtx); if (dss_prev != (void *)-1) { intptr_t incr; /* * The loop is necessary to recover from races with other * threads that are using the DSS for something other than * malloc. */ do { void *ret; /* Get the current end of the DSS. */ dss_max = sbrk(0); /* * Calculate how much padding is necessary to * chunk-align the end of the DSS. */ incr = (intptr_t)size - (intptr_t)CHUNK_ADDR2OFFSET(dss_max); if (incr == (intptr_t)size) ret = dss_max; else { ret = (void *)((intptr_t)dss_max + incr); incr += size; } dss_prev = sbrk(incr); if (dss_prev == dss_max) { /* Success. */ dss_max = (void *)((intptr_t)dss_prev + incr); malloc_mutex_unlock(&dss_mtx); return (ret); } } while (dss_prev != (void *)-1); } malloc_mutex_unlock(&dss_mtx); return (NULL); } static void * chunk_recycle_dss(size_t size, bool zero) { extent_node_t *node, key; key.addr = NULL; key.size = size; malloc_mutex_lock(&dss_mtx); node = extent_tree_szad_nsearch(&dss_chunks_szad, &key); if (node != NULL) { void *ret = node->addr; /* Remove node from the tree. */ extent_tree_szad_remove(&dss_chunks_szad, node); if (node->size == size) { extent_tree_ad_remove(&dss_chunks_ad, node); base_node_dealloc(node); } else { /* * Insert the remainder of node's address range as a * smaller chunk. Its position within dss_chunks_ad * does not change. */ assert(node->size > size); node->addr = (void *)((uintptr_t)node->addr + size); node->size -= size; extent_tree_szad_insert(&dss_chunks_szad, node); } malloc_mutex_unlock(&dss_mtx); if (zero) memset(ret, 0, size); return (ret); } malloc_mutex_unlock(&dss_mtx); return (NULL); } #endif static void * chunk_alloc_mmap(size_t size) { void *ret; size_t offset; /* * Ideally, there would be a way to specify alignment to mmap() (like * NetBSD has), but in the absence of such a feature, we have to work * hard to efficiently create aligned mappings. The reliable, but * expensive method is to create a mapping that is over-sized, then * trim the excess. However, that always results in at least one call * to pages_unmap(). * * A more optimistic approach is to try mapping precisely the right * amount, then try to append another mapping if alignment is off. In * practice, this works out well as long as the application is not * interleaving mappings via direct mmap() calls. If we do run into a * situation where there is an interleaved mapping and we are unable to * extend an unaligned mapping, our best option is to momentarily * revert to the reliable-but-expensive method. This will tend to * leave a gap in the memory map that is too small to cause later * problems for the optimistic method. */ ret = pages_map(NULL, size); if (ret == NULL) return (NULL); offset = CHUNK_ADDR2OFFSET(ret); if (offset != 0) { /* Try to extend chunk boundary. */ if (pages_map((void *)((uintptr_t)ret + size), chunksize - offset) == NULL) { /* * Extension failed. Clean up, then revert to the * reliable-but-expensive method. */ pages_unmap(ret, size); /* Beware size_t wrap-around. */ if (size + chunksize <= size) return NULL; ret = pages_map(NULL, size + chunksize); if (ret == NULL) return (NULL); /* Clean up unneeded leading/trailing space. */ offset = CHUNK_ADDR2OFFSET(ret); if (offset != 0) { /* Leading space. */ pages_unmap(ret, chunksize - offset); ret = (void *)((uintptr_t)ret + (chunksize - offset)); /* Trailing space. */ pages_unmap((void *)((uintptr_t)ret + size), offset); } else { /* Trailing space only. */ pages_unmap((void *)((uintptr_t)ret + size), chunksize); } } else { /* Clean up unneeded leading space. */ pages_unmap(ret, chunksize - offset); ret = (void *)((uintptr_t)ret + (chunksize - offset)); } } return (ret); } static void * chunk_alloc(size_t size, bool zero) { void *ret; (void)zero; /* XXX */ assert(size != 0); assert((size & chunksize_mask) == 0); #ifdef MALLOC_DSS if (opt_dss) { ret = chunk_recycle_dss(size, zero); if (ret != NULL) { goto RETURN; } ret = chunk_alloc_dss(size); if (ret != NULL) goto RETURN; } if (opt_mmap) #endif { ret = chunk_alloc_mmap(size); if (ret != NULL) goto RETURN; } /* All strategies for allocation failed. */ ret = NULL; RETURN: #ifdef MALLOC_STATS if (ret != NULL) { stats_chunks.nchunks += (size / chunksize); stats_chunks.curchunks += (size / chunksize); } if (stats_chunks.curchunks > stats_chunks.highchunks) stats_chunks.highchunks = stats_chunks.curchunks; #endif assert(CHUNK_ADDR2BASE(ret) == ret); return (ret); } #ifdef MALLOC_DSS static extent_node_t * chunk_dealloc_dss_record(void *chunk, size_t size) { extent_node_t *node, *prev, key; key.addr = (void *)((uintptr_t)chunk + size); node = extent_tree_ad_nsearch(&dss_chunks_ad, &key); /* Try to coalesce forward. */ if (node != NULL && node->addr == key.addr) { /* * Coalesce chunk with the following address range. This does * not change the position within dss_chunks_ad, so only * remove/insert from/into dss_chunks_szad. */ extent_tree_szad_remove(&dss_chunks_szad, node); node->addr = chunk; node->size += size; extent_tree_szad_insert(&dss_chunks_szad, node); } else { /* * Coalescing forward failed, so insert a new node. Drop * dss_mtx during node allocation, since it is possible that a * new base chunk will be allocated. */ malloc_mutex_unlock(&dss_mtx); node = base_node_alloc(); malloc_mutex_lock(&dss_mtx); if (node == NULL) return (NULL); node->addr = chunk; node->size = size; extent_tree_ad_insert(&dss_chunks_ad, node); extent_tree_szad_insert(&dss_chunks_szad, node); } /* Try to coalesce backward. */ prev = extent_tree_ad_prev(&dss_chunks_ad, node); if (prev != NULL && (void *)((uintptr_t)prev->addr + prev->size) == chunk) { /* * Coalesce chunk with the previous address range. This does * not change the position within dss_chunks_ad, so only * remove/insert node from/into dss_chunks_szad. */ extent_tree_szad_remove(&dss_chunks_szad, prev); extent_tree_ad_remove(&dss_chunks_ad, prev); extent_tree_szad_remove(&dss_chunks_szad, node); node->addr = prev->addr; node->size += prev->size; extent_tree_szad_insert(&dss_chunks_szad, node); base_node_dealloc(prev); } return (node); } static bool chunk_dealloc_dss(void *chunk, size_t size) { malloc_mutex_lock(&dss_mtx); if ((uintptr_t)chunk >= (uintptr_t)dss_base && (uintptr_t)chunk < (uintptr_t)dss_max) { extent_node_t *node; /* Try to coalesce with other unused chunks. */ node = chunk_dealloc_dss_record(chunk, size); if (node != NULL) { chunk = node->addr; size = node->size; } /* Get the current end of the DSS. */ dss_max = sbrk(0); /* * Try to shrink the DSS if this chunk is at the end of the * DSS. The sbrk() call here is subject to a race condition * with threads that use brk(2) or sbrk(2) directly, but the * alternative would be to leak memory for the sake of poorly * designed multi-threaded programs. */ if ((void *)((uintptr_t)chunk + size) == dss_max && (dss_prev = sbrk(-(intptr_t)size)) == dss_max) { /* Success. */ dss_max = (void *)((intptr_t)dss_prev - (intptr_t)size); if (node != NULL) { extent_tree_szad_remove(&dss_chunks_szad, node); extent_tree_ad_remove(&dss_chunks_ad, node); base_node_dealloc(node); } malloc_mutex_unlock(&dss_mtx); } else { malloc_mutex_unlock(&dss_mtx); madvise(chunk, size, MADV_DONTNEED); } return (false); } malloc_mutex_unlock(&dss_mtx); return (true); } #endif static void chunk_dealloc_mmap(void *chunk, size_t size) { pages_unmap(chunk, size); } static void chunk_dealloc(void *chunk, size_t size) { assert(chunk != NULL); assert(CHUNK_ADDR2BASE(chunk) == chunk); assert(size != 0); assert((size & chunksize_mask) == 0); #ifdef MALLOC_STATS stats_chunks.curchunks -= (size / chunksize); #endif #ifdef MALLOC_DSS if (opt_dss) { if (chunk_dealloc_dss(chunk, size) == false) return; } if (opt_mmap) #endif chunk_dealloc_mmap(chunk, size); } /* * End chunk management functions. */ /******************************************************************************/ /* * Begin arena. */ /* * Choose an arena based on a per-thread value (fast-path code, calls slow-path * code if necessary). */ static inline arena_t * choose_arena(void) { arena_t *ret; /* * We can only use TLS if this is a PIC library, since for the static * library version, libc's malloc is used by TLS allocation, which * introduces a bootstrapping issue. */ #ifndef NO_TLS if (__isthreaded == false) { /* Avoid the overhead of TLS for single-threaded operation. */ return (arenas[0]); } ret = arenas_map; if (ret == NULL) { ret = choose_arena_hard(); assert(ret != NULL); } #else if (__isthreaded && narenas > 1) { unsigned long ind; /* * Hash pthread_self() to one of the arenas. There is a prime * number of arenas, so this has a reasonable chance of * working. Even so, the hashing can be easily thwarted by * inconvenient pthread_self() values. Without specific * knowledge of how pthread_self() calculates values, we can't * easily do much better than this. */ ind = (unsigned long) pthread_self() % narenas; /* * Optimistially assume that arenas[ind] has been initialized. * At worst, we find out that some other thread has already * done so, after acquiring the lock in preparation. Note that * this lazy locking also has the effect of lazily forcing * cache coherency; without the lock acquisition, there's no * guarantee that modification of arenas[ind] by another thread * would be seen on this CPU for an arbitrary amount of time. * * In general, this approach to modifying a synchronized value * isn't a good idea, but in this case we only ever modify the * value once, so things work out well. */ ret = arenas[ind]; if (ret == NULL) { /* * Avoid races with another thread that may have already * initialized arenas[ind]. */ malloc_spin_lock(&arenas_lock); if (arenas[ind] == NULL) ret = arenas_extend((unsigned)ind); else ret = arenas[ind]; malloc_spin_unlock(&arenas_lock); } } else ret = arenas[0]; #endif assert(ret != NULL); return (ret); } #ifndef NO_TLS /* * Choose an arena based on a per-thread value (slow-path code only, called * only by choose_arena()). */ static arena_t * choose_arena_hard(void) { arena_t *ret; assert(__isthreaded); #ifdef MALLOC_BALANCE /* Seed the PRNG used for arena load balancing. */ SPRN(balance, (uint32_t)(uintptr_t)(pthread_self())); #endif if (narenas > 1) { #ifdef MALLOC_BALANCE unsigned ind; ind = PRN(balance, narenas_2pow); if ((ret = arenas[ind]) == NULL) { malloc_spin_lock(&arenas_lock); if ((ret = arenas[ind]) == NULL) ret = arenas_extend(ind); malloc_spin_unlock(&arenas_lock); } #else malloc_spin_lock(&arenas_lock); if ((ret = arenas[next_arena]) == NULL) ret = arenas_extend(next_arena); next_arena = (next_arena + 1) % narenas; malloc_spin_unlock(&arenas_lock); #endif } else ret = arenas[0]; arenas_map = ret; return (ret); } #endif static inline int arena_chunk_comp(arena_chunk_t *a, arena_chunk_t *b) { uintptr_t a_chunk = (uintptr_t)a; uintptr_t b_chunk = (uintptr_t)b; assert(a != NULL); assert(b != NULL); return ((a_chunk > b_chunk) - (a_chunk < b_chunk)); } /* Wrap red-black tree macros in functions. */ rb_wrap(static ATTRIBUTE_UNUSED, arena_chunk_tree_dirty_, arena_chunk_tree_t, arena_chunk_t, link_dirty, arena_chunk_comp) static inline int arena_run_comp(arena_chunk_map_t *a, arena_chunk_map_t *b) { uintptr_t a_mapelm = (uintptr_t)a; uintptr_t b_mapelm = (uintptr_t)b; assert(a != NULL); assert(b != NULL); return ((a_mapelm > b_mapelm) - (a_mapelm < b_mapelm)); } /* Wrap red-black tree macros in functions. */ rb_wrap(static ATTRIBUTE_UNUSED, arena_run_tree_, arena_run_tree_t, arena_chunk_map_t, link, arena_run_comp) static inline int arena_avail_comp(arena_chunk_map_t *a, arena_chunk_map_t *b) { int ret; size_t a_size = a->bits & ~pagesize_mask; size_t b_size = b->bits & ~pagesize_mask; ret = (a_size > b_size) - (a_size < b_size); if (ret == 0) { uintptr_t a_mapelm, b_mapelm; if ((a->bits & CHUNK_MAP_KEY) == 0) a_mapelm = (uintptr_t)a; else { /* * Treat keys as though they are lower than anything * else. */ a_mapelm = 0; } b_mapelm = (uintptr_t)b; ret = (a_mapelm > b_mapelm) - (a_mapelm < b_mapelm); } return (ret); } /* Wrap red-black tree macros in functions. */ rb_wrap(static ATTRIBUTE_UNUSED, arena_avail_tree_, arena_avail_tree_t, arena_chunk_map_t, link, arena_avail_comp) static inline void * arena_run_reg_alloc(arena_run_t *run, arena_bin_t *bin) { void *ret; unsigned i, mask, bit, regind; assert(run->magic == ARENA_RUN_MAGIC); assert(run->regs_minelm < bin->regs_mask_nelms); /* * Move the first check outside the loop, so that run->regs_minelm can * be updated unconditionally, without the possibility of updating it * multiple times. */ i = run->regs_minelm; mask = run->regs_mask[i]; if (mask != 0) { /* Usable allocation found. */ bit = ffs((int)mask) - 1; regind = ((i << (SIZEOF_INT_2POW + 3)) + bit); assert(regind < bin->nregs); ret = (void *)(((uintptr_t)run) + bin->reg0_offset + (bin->reg_size * regind)); /* Clear bit. */ mask ^= (1U << bit); run->regs_mask[i] = mask; return (ret); } for (i++; i < bin->regs_mask_nelms; i++) { mask = run->regs_mask[i]; if (mask != 0) { /* Usable allocation found. */ bit = ffs((int)mask) - 1; regind = ((i << (SIZEOF_INT_2POW + 3)) + bit); assert(regind < bin->nregs); ret = (void *)(((uintptr_t)run) + bin->reg0_offset + (bin->reg_size * regind)); /* Clear bit. */ mask ^= (1U << bit); run->regs_mask[i] = mask; /* * Make a note that nothing before this element * contains a free region. */ run->regs_minelm = i; /* Low payoff: + (mask == 0); */ return (ret); } } /* Not reached. */ assert(0); return (NULL); } static inline void arena_run_reg_dalloc(arena_run_t *run, arena_bin_t *bin, void *ptr, size_t size) { unsigned diff, regind, elm, bit; assert(run->magic == ARENA_RUN_MAGIC); /* * Avoid doing division with a variable divisor if possible. Using * actual division here can reduce allocator throughput by over 20%! */ diff = (unsigned)((uintptr_t)ptr - (uintptr_t)run - bin->reg0_offset); if ((size & (size - 1)) == 0) { /* * log2_table allows fast division of a power of two in the * [1..128] range. * * (x / divisor) becomes (x >> log2_table[divisor - 1]). */ static const unsigned char log2_table[] = { 0, 1, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 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, 6, 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, 7 }; if (size <= 128) regind = (diff >> log2_table[size - 1]); else if (size <= 32768) regind = diff >> (8 + log2_table[(size >> 8) - 1]); else regind = diff / size; } else if (size < qspace_max) { /* * To divide by a number D that is not a power of two we * multiply by (2^21 / D) and then right shift by 21 positions. * * X / D * * becomes * * (X * qsize_invs[(D >> QUANTUM_2POW) - 3]) * >> SIZE_INV_SHIFT * * We can omit the first three elements, because we never * divide by 0, and QUANTUM and 2*QUANTUM are both powers of * two, which are handled above. */ #define SIZE_INV_SHIFT 21 #define QSIZE_INV(s) (((1U << SIZE_INV_SHIFT) / (s << QUANTUM_2POW)) + 1) static const unsigned qsize_invs[] = { QSIZE_INV(3), QSIZE_INV(4), QSIZE_INV(5), QSIZE_INV(6), QSIZE_INV(7) #if (QUANTUM_2POW < 4) , QSIZE_INV(8), QSIZE_INV(9), QSIZE_INV(10), QSIZE_INV(11), QSIZE_INV(12),QSIZE_INV(13), QSIZE_INV(14), QSIZE_INV(15) #endif }; assert(QUANTUM * (((sizeof(qsize_invs)) / sizeof(unsigned)) + 3) >= (1U << QSPACE_MAX_2POW_DEFAULT)); if (size <= (((sizeof(qsize_invs) / sizeof(unsigned)) + 2) << QUANTUM_2POW)) { regind = qsize_invs[(size >> QUANTUM_2POW) - 3] * diff; regind >>= SIZE_INV_SHIFT; } else regind = diff / size; #undef QSIZE_INV } else if (size < cspace_max) { #define CSIZE_INV(s) (((1U << SIZE_INV_SHIFT) / (s << CACHELINE_2POW)) + 1) static const unsigned csize_invs[] = { CSIZE_INV(3), CSIZE_INV(4), CSIZE_INV(5), CSIZE_INV(6), CSIZE_INV(7) }; assert(CACHELINE * (((sizeof(csize_invs)) / sizeof(unsigned)) + 3) >= (1U << CSPACE_MAX_2POW_DEFAULT)); if (size <= (((sizeof(csize_invs) / sizeof(unsigned)) + 2) << CACHELINE_2POW)) { regind = csize_invs[(size >> CACHELINE_2POW) - 3] * diff; regind >>= SIZE_INV_SHIFT; } else regind = diff / size; #undef CSIZE_INV } else { #define SSIZE_INV(s) (((1U << SIZE_INV_SHIFT) / (s << SUBPAGE_2POW)) + 1) static const unsigned ssize_invs[] = { SSIZE_INV(3), SSIZE_INV(4), SSIZE_INV(5), SSIZE_INV(6), SSIZE_INV(7), SSIZE_INV(8), SSIZE_INV(9), SSIZE_INV(10), SSIZE_INV(11), SSIZE_INV(12), SSIZE_INV(13), SSIZE_INV(14), SSIZE_INV(15) #if (PAGESIZE_2POW == 13) , SSIZE_INV(16), SSIZE_INV(17), SSIZE_INV(18), SSIZE_INV(19), SSIZE_INV(20), SSIZE_INV(21), SSIZE_INV(22), SSIZE_INV(23), SSIZE_INV(24), SSIZE_INV(25), SSIZE_INV(26), SSIZE_INV(27), SSIZE_INV(28), SSIZE_INV(29), SSIZE_INV(29), SSIZE_INV(30) #endif }; assert(SUBPAGE * (((sizeof(ssize_invs)) / sizeof(unsigned)) + 3) >= (1U << PAGESIZE_2POW)); if (size < (((sizeof(ssize_invs) / sizeof(unsigned)) + 2) << SUBPAGE_2POW)) { regind = ssize_invs[(size >> SUBPAGE_2POW) - 3] * diff; regind >>= SIZE_INV_SHIFT; } else regind = diff / size; #undef SSIZE_INV } #undef SIZE_INV_SHIFT assert(diff == regind * size); assert(regind < bin->nregs); elm = regind >> (SIZEOF_INT_2POW + 3); if (elm < run->regs_minelm) run->regs_minelm = elm; bit = regind - (elm << (SIZEOF_INT_2POW + 3)); assert((run->regs_mask[elm] & (1U << bit)) == 0); run->regs_mask[elm] |= (1U << bit); } static void arena_run_split(arena_t *arena, arena_run_t *run, size_t size, bool large, bool zero) { arena_chunk_t *chunk; size_t old_ndirty, run_ind, total_pages, need_pages, rem_pages, i; chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(run); old_ndirty = chunk->ndirty; run_ind = (unsigned)(((uintptr_t)run - (uintptr_t)chunk) >> pagesize_2pow); total_pages = (chunk->map[run_ind].bits & ~pagesize_mask) >> pagesize_2pow; need_pages = (size >> pagesize_2pow); assert(need_pages > 0); assert(need_pages <= total_pages); rem_pages = total_pages - need_pages; arena_avail_tree_remove(&arena->runs_avail, &chunk->map[run_ind]); /* Keep track of trailing unused pages for later use. */ if (rem_pages > 0) { chunk->map[run_ind+need_pages].bits = (rem_pages << pagesize_2pow) | (chunk->map[run_ind+need_pages].bits & pagesize_mask); chunk->map[run_ind+total_pages-1].bits = (rem_pages << pagesize_2pow) | (chunk->map[run_ind+total_pages-1].bits & pagesize_mask); arena_avail_tree_insert(&arena->runs_avail, &chunk->map[run_ind+need_pages]); } for (i = 0; i < need_pages; i++) { /* Zero if necessary. */ if (zero) { if ((chunk->map[run_ind + i].bits & CHUNK_MAP_ZEROED) == 0) { memset((void *)((uintptr_t)chunk + ((run_ind + i) << pagesize_2pow)), 0, pagesize); /* CHUNK_MAP_ZEROED is cleared below. */ } } /* Update dirty page accounting. */ if (chunk->map[run_ind + i].bits & CHUNK_MAP_DIRTY) { chunk->ndirty--; arena->ndirty--; /* CHUNK_MAP_DIRTY is cleared below. */ } /* Initialize the chunk map. */ if (large) { chunk->map[run_ind + i].bits = CHUNK_MAP_LARGE | CHUNK_MAP_ALLOCATED; } else { chunk->map[run_ind + i].bits = (size_t)run | CHUNK_MAP_ALLOCATED; } } /* * Set the run size only in the first element for large runs. This is * primarily a debugging aid, since the lack of size info for trailing * pages only matters if the application tries to operate on an * interior pointer. */ if (large) chunk->map[run_ind].bits |= size; if (chunk->ndirty == 0 && old_ndirty > 0) arena_chunk_tree_dirty_remove(&arena->chunks_dirty, chunk); } static arena_chunk_t * arena_chunk_alloc(arena_t *arena) { arena_chunk_t *chunk; size_t i; if (arena->spare != NULL) { chunk = arena->spare; arena->spare = NULL; } else { chunk = (arena_chunk_t *)chunk_alloc(chunksize, true); if (chunk == NULL) return (NULL); #ifdef MALLOC_STATS arena->stats.mapped += chunksize; #endif chunk->arena = arena; /* * Claim that no pages are in use, since the header is merely * overhead. */ chunk->ndirty = 0; /* * Initialize the map to contain one maximal free untouched run. */ for (i = 0; i < arena_chunk_header_npages; i++) chunk->map[i].bits = 0; chunk->map[i].bits = arena_maxclass | CHUNK_MAP_ZEROED; for (i++; i < chunk_npages-1; i++) { chunk->map[i].bits = CHUNK_MAP_ZEROED; } chunk->map[chunk_npages-1].bits = arena_maxclass | CHUNK_MAP_ZEROED; } /* Insert the run into the runs_avail tree. */ arena_avail_tree_insert(&arena->runs_avail, &chunk->map[arena_chunk_header_npages]); return (chunk); } static void arena_chunk_dealloc(arena_t *arena, arena_chunk_t *chunk) { if (arena->spare != NULL) { if (arena->spare->ndirty > 0) { arena_chunk_tree_dirty_remove( &chunk->arena->chunks_dirty, arena->spare); arena->ndirty -= arena->spare->ndirty; } chunk_dealloc((void *)arena->spare, chunksize); #ifdef MALLOC_STATS arena->stats.mapped -= chunksize; #endif } /* * Remove run from runs_avail, regardless of whether this chunk * will be cached, so that the arena does not use it. Dirty page * flushing only uses the chunks_dirty tree, so leaving this chunk in * the chunks_* trees is sufficient for that purpose. */ arena_avail_tree_remove(&arena->runs_avail, &chunk->map[arena_chunk_header_npages]); arena->spare = chunk; } static arena_run_t * arena_run_alloc(arena_t *arena, size_t size, bool large, bool zero) { arena_chunk_t *chunk; arena_run_t *run; arena_chunk_map_t *mapelm, key; assert(size <= arena_maxclass); assert((size & pagesize_mask) == 0); /* Search the arena's chunks for the lowest best fit. */ key.bits = size | CHUNK_MAP_KEY; mapelm = arena_avail_tree_nsearch(&arena->runs_avail, &key); if (mapelm != NULL) { arena_chunk_t *run_chunk = CHUNK_ADDR2BASE(mapelm); size_t pageind = ((uintptr_t)mapelm - (uintptr_t)run_chunk->map) / sizeof(arena_chunk_map_t); run = (arena_run_t *)((uintptr_t)run_chunk + (pageind << pagesize_2pow)); arena_run_split(arena, run, size, large, zero); return (run); } /* * No usable runs. Create a new chunk from which to allocate the run. */ chunk = arena_chunk_alloc(arena); if (chunk == NULL) return (NULL); run = (arena_run_t *)((uintptr_t)chunk + (arena_chunk_header_npages << pagesize_2pow)); /* Update page map. */ arena_run_split(arena, run, size, large, zero); return (run); } static void arena_purge(arena_t *arena) { arena_chunk_t *chunk; size_t i, npages; #ifdef MALLOC_DEBUG size_t ndirty = 0; rb_foreach_begin(arena_chunk_t, link_dirty, &arena->chunks_dirty, chunk) { ndirty += chunk->ndirty; } rb_foreach_end(arena_chunk_t, link_dirty, &arena->chunks_dirty, chunk) assert(ndirty == arena->ndirty); #endif assert(arena->ndirty > opt_dirty_max); #ifdef MALLOC_STATS arena->stats.npurge++; #endif /* * Iterate downward through chunks until enough dirty memory has been * purged. Terminate as soon as possible in order to minimize the * number of system calls, even if a chunk has only been partially * purged. */ while (arena->ndirty > (opt_dirty_max >> 1)) { chunk = arena_chunk_tree_dirty_last(&arena->chunks_dirty); assert(chunk != NULL); for (i = chunk_npages - 1; chunk->ndirty > 0; i--) { assert(i >= arena_chunk_header_npages); if (chunk->map[i].bits & CHUNK_MAP_DIRTY) { chunk->map[i].bits ^= CHUNK_MAP_DIRTY; /* Find adjacent dirty run(s). */ for (npages = 1; i > arena_chunk_header_npages && (chunk->map[i - 1].bits & CHUNK_MAP_DIRTY); npages++) { i--; chunk->map[i].bits ^= CHUNK_MAP_DIRTY; } chunk->ndirty -= npages; arena->ndirty -= npages; madvise((void *)((uintptr_t)chunk + (i << pagesize_2pow)), (npages << pagesize_2pow), MADV_DONTNEED); #ifdef MALLOC_STATS arena->stats.nmadvise++; arena->stats.purged += npages; #endif if (arena->ndirty <= (opt_dirty_max >> 1)) break; } } if (chunk->ndirty == 0) { arena_chunk_tree_dirty_remove(&arena->chunks_dirty, chunk); } } } static void arena_run_dalloc(arena_t *arena, arena_run_t *run, bool dirty) { arena_chunk_t *chunk; size_t size, run_ind, run_pages; chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(run); run_ind = (size_t)(((uintptr_t)run - (uintptr_t)chunk) >> pagesize_2pow); assert(run_ind >= arena_chunk_header_npages); assert(run_ind < chunk_npages); if ((chunk->map[run_ind].bits & CHUNK_MAP_LARGE) != 0) size = chunk->map[run_ind].bits & ~pagesize_mask; else size = run->bin->run_size; run_pages = (size >> pagesize_2pow); /* Mark pages as unallocated in the chunk map. */ if (dirty) { size_t i; for (i = 0; i < run_pages; i++) { assert((chunk->map[run_ind + i].bits & CHUNK_MAP_DIRTY) == 0); chunk->map[run_ind + i].bits = CHUNK_MAP_DIRTY; } if (chunk->ndirty == 0) { arena_chunk_tree_dirty_insert(&arena->chunks_dirty, chunk); } chunk->ndirty += run_pages; arena->ndirty += run_pages; } else { size_t i; for (i = 0; i < run_pages; i++) { chunk->map[run_ind + i].bits &= ~(CHUNK_MAP_LARGE | CHUNK_MAP_ALLOCATED); } } chunk->map[run_ind].bits = size | (chunk->map[run_ind].bits & pagesize_mask); chunk->map[run_ind+run_pages-1].bits = size | (chunk->map[run_ind+run_pages-1].bits & pagesize_mask); /* Try to coalesce forward. */ if (run_ind + run_pages < chunk_npages && (chunk->map[run_ind+run_pages].bits & CHUNK_MAP_ALLOCATED) == 0) { size_t nrun_size = chunk->map[run_ind+run_pages].bits & ~pagesize_mask; /* * Remove successor from runs_avail; the coalesced run is * inserted later. */ arena_avail_tree_remove(&arena->runs_avail, &chunk->map[run_ind+run_pages]); size += nrun_size; run_pages = size >> pagesize_2pow; assert((chunk->map[run_ind+run_pages-1].bits & ~pagesize_mask) == nrun_size); chunk->map[run_ind].bits = size | (chunk->map[run_ind].bits & pagesize_mask); chunk->map[run_ind+run_pages-1].bits = size | (chunk->map[run_ind+run_pages-1].bits & pagesize_mask); } /* Try to coalesce backward. */ if (run_ind > arena_chunk_header_npages && (chunk->map[run_ind-1].bits & CHUNK_MAP_ALLOCATED) == 0) { size_t prun_size = chunk->map[run_ind-1].bits & ~pagesize_mask; run_ind -= prun_size >> pagesize_2pow; /* * Remove predecessor from runs_avail; the coalesced run is * inserted later. */ arena_avail_tree_remove(&arena->runs_avail, &chunk->map[run_ind]); size += prun_size; run_pages = size >> pagesize_2pow; assert((chunk->map[run_ind].bits & ~pagesize_mask) == prun_size); chunk->map[run_ind].bits = size | (chunk->map[run_ind].bits & pagesize_mask); chunk->map[run_ind+run_pages-1].bits = size | (chunk->map[run_ind+run_pages-1].bits & pagesize_mask); } /* Insert into runs_avail, now that coalescing is complete. */ arena_avail_tree_insert(&arena->runs_avail, &chunk->map[run_ind]); /* Deallocate chunk if it is now completely unused. */ if ((chunk->map[arena_chunk_header_npages].bits & (~pagesize_mask | CHUNK_MAP_ALLOCATED)) == arena_maxclass) arena_chunk_dealloc(arena, chunk); /* Enforce opt_dirty_max. */ if (arena->ndirty > opt_dirty_max) arena_purge(arena); } static void arena_run_trim_head(arena_t *arena, arena_chunk_t *chunk, arena_run_t *run, size_t oldsize, size_t newsize) { size_t pageind = ((uintptr_t)run - (uintptr_t)chunk) >> pagesize_2pow; size_t head_npages = (oldsize - newsize) >> pagesize_2pow; assert(oldsize > newsize); /* * Update the chunk map so that arena_run_dalloc() can treat the * leading run as separately allocated. */ chunk->map[pageind].bits = (oldsize - newsize) | CHUNK_MAP_LARGE | CHUNK_MAP_ALLOCATED; chunk->map[pageind+head_npages].bits = newsize | CHUNK_MAP_LARGE | CHUNK_MAP_ALLOCATED; arena_run_dalloc(arena, run, false); } static void arena_run_trim_tail(arena_t *arena, arena_chunk_t *chunk, arena_run_t *run, size_t oldsize, size_t newsize, bool dirty) { size_t pageind = ((uintptr_t)run - (uintptr_t)chunk) >> pagesize_2pow; size_t npages = newsize >> pagesize_2pow; assert(oldsize > newsize); /* * Update the chunk map so that arena_run_dalloc() can treat the * trailing run as separately allocated. */ chunk->map[pageind].bits = newsize | CHUNK_MAP_LARGE | CHUNK_MAP_ALLOCATED; chunk->map[pageind+npages].bits = (oldsize - newsize) | CHUNK_MAP_LARGE | CHUNK_MAP_ALLOCATED; arena_run_dalloc(arena, (arena_run_t *)((uintptr_t)run + newsize), dirty); } static arena_run_t * arena_bin_nonfull_run_get(arena_t *arena, arena_bin_t *bin) { arena_chunk_map_t *mapelm; arena_run_t *run; unsigned i, remainder; /* Look for a usable run. */ mapelm = arena_run_tree_first(&bin->runs); if (mapelm != NULL) { /* run is guaranteed to have available space. */ arena_run_tree_remove(&bin->runs, mapelm); run = (arena_run_t *)(mapelm->bits & ~pagesize_mask); #ifdef MALLOC_STATS bin->stats.reruns++; #endif return (run); } /* No existing runs have any space available. */ /* Allocate a new run. */ run = arena_run_alloc(arena, bin->run_size, false, false); if (run == NULL) return (NULL); /* Initialize run internals. */ run->bin = bin; for (i = 0; i < bin->regs_mask_nelms - 1; i++) run->regs_mask[i] = UINT_MAX; remainder = bin->nregs & ((1U << (SIZEOF_INT_2POW + 3)) - 1); if (remainder == 0) run->regs_mask[i] = UINT_MAX; else { /* The last element has spare bits that need to be unset. */ run->regs_mask[i] = (UINT_MAX >> ((1U << (SIZEOF_INT_2POW + 3)) - remainder)); } run->regs_minelm = 0; run->nfree = bin->nregs; #ifdef MALLOC_DEBUG run->magic = ARENA_RUN_MAGIC; #endif #ifdef MALLOC_STATS bin->stats.nruns++; bin->stats.curruns++; if (bin->stats.curruns > bin->stats.highruns) bin->stats.highruns = bin->stats.curruns; #endif return (run); } /* bin->runcur must have space available before this function is called. */ static inline void * arena_bin_malloc_easy(arena_t *arena, arena_bin_t *bin, arena_run_t *run) { void *ret; (void)arena; /* XXX */ assert(run->magic == ARENA_RUN_MAGIC); assert(run->nfree > 0); ret = arena_run_reg_alloc(run, bin); assert(ret != NULL); run->nfree--; return (ret); } /* Re-fill bin->runcur, then call arena_bin_malloc_easy(). */ static void * arena_bin_malloc_hard(arena_t *arena, arena_bin_t *bin) { bin->runcur = arena_bin_nonfull_run_get(arena, bin); if (bin->runcur == NULL) return (NULL); assert(bin->runcur->magic == ARENA_RUN_MAGIC); assert(bin->runcur->nfree > 0); return (arena_bin_malloc_easy(arena, bin, bin->runcur)); } /* * Calculate bin->run_size such that it meets the following constraints: * * *) bin->run_size >= min_run_size * *) bin->run_size <= arena_maxclass * *) bin->run_size <= RUN_MAX_SMALL * *) run header overhead <= RUN_MAX_OVRHD (or header overhead relaxed). * * bin->nregs, bin->regs_mask_nelms, and bin->reg0_offset are * also calculated here, since these settings are all interdependent. */ static size_t arena_bin_run_size_calc(arena_bin_t *bin, size_t min_run_size) { size_t try_run_size, good_run_size; unsigned good_nregs, good_mask_nelms, good_reg0_offset; unsigned try_nregs, try_mask_nelms, try_reg0_offset; assert(min_run_size >= pagesize); assert(min_run_size <= arena_maxclass); assert(min_run_size <= RUN_MAX_SMALL); /* * Calculate known-valid settings before entering the run_size * expansion loop, so that the first part of the loop always copies * valid settings. * * The do..while loop iteratively reduces the number of regions until * the run header and the regions no longer overlap. A closed formula * would be quite messy, since there is an interdependency between the * header's mask length and the number of regions. */ try_run_size = min_run_size; try_nregs = ((try_run_size - sizeof(arena_run_t)) / bin->reg_size) + 1; /* Counter-act try_nregs-- in loop. */ do { try_nregs--; try_mask_nelms = (try_nregs >> (SIZEOF_INT_2POW + 3)) + ((try_nregs & ((1U << (SIZEOF_INT_2POW + 3)) - 1)) ? 1 : 0); try_reg0_offset = try_run_size - (try_nregs * bin->reg_size); } while (sizeof(arena_run_t) + (sizeof(unsigned) * (try_mask_nelms - 1)) > try_reg0_offset); /* run_size expansion loop. */ do { /* * Copy valid settings before trying more aggressive settings. */ good_run_size = try_run_size; good_nregs = try_nregs; good_mask_nelms = try_mask_nelms; good_reg0_offset = try_reg0_offset; /* Try more aggressive settings. */ try_run_size += pagesize; try_nregs = ((try_run_size - sizeof(arena_run_t)) / bin->reg_size) + 1; /* Counter-act try_nregs-- in loop. */ do { try_nregs--; try_mask_nelms = (try_nregs >> (SIZEOF_INT_2POW + 3)) + ((try_nregs & ((1U << (SIZEOF_INT_2POW + 3)) - 1)) ? 1 : 0); try_reg0_offset = try_run_size - (try_nregs * bin->reg_size); } while (sizeof(arena_run_t) + (sizeof(unsigned) * (try_mask_nelms - 1)) > try_reg0_offset); } while (try_run_size <= arena_maxclass && try_run_size <= RUN_MAX_SMALL && RUN_MAX_OVRHD * (bin->reg_size << 3) > RUN_MAX_OVRHD_RELAX && (try_reg0_offset << RUN_BFP) > RUN_MAX_OVRHD * try_run_size); assert(sizeof(arena_run_t) + (sizeof(unsigned) * (good_mask_nelms - 1)) <= good_reg0_offset); assert((good_mask_nelms << (SIZEOF_INT_2POW + 3)) >= good_nregs); /* Copy final settings. */ bin->run_size = good_run_size; bin->nregs = good_nregs; bin->regs_mask_nelms = good_mask_nelms; bin->reg0_offset = good_reg0_offset; return (good_run_size); } #ifdef MALLOC_BALANCE static inline void arena_lock_balance(arena_t *arena) { unsigned contention; contention = malloc_spin_lock(&arena->lock); if (narenas > 1) { /* * Calculate the exponentially averaged contention for this * arena. Due to integer math always rounding down, this value * decays somewhat faster than normal. */ arena->contention = (((uint64_t)arena->contention * (uint64_t)((1U << BALANCE_ALPHA_INV_2POW)-1)) + (uint64_t)contention) >> BALANCE_ALPHA_INV_2POW; if (arena->contention >= opt_balance_threshold) arena_lock_balance_hard(arena); } } static void arena_lock_balance_hard(arena_t *arena) { uint32_t ind; arena->contention = 0; #ifdef MALLOC_STATS arena->stats.nbalance++; #endif ind = PRN(balance, narenas_2pow); if (arenas[ind] != NULL) arenas_map = arenas[ind]; else { malloc_spin_lock(&arenas_lock); if (arenas[ind] != NULL) arenas_map = arenas[ind]; else arenas_map = arenas_extend(ind); malloc_spin_unlock(&arenas_lock); } } #endif #ifdef MALLOC_MAG static inline void * mag_alloc(mag_t *mag) { if (mag->nrounds == 0) return (NULL); mag->nrounds--; return (mag->rounds[mag->nrounds]); } static void mag_load(mag_t *mag) { arena_t *arena; arena_bin_t *bin; arena_run_t *run; void *round; size_t i; arena = choose_arena(); bin = &arena->bins[mag->binind]; #ifdef MALLOC_BALANCE arena_lock_balance(arena); #else malloc_spin_lock(&arena->lock); #endif for (i = mag->nrounds; i < max_rounds; i++) { if ((run = bin->runcur) != NULL && run->nfree > 0) round = arena_bin_malloc_easy(arena, bin, run); else round = arena_bin_malloc_hard(arena, bin); if (round == NULL) break; mag->rounds[i] = round; } #ifdef MALLOC_STATS bin->stats.nmags++; arena->stats.nmalloc_small += (i - mag->nrounds); arena->stats.allocated_small += (i - mag->nrounds) * bin->reg_size; #endif malloc_spin_unlock(&arena->lock); mag->nrounds = i; } static inline void * mag_rack_alloc(mag_rack_t *rack, size_t size, bool zero) { void *ret; bin_mags_t *bin_mags; mag_t *mag; size_t binind; binind = size2bin[size]; assert(binind < nbins); bin_mags = &rack->bin_mags[binind]; mag = bin_mags->curmag; if (mag == NULL) { /* Create an initial magazine for this size class. */ assert(bin_mags->sparemag == NULL); mag = mag_create(choose_arena(), binind); if (mag == NULL) return (NULL); bin_mags->curmag = mag; mag_load(mag); } ret = mag_alloc(mag); if (ret == NULL) { if (bin_mags->sparemag != NULL) { if (bin_mags->sparemag->nrounds > 0) { /* Swap magazines. */ bin_mags->curmag = bin_mags->sparemag; bin_mags->sparemag = mag; mag = bin_mags->curmag; } else { /* Reload the current magazine. */ mag_load(mag); } } else { /* Create a second magazine. */ mag = mag_create(choose_arena(), binind); if (mag == NULL) return (NULL); mag_load(mag); bin_mags->sparemag = bin_mags->curmag; bin_mags->curmag = mag; } ret = mag_alloc(mag); if (ret == NULL) return (NULL); } if (zero == false) { if (opt_junk) memset(ret, 0xa5, size); else if (opt_zero) memset(ret, 0, size); } else memset(ret, 0, size); return (ret); } #endif static inline void * arena_malloc_small(arena_t *arena, size_t size, bool zero) { void *ret; arena_bin_t *bin; arena_run_t *run; size_t binind; binind = size2bin[size]; assert(binind < nbins); bin = &arena->bins[binind]; size = bin->reg_size; #ifdef MALLOC_BALANCE arena_lock_balance(arena); #else malloc_spin_lock(&arena->lock); #endif if ((run = bin->runcur) != NULL && run->nfree > 0) ret = arena_bin_malloc_easy(arena, bin, run); else ret = arena_bin_malloc_hard(arena, bin); if (ret == NULL) { malloc_spin_unlock(&arena->lock); return (NULL); } #ifdef MALLOC_STATS bin->stats.nrequests++; arena->stats.nmalloc_small++; arena->stats.allocated_small += size; #endif malloc_spin_unlock(&arena->lock); if (zero == false) { if (opt_junk) memset(ret, 0xa5, size); else if (opt_zero) memset(ret, 0, size); } else memset(ret, 0, size); return (ret); } static void * arena_malloc_large(arena_t *arena, size_t size, bool zero) { void *ret; /* Large allocation. */ size = PAGE_CEILING(size); #ifdef MALLOC_BALANCE arena_lock_balance(arena); #else malloc_spin_lock(&arena->lock); #endif ret = (void *)arena_run_alloc(arena, size, true, zero); if (ret == NULL) { malloc_spin_unlock(&arena->lock); return (NULL); } #ifdef MALLOC_STATS arena->stats.nmalloc_large++; arena->stats.allocated_large += size; #endif malloc_spin_unlock(&arena->lock); if (zero == false) { if (opt_junk) memset(ret, 0xa5, size); else if (opt_zero) memset(ret, 0, size); } return (ret); } static inline void * arena_malloc(arena_t *arena, size_t size, bool zero) { assert(arena != NULL); assert(arena->magic == ARENA_MAGIC); assert(size != 0); assert(QUANTUM_CEILING(size) <= arena_maxclass); if (size <= bin_maxclass) { #ifdef MALLOC_MAG if (__isthreaded && opt_mag) { mag_rack_t *rack = mag_rack; if (rack == NULL) { rack = mag_rack_create(arena); if (rack == NULL) return (NULL); mag_rack = rack; } return (mag_rack_alloc(rack, size, zero)); } else #endif return (arena_malloc_small(arena, size, zero)); } else return (arena_malloc_large(arena, size, zero)); } static inline void * imalloc(size_t size) { assert(size != 0); if (size <= arena_maxclass) return (arena_malloc(choose_arena(), size, false)); else return (huge_malloc(size, false)); } static inline void * icalloc(size_t size) { if (size <= arena_maxclass) return (arena_malloc(choose_arena(), size, true)); else return (huge_malloc(size, true)); } /* Only handles large allocations that require more than page alignment. */ static void * arena_palloc(arena_t *arena, size_t alignment, size_t size, size_t alloc_size) { void *ret; size_t offset; arena_chunk_t *chunk; assert((size & pagesize_mask) == 0); assert((alignment & pagesize_mask) == 0); #ifdef MALLOC_BALANCE arena_lock_balance(arena); #else malloc_spin_lock(&arena->lock); #endif ret = (void *)arena_run_alloc(arena, alloc_size, true, false); if (ret == NULL) { malloc_spin_unlock(&arena->lock); return (NULL); } chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ret); offset = (uintptr_t)ret & (alignment - 1); assert((offset & pagesize_mask) == 0); assert(offset < alloc_size); if (offset == 0) arena_run_trim_tail(arena, chunk, ret, alloc_size, size, false); else { size_t leadsize, trailsize; leadsize = alignment - offset; if (leadsize > 0) { arena_run_trim_head(arena, chunk, ret, alloc_size, alloc_size - leadsize); ret = (void *)((uintptr_t)ret + leadsize); } trailsize = alloc_size - leadsize - size; if (trailsize != 0) { /* Trim trailing space. */ assert(trailsize < alloc_size); arena_run_trim_tail(arena, chunk, ret, size + trailsize, size, false); } } #ifdef MALLOC_STATS arena->stats.nmalloc_large++; arena->stats.allocated_large += size; #endif malloc_spin_unlock(&arena->lock); if (opt_junk) memset(ret, 0xa5, size); else if (opt_zero) memset(ret, 0, size); return (ret); } static inline void * ipalloc(size_t alignment, size_t size) { void *ret; size_t ceil_size; /* * Round size up to the nearest multiple of alignment. * * This done, we can take advantage of the fact that for each small * size class, every object is aligned at the smallest power of two * that is non-zero in the base two representation of the size. For * example: * * Size | Base 2 | Minimum alignment * -----+----------+------------------ * 96 | 1100000 | 32 * 144 | 10100000 | 32 * 192 | 11000000 | 64 * * Depending on runtime settings, it is possible that arena_malloc() * will further round up to a power of two, but that never causes * correctness issues. */ ceil_size = (size + (alignment - 1)) & (-alignment); /* * (ceil_size < size) protects against the combination of maximal * alignment and size greater than maximal alignment. */ if (ceil_size < size) { /* size_t overflow. */ return (NULL); } if (ceil_size <= pagesize || (alignment <= pagesize && ceil_size <= arena_maxclass)) ret = arena_malloc(choose_arena(), ceil_size, false); else { size_t run_size; /* * We can't achieve subpage alignment, so round up alignment * permanently; it makes later calculations simpler. */ alignment = PAGE_CEILING(alignment); ceil_size = PAGE_CEILING(size); /* * (ceil_size < size) protects against very large sizes within * pagesize of SIZE_T_MAX. * * (ceil_size + alignment < ceil_size) protects against the * combination of maximal alignment and ceil_size large enough * to cause overflow. This is similar to the first overflow * check above, but it needs to be repeated due to the new * ceil_size value, which may now be *equal* to maximal * alignment, whereas before we only detected overflow if the * original size was *greater* than maximal alignment. */ if (ceil_size < size || ceil_size + alignment < ceil_size) { /* size_t overflow. */ return (NULL); } /* * Calculate the size of the over-size run that arena_palloc() * would need to allocate in order to guarantee the alignment. */ if (ceil_size >= alignment) run_size = ceil_size + alignment - pagesize; else { /* * It is possible that (alignment << 1) will cause * overflow, but it doesn't matter because we also * subtract pagesize, which in the case of overflow * leaves us with a very large run_size. That causes * the first conditional below to fail, which means * that the bogus run_size value never gets used for * anything important. */ run_size = (alignment << 1) - pagesize; } if (run_size <= arena_maxclass) { ret = arena_palloc(choose_arena(), alignment, ceil_size, run_size); } else if (alignment <= chunksize) ret = huge_malloc(ceil_size, false); else ret = huge_palloc(alignment, ceil_size); } assert(((uintptr_t)ret & (alignment - 1)) == 0); return (ret); } /* Return the size of the allocation pointed to by ptr. */ static size_t arena_salloc(const void *ptr) { size_t ret; arena_chunk_t *chunk; size_t pageind, mapbits; assert(ptr != NULL); assert(CHUNK_ADDR2BASE(ptr) != ptr); chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); pageind = (((uintptr_t)ptr - (uintptr_t)chunk) >> pagesize_2pow); mapbits = chunk->map[pageind].bits; assert((mapbits & CHUNK_MAP_ALLOCATED) != 0); if ((mapbits & CHUNK_MAP_LARGE) == 0) { arena_run_t *run = (arena_run_t *)(mapbits & ~pagesize_mask); assert(run->magic == ARENA_RUN_MAGIC); ret = run->bin->reg_size; } else { ret = mapbits & ~pagesize_mask; assert(ret != 0); } return (ret); } static inline size_t isalloc(const void *ptr) { size_t ret; arena_chunk_t *chunk; assert(ptr != NULL); chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); if (chunk != ptr) { /* Region. */ assert(chunk->arena->magic == ARENA_MAGIC); ret = arena_salloc(ptr); } else { extent_node_t *node, key; /* Chunk (huge allocation). */ malloc_mutex_lock(&huge_mtx); /* Extract from tree of huge allocations. */ key.addr = __DECONST(void *, ptr); node = extent_tree_ad_search(&huge, &key); assert(node != NULL); ret = node->size; malloc_mutex_unlock(&huge_mtx); } return (ret); } static inline void arena_dalloc_small(arena_t *arena, arena_chunk_t *chunk, void *ptr, arena_chunk_map_t *mapelm) { arena_run_t *run; arena_bin_t *bin; size_t size; run = (arena_run_t *)(mapelm->bits & ~pagesize_mask); assert(run->magic == ARENA_RUN_MAGIC); bin = run->bin; size = bin->reg_size; if (opt_junk) memset(ptr, 0x5a, size); arena_run_reg_dalloc(run, bin, ptr, size); run->nfree++; if (run->nfree == bin->nregs) { /* Deallocate run. */ if (run == bin->runcur) bin->runcur = NULL; else if (bin->nregs != 1) { size_t run_pageind = (((uintptr_t)run - (uintptr_t)chunk)) >> pagesize_2pow; arena_chunk_map_t *run_mapelm = &chunk->map[run_pageind]; /* * This block's conditional is necessary because if the * run only contains one region, then it never gets * inserted into the non-full runs tree. */ arena_run_tree_remove(&bin->runs, run_mapelm); } #ifdef MALLOC_DEBUG run->magic = 0; #endif arena_run_dalloc(arena, run, true); #ifdef MALLOC_STATS bin->stats.curruns--; #endif } else if (run->nfree == 1 && run != bin->runcur) { /* * Make sure that bin->runcur always refers to the lowest * non-full run, if one exists. */ if (bin->runcur == NULL) bin->runcur = run; else if ((uintptr_t)run < (uintptr_t)bin->runcur) { /* Switch runcur. */ if (bin->runcur->nfree > 0) { arena_chunk_t *runcur_chunk = CHUNK_ADDR2BASE(bin->runcur); size_t runcur_pageind = (((uintptr_t)bin->runcur - (uintptr_t)runcur_chunk)) >> pagesize_2pow; arena_chunk_map_t *runcur_mapelm = &runcur_chunk->map[runcur_pageind]; /* Insert runcur. */ arena_run_tree_insert(&bin->runs, runcur_mapelm); } bin->runcur = run; } else { size_t run_pageind = (((uintptr_t)run - (uintptr_t)chunk)) >> pagesize_2pow; arena_chunk_map_t *run_mapelm = &chunk->map[run_pageind]; assert(arena_run_tree_search(&bin->runs, run_mapelm) == NULL); arena_run_tree_insert(&bin->runs, run_mapelm); } } #ifdef MALLOC_STATS arena->stats.allocated_small -= size; arena->stats.ndalloc_small++; #endif } #ifdef MALLOC_MAG static void mag_unload(mag_t *mag) { arena_chunk_t *chunk; arena_t *arena; void *round; size_t i, ndeferred, nrounds; for (ndeferred = mag->nrounds; ndeferred > 0;) { nrounds = ndeferred; /* Lock the arena associated with the first round. */ chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(mag->rounds[0]); arena = chunk->arena; #ifdef MALLOC_BALANCE arena_lock_balance(arena); #else malloc_spin_lock(&arena->lock); #endif /* Deallocate every round that belongs to the locked arena. */ for (i = ndeferred = 0; i < nrounds; i++) { round = mag->rounds[i]; chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(round); if (chunk->arena == arena) { size_t pageind = (((uintptr_t)round - (uintptr_t)chunk) >> pagesize_2pow); arena_chunk_map_t *mapelm = &chunk->map[pageind]; arena_dalloc_small(arena, chunk, round, mapelm); } else { /* * This round was allocated via a different * arena than the one that is currently locked. * Stash the round, so that it can be handled * in a future pass. */ mag->rounds[ndeferred] = round; ndeferred++; } } malloc_spin_unlock(&arena->lock); } mag->nrounds = 0; } static inline void mag_rack_dalloc(mag_rack_t *rack, void *ptr) { arena_t *arena; arena_chunk_t *chunk; arena_run_t *run; arena_bin_t *bin; bin_mags_t *bin_mags; mag_t *mag; size_t pageind, binind; arena_chunk_map_t *mapelm; chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); arena = chunk->arena; pageind = (((uintptr_t)ptr - (uintptr_t)chunk) >> pagesize_2pow); mapelm = &chunk->map[pageind]; run = (arena_run_t *)(mapelm->bits & ~pagesize_mask); assert(run->magic == ARENA_RUN_MAGIC); bin = run->bin; binind = ((uintptr_t)bin - (uintptr_t)&arena->bins) / sizeof(arena_bin_t); assert(binind < nbins); if (opt_junk) memset(ptr, 0x5a, arena->bins[binind].reg_size); bin_mags = &rack->bin_mags[binind]; mag = bin_mags->curmag; if (mag == NULL) { /* Create an initial magazine for this size class. */ assert(bin_mags->sparemag == NULL); mag = mag_create(choose_arena(), binind); if (mag == NULL) { malloc_spin_lock(&arena->lock); arena_dalloc_small(arena, chunk, ptr, mapelm); malloc_spin_unlock(&arena->lock); return; } bin_mags->curmag = mag; } if (mag->nrounds == max_rounds) { if (bin_mags->sparemag != NULL) { if (bin_mags->sparemag->nrounds < max_rounds) { /* Swap magazines. */ bin_mags->curmag = bin_mags->sparemag; bin_mags->sparemag = mag; mag = bin_mags->curmag; } else { /* Unload the current magazine. */ mag_unload(mag); } } else { /* Create a second magazine. */ mag = mag_create(choose_arena(), binind); if (mag == NULL) { mag = rack->bin_mags[binind].curmag; mag_unload(mag); } else { bin_mags->sparemag = bin_mags->curmag; bin_mags->curmag = mag; } } assert(mag->nrounds < max_rounds); } mag->rounds[mag->nrounds] = ptr; mag->nrounds++; } #endif static void arena_dalloc_large(arena_t *arena, arena_chunk_t *chunk, void *ptr) { /* Large allocation. */ malloc_spin_lock(&arena->lock); #ifndef MALLOC_STATS if (opt_junk) #endif { size_t pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> pagesize_2pow; size_t size = chunk->map[pageind].bits & ~pagesize_mask; #ifdef MALLOC_STATS if (opt_junk) #endif memset(ptr, 0x5a, size); #ifdef MALLOC_STATS arena->stats.allocated_large -= size; #endif } #ifdef MALLOC_STATS arena->stats.ndalloc_large++; #endif arena_run_dalloc(arena, (arena_run_t *)ptr, true); malloc_spin_unlock(&arena->lock); } static inline void arena_dalloc(arena_t *arena, arena_chunk_t *chunk, void *ptr) { size_t pageind; arena_chunk_map_t *mapelm; assert(arena != NULL); assert(arena->magic == ARENA_MAGIC); assert(chunk->arena == arena); assert(ptr != NULL); assert(CHUNK_ADDR2BASE(ptr) != ptr); pageind = (((uintptr_t)ptr - (uintptr_t)chunk) >> pagesize_2pow); mapelm = &chunk->map[pageind]; assert((mapelm->bits & CHUNK_MAP_ALLOCATED) != 0); if ((mapelm->bits & CHUNK_MAP_LARGE) == 0) { /* Small allocation. */ #ifdef MALLOC_MAG if (__isthreaded && opt_mag) { mag_rack_t *rack = mag_rack; if (rack == NULL) { rack = mag_rack_create(arena); if (rack == NULL) { malloc_spin_lock(&arena->lock); arena_dalloc_small(arena, chunk, ptr, mapelm); malloc_spin_unlock(&arena->lock); } mag_rack = rack; } mag_rack_dalloc(rack, ptr); } else { #endif malloc_spin_lock(&arena->lock); arena_dalloc_small(arena, chunk, ptr, mapelm); malloc_spin_unlock(&arena->lock); #ifdef MALLOC_MAG } #endif } else arena_dalloc_large(arena, chunk, ptr); } static inline void idalloc(void *ptr) { arena_chunk_t *chunk; assert(ptr != NULL); chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); if (chunk != ptr) arena_dalloc(chunk->arena, chunk, ptr); else huge_dalloc(ptr); } static void arena_ralloc_large_shrink(arena_t *arena, arena_chunk_t *chunk, void *ptr, size_t size, size_t oldsize) { assert(size < oldsize); /* * Shrink the run, and make trailing pages available for other * allocations. */ #ifdef MALLOC_BALANCE arena_lock_balance(arena); #else malloc_spin_lock(&arena->lock); #endif arena_run_trim_tail(arena, chunk, (arena_run_t *)ptr, oldsize, size, true); #ifdef MALLOC_STATS arena->stats.allocated_large -= oldsize - size; #endif malloc_spin_unlock(&arena->lock); } static bool arena_ralloc_large_grow(arena_t *arena, arena_chunk_t *chunk, void *ptr, size_t size, size_t oldsize) { size_t pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> pagesize_2pow; size_t npages = oldsize >> pagesize_2pow; assert(oldsize == (chunk->map[pageind].bits & ~pagesize_mask)); /* Try to extend the run. */ assert(size > oldsize); #ifdef MALLOC_BALANCE arena_lock_balance(arena); #else malloc_spin_lock(&arena->lock); #endif if (pageind + npages < chunk_npages && (chunk->map[pageind+npages].bits & CHUNK_MAP_ALLOCATED) == 0 && (chunk->map[pageind+npages].bits & ~pagesize_mask) >= size - oldsize) { /* * The next run is available and sufficiently large. Split the * following run, then merge the first part with the existing * allocation. */ arena_run_split(arena, (arena_run_t *)((uintptr_t)chunk + ((pageind+npages) << pagesize_2pow)), size - oldsize, true, false); chunk->map[pageind].bits = size | CHUNK_MAP_LARGE | CHUNK_MAP_ALLOCATED; chunk->map[pageind+npages].bits = CHUNK_MAP_LARGE | CHUNK_MAP_ALLOCATED; #ifdef MALLOC_STATS arena->stats.allocated_large += size - oldsize; #endif malloc_spin_unlock(&arena->lock); return (false); } malloc_spin_unlock(&arena->lock); return (true); } /* * Try to resize a large allocation, in order to avoid copying. This will * always fail if growing an object, and the following run is already in use. */ static bool arena_ralloc_large(void *ptr, size_t size, size_t oldsize) { size_t psize; psize = PAGE_CEILING(size); if (psize == oldsize) { /* Same size class. */ if (opt_junk && size < oldsize) { memset((void *)((uintptr_t)ptr + size), 0x5a, oldsize - size); } return (false); } else { arena_chunk_t *chunk; arena_t *arena; chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); arena = chunk->arena; assert(arena->magic == ARENA_MAGIC); if (psize < oldsize) { /* Fill before shrinking in order avoid a race. */ if (opt_junk) { memset((void *)((uintptr_t)ptr + size), 0x5a, oldsize - size); } arena_ralloc_large_shrink(arena, chunk, ptr, psize, oldsize); return (false); } else { bool ret = arena_ralloc_large_grow(arena, chunk, ptr, psize, oldsize); if (ret == false && opt_zero) { memset((void *)((uintptr_t)ptr + oldsize), 0, size - oldsize); } return (ret); } } } static void * arena_ralloc(void *ptr, size_t size, size_t oldsize) { void *ret; size_t copysize; /* Try to avoid moving the allocation. */ if (size <= bin_maxclass) { if (oldsize <= bin_maxclass && size2bin[size] == size2bin[oldsize]) goto IN_PLACE; } else { if (oldsize > bin_maxclass && oldsize <= arena_maxclass) { assert(size > bin_maxclass); if (arena_ralloc_large(ptr, size, oldsize) == false) return (ptr); } } /* * If we get here, then size and oldsize are different enough that we * need to move the object. In that case, fall back to allocating new * space and copying. */ ret = arena_malloc(choose_arena(), size, false); if (ret == NULL) return (NULL); /* Junk/zero-filling were already done by arena_malloc(). */ copysize = (size < oldsize) ? size : oldsize; memcpy(ret, ptr, copysize); idalloc(ptr); return (ret); IN_PLACE: if (opt_junk && size < oldsize) memset((void *)((uintptr_t)ptr + size), 0x5a, oldsize - size); else if (opt_zero && size > oldsize) memset((void *)((uintptr_t)ptr + oldsize), 0, size - oldsize); return (ptr); } static inline void * iralloc(void *ptr, size_t size) { size_t oldsize; assert(ptr != NULL); assert(size != 0); oldsize = isalloc(ptr); if (size <= arena_maxclass) return (arena_ralloc(ptr, size, oldsize)); else return (huge_ralloc(ptr, size, oldsize)); } static bool arena_new(arena_t *arena) { unsigned i; arena_bin_t *bin; size_t prev_run_size; if (malloc_spin_init(&arena->lock)) return (true); #ifdef MALLOC_STATS memset(&arena->stats, 0, sizeof(arena_stats_t)); #endif /* Initialize chunks. */ arena_chunk_tree_dirty_new(&arena->chunks_dirty); arena->spare = NULL; arena->ndirty = 0; arena_avail_tree_new(&arena->runs_avail); #ifdef MALLOC_BALANCE arena->contention = 0; #endif /* Initialize bins. */ prev_run_size = pagesize; i = 0; #ifdef MALLOC_TINY /* (2^n)-spaced tiny bins. */ for (; i < ntbins; i++) { bin = &arena->bins[i]; bin->runcur = NULL; arena_run_tree_new(&bin->runs); bin->reg_size = (1U << (TINY_MIN_2POW + i)); prev_run_size = arena_bin_run_size_calc(bin, prev_run_size); #ifdef MALLOC_STATS memset(&bin->stats, 0, sizeof(malloc_bin_stats_t)); #endif } #endif /* Quantum-spaced bins. */ for (; i < ntbins + nqbins; i++) { bin = &arena->bins[i]; bin->runcur = NULL; arena_run_tree_new(&bin->runs); bin->reg_size = (i - ntbins + 1) << QUANTUM_2POW; prev_run_size = arena_bin_run_size_calc(bin, prev_run_size); #ifdef MALLOC_STATS memset(&bin->stats, 0, sizeof(malloc_bin_stats_t)); #endif } /* Cacheline-spaced bins. */ for (; i < ntbins + nqbins + ncbins; i++) { bin = &arena->bins[i]; bin->runcur = NULL; arena_run_tree_new(&bin->runs); bin->reg_size = cspace_min + ((i - (ntbins + nqbins)) << CACHELINE_2POW); prev_run_size = arena_bin_run_size_calc(bin, prev_run_size); #ifdef MALLOC_STATS memset(&bin->stats, 0, sizeof(malloc_bin_stats_t)); #endif } /* Subpage-spaced bins. */ for (; i < nbins; i++) { bin = &arena->bins[i]; bin->runcur = NULL; arena_run_tree_new(&bin->runs); bin->reg_size = sspace_min + ((i - (ntbins + nqbins + ncbins)) << SUBPAGE_2POW); prev_run_size = arena_bin_run_size_calc(bin, prev_run_size); #ifdef MALLOC_STATS memset(&bin->stats, 0, sizeof(malloc_bin_stats_t)); #endif } #ifdef MALLOC_DEBUG arena->magic = ARENA_MAGIC; #endif return (false); } /* Create a new arena and insert it into the arenas array at index ind. */ static arena_t * arenas_extend(unsigned ind) { arena_t *ret; /* Allocate enough space for trailing bins. */ ret = (arena_t *)base_alloc(sizeof(arena_t) + (sizeof(arena_bin_t) * (nbins - 1))); if (ret != NULL && arena_new(ret) == false) { arenas[ind] = ret; return (ret); } /* Only reached if there is an OOM error. */ /* * OOM here is quite inconvenient to propagate, since dealing with it * would require a check for failure in the fast path. Instead, punt * by using arenas[0]. In practice, this is an extremely unlikely * failure. */ _malloc_message(_getprogname(), ": (malloc) Error initializing arena\n", "", ""); if (opt_abort) abort(); return (arenas[0]); } #ifdef MALLOC_MAG static mag_t * mag_create(arena_t *arena, size_t binind) { mag_t *ret; if (sizeof(mag_t) + (sizeof(void *) * (max_rounds - 1)) <= bin_maxclass) { ret = arena_malloc_small(arena, sizeof(mag_t) + (sizeof(void *) * (max_rounds - 1)), false); } else { ret = imalloc(sizeof(mag_t) + (sizeof(void *) * (max_rounds - 1))); } if (ret == NULL) return (NULL); ret->binind = binind; ret->nrounds = 0; return (ret); } static void mag_destroy(mag_t *mag) { arena_t *arena; arena_chunk_t *chunk; size_t pageind; arena_chunk_map_t *mapelm; chunk = CHUNK_ADDR2BASE(mag); arena = chunk->arena; pageind = (((uintptr_t)mag - (uintptr_t)chunk) >> pagesize_2pow); mapelm = &chunk->map[pageind]; assert(mag->nrounds == 0); if (sizeof(mag_t) + (sizeof(void *) * (max_rounds - 1)) <= bin_maxclass) { malloc_spin_lock(&arena->lock); arena_dalloc_small(arena, chunk, mag, mapelm); malloc_spin_unlock(&arena->lock); } else idalloc(mag); } static mag_rack_t * mag_rack_create(arena_t *arena) { assert(sizeof(mag_rack_t) + (sizeof(bin_mags_t *) * (nbins - 1)) <= bin_maxclass); return (arena_malloc_small(arena, sizeof(mag_rack_t) + (sizeof(bin_mags_t) * (nbins - 1)), true)); } static void mag_rack_destroy(mag_rack_t *rack) { arena_t *arena; arena_chunk_t *chunk; bin_mags_t *bin_mags; size_t i, pageind; arena_chunk_map_t *mapelm; for (i = 0; i < nbins; i++) { bin_mags = &rack->bin_mags[i]; if (bin_mags->curmag != NULL) { assert(bin_mags->curmag->binind == i); mag_unload(bin_mags->curmag); mag_destroy(bin_mags->curmag); } if (bin_mags->sparemag != NULL) { assert(bin_mags->sparemag->binind == i); mag_unload(bin_mags->sparemag); mag_destroy(bin_mags->sparemag); } } chunk = CHUNK_ADDR2BASE(rack); arena = chunk->arena; pageind = (((uintptr_t)rack - (uintptr_t)chunk) >> pagesize_2pow); mapelm = &chunk->map[pageind]; malloc_spin_lock(&arena->lock); arena_dalloc_small(arena, chunk, rack, mapelm); malloc_spin_unlock(&arena->lock); } #endif /* * End arena. */ /******************************************************************************/ /* * Begin general internal functions. */ static void * huge_malloc(size_t size, bool zero) { void *ret; size_t csize; extent_node_t *node; /* Allocate one or more contiguous chunks for this request. */ csize = CHUNK_CEILING(size); if (csize == 0) { /* size is large enough to cause size_t wrap-around. */ return (NULL); } /* Allocate an extent node with which to track the chunk. */ node = base_node_alloc(); if (node == NULL) return (NULL); ret = chunk_alloc(csize, zero); if (ret == NULL) { base_node_dealloc(node); return (NULL); } /* Insert node into huge. */ node->addr = ret; node->size = csize; malloc_mutex_lock(&huge_mtx); extent_tree_ad_insert(&huge, node); #ifdef MALLOC_STATS huge_nmalloc++; huge_allocated += csize; #endif malloc_mutex_unlock(&huge_mtx); if (zero == false) { if (opt_junk) memset(ret, 0xa5, csize); else if (opt_zero) memset(ret, 0, csize); } return (ret); } /* Only handles large allocations that require more than chunk alignment. */ static void * huge_palloc(size_t alignment, size_t size) { void *ret; size_t alloc_size, chunk_size, offset; extent_node_t *node; /* * This allocation requires alignment that is even larger than chunk * alignment. This means that huge_malloc() isn't good enough. * * Allocate almost twice as many chunks as are demanded by the size or * alignment, in order to assure the alignment can be achieved, then * unmap leading and trailing chunks. */ assert(alignment >= chunksize); chunk_size = CHUNK_CEILING(size); if (size >= alignment) alloc_size = chunk_size + alignment - chunksize; else alloc_size = (alignment << 1) - chunksize; /* Allocate an extent node with which to track the chunk. */ node = base_node_alloc(); if (node == NULL) return (NULL); ret = chunk_alloc(alloc_size, false); if (ret == NULL) { base_node_dealloc(node); return (NULL); } offset = (uintptr_t)ret & (alignment - 1); assert((offset & chunksize_mask) == 0); assert(offset < alloc_size); if (offset == 0) { /* Trim trailing space. */ chunk_dealloc((void *)((uintptr_t)ret + chunk_size), alloc_size - chunk_size); } else { size_t trailsize; /* Trim leading space. */ chunk_dealloc(ret, alignment - offset); ret = (void *)((uintptr_t)ret + (alignment - offset)); trailsize = alloc_size - (alignment - offset) - chunk_size; if (trailsize != 0) { /* Trim trailing space. */ assert(trailsize < alloc_size); chunk_dealloc((void *)((uintptr_t)ret + chunk_size), trailsize); } } /* Insert node into huge. */ node->addr = ret; node->size = chunk_size; malloc_mutex_lock(&huge_mtx); extent_tree_ad_insert(&huge, node); #ifdef MALLOC_STATS huge_nmalloc++; huge_allocated += chunk_size; #endif malloc_mutex_unlock(&huge_mtx); if (opt_junk) memset(ret, 0xa5, chunk_size); else if (opt_zero) memset(ret, 0, chunk_size); return (ret); } static void * huge_ralloc(void *ptr, size_t size, size_t oldsize) { void *ret; size_t copysize; /* Avoid moving the allocation if the size class would not change. */ if (oldsize > arena_maxclass && CHUNK_CEILING(size) == CHUNK_CEILING(oldsize)) { if (opt_junk && size < oldsize) { memset((void *)((uintptr_t)ptr + size), 0x5a, oldsize - size); } else if (opt_zero && size > oldsize) { memset((void *)((uintptr_t)ptr + oldsize), 0, size - oldsize); } return (ptr); } /* * If we get here, then size and oldsize are different enough that we * need to use a different size class. In that case, fall back to * allocating new space and copying. */ ret = huge_malloc(size, false); if (ret == NULL) return (NULL); copysize = (size < oldsize) ? size : oldsize; memcpy(ret, ptr, copysize); idalloc(ptr); return (ret); } static void huge_dalloc(void *ptr) { extent_node_t *node, key; malloc_mutex_lock(&huge_mtx); /* Extract from tree of huge allocations. */ key.addr = ptr; node = extent_tree_ad_search(&huge, &key); assert(node != NULL); assert(node->addr == ptr); extent_tree_ad_remove(&huge, node); #ifdef MALLOC_STATS huge_ndalloc++; huge_allocated -= node->size; #endif malloc_mutex_unlock(&huge_mtx); /* Unmap chunk. */ #ifdef MALLOC_DSS if (opt_dss && opt_junk) memset(node->addr, 0x5a, node->size); #endif chunk_dealloc(node->addr, node->size); base_node_dealloc(node); } static void malloc_print_stats(void) { if (opt_print_stats) { char s[UMAX2S_BUFSIZE]; _malloc_message("___ Begin malloc statistics ___\n", "", "", ""); _malloc_message("Assertions ", #ifdef NDEBUG "disabled", #else "enabled", #endif "\n", ""); _malloc_message("Boolean MALLOC_OPTIONS: ", opt_abort ? "A" : "a", "", ""); #ifdef MALLOC_DSS _malloc_message(opt_dss ? "D" : "d", "", "", ""); #endif #ifdef MALLOC_MAG _malloc_message(opt_mag ? "G" : "g", "", "", ""); #endif _malloc_message(opt_junk ? "J" : "j", "", "", ""); #ifdef MALLOC_DSS _malloc_message(opt_mmap ? "M" : "m", "", "", ""); #endif _malloc_message(opt_utrace ? "PU" : "Pu", opt_sysv ? "V" : "v", opt_xmalloc ? "X" : "x", opt_zero ? "Z\n" : "z\n"); _malloc_message("CPUs: ", umax2s(ncpus, s), "\n", ""); _malloc_message("Max arenas: ", umax2s(narenas, s), "\n", ""); #ifdef MALLOC_BALANCE _malloc_message("Arena balance threshold: ", umax2s(opt_balance_threshold, s), "\n", ""); #endif _malloc_message("Pointer size: ", umax2s(sizeof(void *), s), "\n", ""); _malloc_message("Quantum size: ", umax2s(QUANTUM, s), "\n", ""); _malloc_message("Cacheline size (assumed): ", umax2s(CACHELINE, s), "\n", ""); #ifdef MALLOC_TINY _malloc_message("Tiny 2^n-spaced sizes: [", umax2s((1U << TINY_MIN_2POW), s), "..", ""); _malloc_message(umax2s((qspace_min >> 1), s), "]\n", "", ""); #endif _malloc_message("Quantum-spaced sizes: [", umax2s(qspace_min, s), "..", ""); _malloc_message(umax2s(qspace_max, s), "]\n", "", ""); _malloc_message("Cacheline-spaced sizes: [", umax2s(cspace_min, s), "..", ""); _malloc_message(umax2s(cspace_max, s), "]\n", "", ""); _malloc_message("Subpage-spaced sizes: [", umax2s(sspace_min, s), "..", ""); _malloc_message(umax2s(sspace_max, s), "]\n", "", ""); #ifdef MALLOC_MAG _malloc_message("Rounds per magazine: ", umax2s(max_rounds, s), "\n", ""); #endif _malloc_message("Max dirty pages per arena: ", umax2s(opt_dirty_max, s), "\n", ""); _malloc_message("Chunk size: ", umax2s(chunksize, s), "", ""); _malloc_message(" (2^", umax2s(opt_chunk_2pow, s), ")\n", ""); #ifdef MALLOC_STATS { size_t allocated, mapped; #ifdef MALLOC_BALANCE uint64_t nbalance = 0; #endif unsigned i; arena_t *arena; /* Calculate and print allocated/mapped stats. */ /* arenas. */ for (i = 0, allocated = 0; i < narenas; i++) { if (arenas[i] != NULL) { malloc_spin_lock(&arenas[i]->lock); allocated += arenas[i]->stats.allocated_small; allocated += arenas[i]->stats.allocated_large; #ifdef MALLOC_BALANCE nbalance += arenas[i]->stats.nbalance; #endif malloc_spin_unlock(&arenas[i]->lock); } } /* huge/base. */ malloc_mutex_lock(&huge_mtx); allocated += huge_allocated; mapped = stats_chunks.curchunks * chunksize; malloc_mutex_unlock(&huge_mtx); malloc_mutex_lock(&base_mtx); mapped += base_mapped; malloc_mutex_unlock(&base_mtx); malloc_printf("Allocated: %zu, mapped: %zu\n", allocated, mapped); #ifdef MALLOC_BALANCE malloc_printf("Arena balance reassignments: %llu\n", nbalance); #endif /* Print chunk stats. */ { chunk_stats_t chunks_stats; malloc_mutex_lock(&huge_mtx); chunks_stats = stats_chunks; malloc_mutex_unlock(&huge_mtx); malloc_printf("chunks: nchunks " "highchunks curchunks\n"); malloc_printf(" %13llu%13lu%13lu\n", chunks_stats.nchunks, chunks_stats.highchunks, chunks_stats.curchunks); } /* Print chunk stats. */ malloc_printf( "huge: nmalloc ndalloc allocated\n"); malloc_printf(" %12llu %12llu %12zu\n", huge_nmalloc, huge_ndalloc, huge_allocated); /* Print stats for each arena. */ for (i = 0; i < narenas; i++) { arena = arenas[i]; if (arena != NULL) { malloc_printf( "\narenas[%u]:\n", i); malloc_spin_lock(&arena->lock); stats_print(arena); malloc_spin_unlock(&arena->lock); } } } #endif /* #ifdef MALLOC_STATS */ _malloc_message("--- End malloc statistics ---\n", "", "", ""); } } #ifdef MALLOC_DEBUG static void size2bin_validate(void) { size_t i, size, binind; assert(size2bin[0] == 0xffU); i = 1; # ifdef MALLOC_TINY /* Tiny. */ for (; i < (1U << TINY_MIN_2POW); i++) { size = pow2_ceil(1U << TINY_MIN_2POW); binind = ffs((int)(size >> (TINY_MIN_2POW + 1))); assert(size2bin[i] == binind); } for (; i < qspace_min; i++) { size = pow2_ceil(i); binind = ffs((int)(size >> (TINY_MIN_2POW + 1))); assert(size2bin[i] == binind); } # endif /* Quantum-spaced. */ for (; i <= qspace_max; i++) { size = QUANTUM_CEILING(i); binind = ntbins + (size >> QUANTUM_2POW) - 1; assert(size2bin[i] == binind); } /* Cacheline-spaced. */ for (; i <= cspace_max; i++) { size = CACHELINE_CEILING(i); binind = ntbins + nqbins + ((size - cspace_min) >> CACHELINE_2POW); assert(size2bin[i] == binind); } /* Sub-page. */ for (; i <= sspace_max; i++) { size = SUBPAGE_CEILING(i); binind = ntbins + nqbins + ncbins + ((size - sspace_min) >> SUBPAGE_2POW); assert(size2bin[i] == binind); } } #endif static bool size2bin_init(void) { if (opt_qspace_max_2pow != QSPACE_MAX_2POW_DEFAULT || opt_cspace_max_2pow != CSPACE_MAX_2POW_DEFAULT) return (size2bin_init_hard()); size2bin = const_size2bin; #ifdef MALLOC_DEBUG assert(sizeof(const_size2bin) == bin_maxclass + 1); size2bin_validate(); #endif return (false); } static bool size2bin_init_hard(void) { size_t i, size, binind; uint8_t *custom_size2bin; assert(opt_qspace_max_2pow != QSPACE_MAX_2POW_DEFAULT || opt_cspace_max_2pow != CSPACE_MAX_2POW_DEFAULT); custom_size2bin = (uint8_t *)base_alloc(bin_maxclass + 1); if (custom_size2bin == NULL) return (true); custom_size2bin[0] = 0xffU; i = 1; #ifdef MALLOC_TINY /* Tiny. */ for (; i < (1U << TINY_MIN_2POW); i++) { size = pow2_ceil(1U << TINY_MIN_2POW); binind = ffs((int)(size >> (TINY_MIN_2POW + 1))); custom_size2bin[i] = binind; } for (; i < qspace_min; i++) { size = pow2_ceil(i); binind = ffs((int)(size >> (TINY_MIN_2POW + 1))); custom_size2bin[i] = binind; } #endif /* Quantum-spaced. */ for (; i <= qspace_max; i++) { size = QUANTUM_CEILING(i); binind = ntbins + (size >> QUANTUM_2POW) - 1; custom_size2bin[i] = binind; } /* Cacheline-spaced. */ for (; i <= cspace_max; i++) { size = CACHELINE_CEILING(i); binind = ntbins + nqbins + ((size - cspace_min) >> CACHELINE_2POW); custom_size2bin[i] = binind; } /* Sub-page. */ for (; i <= sspace_max; i++) { size = SUBPAGE_CEILING(i); binind = ntbins + nqbins + ncbins + ((size - sspace_min) >> SUBPAGE_2POW); custom_size2bin[i] = binind; } size2bin = custom_size2bin; #ifdef MALLOC_DEBUG size2bin_validate(); #endif return (false); } static unsigned malloc_ncpus(void) { unsigned ret; int fd, nread, column; char buf[1]; static const char matchstr[] = "processor\t:"; /* * sysconf(3) would be the preferred method for determining the number * of CPUs, but it uses malloc internally, which causes untennable * recursion during malloc initialization. */ fd = open("/proc/cpuinfo", O_RDONLY); if (fd == -1) return (1); /* Error. */ /* * Count the number of occurrences of matchstr at the beginnings of * lines. This treats hyperthreaded CPUs as multiple processors. */ column = 0; ret = 0; while (true) { nread = read(fd, &buf, sizeof(buf)); if (nread <= 0) break; /* EOF or error. */ if (buf[0] == '\n') column = 0; else if (column != -1) { if (buf[0] == matchstr[column]) { column++; if (column == sizeof(matchstr) - 1) { column = -1; ret++; } } else column = -1; } } if (ret == 0) ret = 1; /* Something went wrong in the parser. */ close(fd); return (ret); } /* * FreeBSD's pthreads implementation calls malloc(3), so the malloc * implementation has to take pains to avoid infinite recursion during * initialization. */ static inline bool malloc_init(void) { if (malloc_initialized == false) return (malloc_init_hard()); return (false); } static bool malloc_init_hard(void) { unsigned i; int linklen; char buf[PATH_MAX + 1]; const char *opts; malloc_mutex_lock(&init_lock); if (malloc_initialized) { /* * Another thread initialized the allocator before this one * acquired init_lock. */ malloc_mutex_unlock(&init_lock); return (false); } /* Get number of CPUs. */ ncpus = malloc_ncpus(); /* Get page size. */ { long result; result = sysconf(_SC_PAGESIZE); assert(result != -1); pagesize = (unsigned)result; /* * We assume that pagesize is a power of 2 when calculating * pagesize_mask and pagesize_2pow. */ assert(((result - 1) & result) == 0); pagesize_mask = result - 1; pagesize_2pow = ffs((int)result) - 1; } for (i = 0; i < 3; i++) { unsigned j; /* Get runtime configuration. */ switch (i) { case 0: if ((linklen = readlink("/etc/malloc.conf", buf, sizeof(buf) - 1)) != -1) { /* * Use the contents of the "/etc/malloc.conf" * symbolic link's name. */ buf[linklen] = '\0'; opts = buf; } else { /* No configuration specified. */ buf[0] = '\0'; opts = buf; } break; case 1: if (issetugid() == 0 && (opts = getenv("MALLOC_OPTIONS")) != NULL) { /* * Do nothing; opts is already initialized to * the value of the MALLOC_OPTIONS environment * variable. */ } else { /* No configuration specified. */ buf[0] = '\0'; opts = buf; } break; case 2: if (_malloc_options != NULL) { /* * Use options that were compiled into the * program. */ opts = _malloc_options; } else { /* No configuration specified. */ buf[0] = '\0'; opts = buf; } break; default: /* NOTREACHED */ assert(false); } for (j = 0; opts[j] != '\0'; j++) { unsigned k, nreps; bool nseen; /* Parse repetition count, if any. */ for (nreps = 0, nseen = false;; j++, nseen = true) { switch (opts[j]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': nreps *= 10; nreps += opts[j] - '0'; break; default: goto MALLOC_OUT; } } MALLOC_OUT: if (nseen == false) nreps = 1; for (k = 0; k < nreps; k++) { switch (opts[j]) { case 'a': opt_abort = false; break; case 'A': opt_abort = true; break; case 'b': #ifdef MALLOC_BALANCE opt_balance_threshold >>= 1; #endif break; case 'B': #ifdef MALLOC_BALANCE if (opt_balance_threshold == 0) opt_balance_threshold = 1; else if ((opt_balance_threshold << 1) > opt_balance_threshold) opt_balance_threshold <<= 1; #endif break; case 'c': if (opt_cspace_max_2pow - 1 > opt_qspace_max_2pow && opt_cspace_max_2pow > CACHELINE_2POW) opt_cspace_max_2pow--; break; case 'C': if (opt_cspace_max_2pow < pagesize_2pow - 1) opt_cspace_max_2pow++; break; case 'd': #ifdef MALLOC_DSS opt_dss = false; #endif break; case 'D': #ifdef MALLOC_DSS opt_dss = true; #endif break; case 'f': opt_dirty_max >>= 1; break; case 'F': if (opt_dirty_max == 0) opt_dirty_max = 1; else if ((opt_dirty_max << 1) != 0) opt_dirty_max <<= 1; break; #ifdef MALLOC_MAG case 'g': opt_mag = false; break; case 'G': opt_mag = true; break; #endif case 'j': opt_junk = false; break; case 'J': opt_junk = true; break; case 'k': /* * Chunks always require at least one * header page, so chunks can never be * smaller than two pages. */ if (opt_chunk_2pow > pagesize_2pow + 1) opt_chunk_2pow--; break; case 'K': if (opt_chunk_2pow + 1 < (sizeof(size_t) << 3)) opt_chunk_2pow++; break; case 'm': #ifdef MALLOC_DSS opt_mmap = false; #endif break; case 'M': #ifdef MALLOC_DSS opt_mmap = true; #endif break; case 'n': opt_narenas_lshift--; break; case 'N': opt_narenas_lshift++; break; case 'p': opt_print_stats = false; break; case 'P': opt_print_stats = true; break; case 'q': if (opt_qspace_max_2pow > QUANTUM_2POW) opt_qspace_max_2pow--; break; case 'Q': if (opt_qspace_max_2pow + 1 < opt_cspace_max_2pow) opt_qspace_max_2pow++; break; #ifdef MALLOC_MAG case 'R': if (opt_mag_size_2pow + 1 < (8U << SIZEOF_PTR_2POW)) opt_mag_size_2pow++; break; case 'r': /* * Make sure there's always at least * one round per magazine. */ if ((1U << (opt_mag_size_2pow-1)) >= sizeof(mag_t)) opt_mag_size_2pow--; break; #endif case 'u': opt_utrace = false; break; case 'U': opt_utrace = true; break; case 'v': opt_sysv = false; break; case 'V': opt_sysv = true; break; case 'x': opt_xmalloc = false; break; case 'X': opt_xmalloc = true; break; case 'z': opt_zero = false; break; case 'Z': opt_zero = true; break; default: { char cbuf[2]; cbuf[0] = opts[j]; cbuf[1] = '\0'; _malloc_message(_getprogname(), ": (malloc) Unsupported character " "in malloc options: '", cbuf, "'\n"); } } } } } #ifdef MALLOC_DSS /* Make sure that there is some method for acquiring memory. */ if (opt_dss == false && opt_mmap == false) opt_mmap = true; #endif /* Take care to call atexit() only once. */ if (opt_print_stats) { /* Print statistics at exit. */ atexit(malloc_print_stats); } /* Register fork handlers. */ pthread_atfork(_malloc_prefork, _malloc_postfork, _malloc_postfork); #ifdef MALLOC_MAG /* * Calculate the actual number of rounds per magazine, taking into * account header overhead. */ max_rounds = (1LLU << (opt_mag_size_2pow - SIZEOF_PTR_2POW)) - (sizeof(mag_t) >> SIZEOF_PTR_2POW) + 1; #endif /* Set variables according to the value of opt_[qc]space_max_2pow. */ qspace_max = (1U << opt_qspace_max_2pow); cspace_min = CACHELINE_CEILING(qspace_max); if (cspace_min == qspace_max) cspace_min += CACHELINE; cspace_max = (1U << opt_cspace_max_2pow); sspace_min = SUBPAGE_CEILING(cspace_max); if (sspace_min == cspace_max) sspace_min += SUBPAGE; assert(sspace_min < pagesize); sspace_max = pagesize - SUBPAGE; #ifdef MALLOC_TINY assert(QUANTUM_2POW >= TINY_MIN_2POW); #endif assert(ntbins <= QUANTUM_2POW); nqbins = qspace_max >> QUANTUM_2POW; ncbins = ((cspace_max - cspace_min) >> CACHELINE_2POW) + 1; nsbins = ((sspace_max - sspace_min) >> SUBPAGE_2POW) + 1; nbins = ntbins + nqbins + ncbins + nsbins; if (size2bin_init()) { malloc_mutex_unlock(&init_lock); return (true); } /* Set variables according to the value of opt_chunk_2pow. */ chunksize = (1LU << opt_chunk_2pow); chunksize_mask = chunksize - 1; chunk_npages = (chunksize >> pagesize_2pow); { size_t header_size; /* * Compute the header size such that it is large enough to * contain the page map. */ header_size = sizeof(arena_chunk_t) + (sizeof(arena_chunk_map_t) * (chunk_npages - 1)); arena_chunk_header_npages = (header_size >> pagesize_2pow) + ((header_size & pagesize_mask) != 0); } arena_maxclass = chunksize - (arena_chunk_header_npages << pagesize_2pow); UTRACE(0, 0, 0); #ifdef MALLOC_STATS memset(&stats_chunks, 0, sizeof(chunk_stats_t)); #endif /* Various sanity checks that regard configuration. */ assert(chunksize >= pagesize); /* Initialize chunks data. */ if (malloc_mutex_init(&huge_mtx)) { malloc_mutex_unlock(&init_lock); return (true); } extent_tree_ad_new(&huge); #ifdef MALLOC_DSS if (malloc_mutex_init(&dss_mtx)) { malloc_mutex_unlock(&init_lock); return (true); } dss_base = sbrk(0); dss_prev = dss_base; dss_max = dss_base; extent_tree_szad_new(&dss_chunks_szad); extent_tree_ad_new(&dss_chunks_ad); #endif #ifdef MALLOC_STATS huge_nmalloc = 0; huge_ndalloc = 0; huge_allocated = 0; #endif /* Initialize base allocation data structures. */ #ifdef MALLOC_STATS base_mapped = 0; #endif #ifdef MALLOC_DSS /* * Allocate a base chunk here, since it doesn't actually have to be * chunk-aligned. Doing this before allocating any other chunks allows * the use of space that would otherwise be wasted. */ if (opt_dss) base_pages_alloc(0); #endif base_nodes = NULL; if (malloc_mutex_init(&base_mtx)) { malloc_mutex_unlock(&init_lock); return (true); } if (ncpus > 1) { /* * For SMP systems, create twice as many arenas as there are * CPUs by default. */ opt_narenas_lshift++; } /* Determine how many arenas to use. */ narenas = ncpus; if (opt_narenas_lshift > 0) { if ((narenas << opt_narenas_lshift) > narenas) narenas <<= opt_narenas_lshift; /* * Make sure not to exceed the limits of what base_alloc() can * handle. */ if (narenas * sizeof(arena_t *) > chunksize) narenas = chunksize / sizeof(arena_t *); } else if (opt_narenas_lshift < 0) { if ((narenas >> -opt_narenas_lshift) < narenas) narenas >>= -opt_narenas_lshift; /* Make sure there is at least one arena. */ if (narenas == 0) narenas = 1; } #ifdef MALLOC_BALANCE assert(narenas != 0); for (narenas_2pow = 0; (narenas >> (narenas_2pow + 1)) != 0; narenas_2pow++); #endif #ifdef NO_TLS if (narenas > 1) { static const unsigned primes[] = {1, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263}; unsigned nprimes, parenas; /* * Pick a prime number of hash arenas that is more than narenas * so that direct hashing of pthread_self() pointers tends to * spread allocations evenly among the arenas. */ assert((narenas & 1) == 0); /* narenas must be even. */ nprimes = (sizeof(primes) >> SIZEOF_INT_2POW); parenas = primes[nprimes - 1]; /* In case not enough primes. */ for (i = 1; i < nprimes; i++) { if (primes[i] > narenas) { parenas = primes[i]; break; } } narenas = parenas; } #endif #ifndef NO_TLS # ifndef MALLOC_BALANCE next_arena = 0; # endif #endif /* Allocate and initialize arenas. */ arenas = (arena_t **)base_alloc(sizeof(arena_t *) * narenas); if (arenas == NULL) { malloc_mutex_unlock(&init_lock); return (true); } /* * Zero the array. In practice, this should always be pre-zeroed, * since it was just mmap()ed, but let's be sure. */ memset(arenas, 0, sizeof(arena_t *) * narenas); /* * Initialize one arena here. The rest are lazily created in * choose_arena_hard(). */ arenas_extend(0); if (arenas[0] == NULL) { malloc_mutex_unlock(&init_lock); return (true); } #ifndef NO_TLS /* * Assign the initial arena to the initial thread, in order to avoid * spurious creation of an extra arena if the application switches to * threaded mode. */ arenas_map = arenas[0]; #endif /* * Seed here for the initial thread, since choose_arena_hard() is only * called for other threads. The seed value doesn't really matter. */ #ifdef MALLOC_BALANCE SPRN(balance, 42); #endif malloc_spin_init(&arenas_lock); malloc_initialized = true; malloc_mutex_unlock(&init_lock); return (false); } /* * End general internal functions. */ /******************************************************************************/ /* * Begin malloc(3)-compatible functions. */ void * malloc(size_t size) { void *ret; if (malloc_init()) { ret = NULL; goto RETURN; } if (size == 0) { if (opt_sysv == false) size = 1; else { ret = NULL; goto RETURN; } } ret = imalloc(size); RETURN: if (ret == NULL) { if (opt_xmalloc) { _malloc_message(_getprogname(), ": (malloc) Error in malloc(): out of memory\n", "", ""); abort(); } errno = ENOMEM; } UTRACE(0, size, ret); return (ret); } int posix_memalign(void **memptr, size_t alignment, size_t size) { int ret; void *result; if (malloc_init()) result = NULL; else { /* Make sure that alignment is a large enough power of 2. */ if (((alignment - 1) & alignment) != 0 || alignment < sizeof(void *)) { if (opt_xmalloc) { _malloc_message(_getprogname(), ": (malloc) Error in posix_memalign(): " "invalid alignment\n", "", ""); abort(); } result = NULL; ret = EINVAL; goto RETURN; } result = ipalloc(alignment, size); } if (result == NULL) { if (opt_xmalloc) { _malloc_message(_getprogname(), ": (malloc) Error in posix_memalign(): out of memory\n", "", ""); abort(); } ret = ENOMEM; goto RETURN; } *memptr = result; ret = 0; RETURN: UTRACE(0, size, result); return (ret); } void * calloc(size_t num, size_t size) { void *ret; size_t num_size; if (malloc_init()) { num_size = 0; ret = NULL; goto RETURN; } num_size = num * size; if (num_size == 0) { if ((opt_sysv == false) && ((num == 0) || (size == 0))) num_size = 1; else { ret = NULL; goto RETURN; } /* * Try to avoid division here. We know that it isn't possible to * overflow during multiplication if neither operand uses any of the * most significant half of the bits in a size_t. */ } else if (((num | size) & (SIZE_T_MAX << (sizeof(size_t) << 2))) && (num_size / size != num)) { /* size_t overflow. */ ret = NULL; goto RETURN; } ret = icalloc(num_size); RETURN: if (ret == NULL) { if (opt_xmalloc) { _malloc_message(_getprogname(), ": (malloc) Error in calloc(): out of memory\n", "", ""); abort(); } errno = ENOMEM; } UTRACE(0, num_size, ret); return (ret); } void * realloc(void *ptr, size_t size) { void *ret; if (size == 0) { if (opt_sysv == false) size = 1; else { if (ptr != NULL) idalloc(ptr); ret = NULL; goto RETURN; } } if (ptr != NULL) { assert(malloc_initialized); ret = iralloc(ptr, size); if (ret == NULL) { if (opt_xmalloc) { _malloc_message(_getprogname(), ": (malloc) Error in realloc(): out of " "memory\n", "", ""); abort(); } errno = ENOMEM; } } else { if (malloc_init()) ret = NULL; else ret = imalloc(size); if (ret == NULL) { if (opt_xmalloc) { _malloc_message(_getprogname(), ": (malloc) Error in realloc(): out of " "memory\n", "", ""); abort(); } errno = ENOMEM; } } RETURN: UTRACE(ptr, size, ret); return (ret); } void free(void *ptr) { UTRACE(ptr, 0, 0); if (ptr != NULL) { assert(malloc_initialized); idalloc(ptr); } } /* * End malloc(3)-compatible functions. */ /******************************************************************************/ /* * Begin non-standard functions. */ size_t malloc_usable_size(const void *ptr) { assert(ptr != NULL); return (isalloc(ptr)); } /* * End non-standard functions. */ /******************************************************************************/ /* * Begin library-private functions. */ /******************************************************************************/ /* * Begin thread cache. */ /* * We provide an unpublished interface in order to receive notifications from * the pthreads library whenever a thread exits. This allows us to clean up * thread caches. */ void _malloc_thread_cleanup(void) { #ifdef MALLOC_MAG if (mag_rack != NULL) { assert(mag_rack != (void *)-1); mag_rack_destroy(mag_rack); #ifdef MALLOC_DEBUG mag_rack = (void *)-1; #endif } #endif } /* * The following functions are used by threading libraries for protection of * malloc during fork(). These functions are only called if the program is * running in threaded mode, so there is no need to check whether the program * is threaded here. */ void _malloc_prefork(void) { unsigned i; /* Acquire all mutexes in a safe order. */ malloc_spin_lock(&arenas_lock); for (i = 0; i < narenas; i++) { if (arenas[i] != NULL) malloc_spin_lock(&arenas[i]->lock); } malloc_spin_unlock(&arenas_lock); malloc_mutex_lock(&base_mtx); malloc_mutex_lock(&huge_mtx); #ifdef MALLOC_DSS malloc_mutex_lock(&dss_mtx); #endif } void _malloc_postfork(void) { unsigned i; /* Release all mutexes, now that fork() has completed. */ #ifdef MALLOC_DSS malloc_mutex_unlock(&dss_mtx); #endif malloc_mutex_unlock(&huge_mtx); malloc_mutex_unlock(&base_mtx); malloc_spin_lock(&arenas_lock); for (i = 0; i < narenas; i++) { if (arenas[i] != NULL) malloc_spin_unlock(&arenas[i]->lock); } malloc_spin_unlock(&arenas_lock); } /* * End library-private functions. */ /******************************************************************************/ varnish-3.0.5/lib/libjemalloc/rb.h0000644000175000017500000010773012247035455013730 00000000000000/****************************************************************************** * * Copyright (C) 2008 Jason Evans . * 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(s), this list of conditions and the following disclaimer * unmodified other than the allowable addition of one or more * copyright notices. * 2. Redistributions in binary form must reproduce the above copyright * notice(s), this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY * EXPRESS OR 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 COPYRIGHT HOLDER(S) BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** * * cpp macro implementation of left-leaning red-black trees. * * Usage: * * (Optional, see assert(3).) * #define NDEBUG * * (Required.) * #include * #include * ... * * All operations are done non-recursively. Parent pointers are not used, and * color bits are stored in the least significant bit of right-child pointers, * thus making node linkage as compact as is possible for red-black trees. * * Some macros use a comparison function pointer, which is expected to have the * following prototype: * * int (a_cmp *)(a_type *a_node, a_type *a_other); * ^^^^^^ * or a_key * * Interpretation of comparision function return values: * * -1 : a_node < a_other * 0 : a_node == a_other * 1 : a_node > a_other * * In all cases, the a_node or a_key macro argument is the first argument to the * comparison function, which makes it possible to write comparison functions * that treat the first argument specially. * ******************************************************************************/ #ifndef RB_H_ #define RB_H_ //__FBSDID("$FreeBSD: head/lib/libc/stdlib/rb.h 178995 2008-05-14 18:33:13Z jasone $"); /* Node structure. */ #define rb_node(a_type) \ struct { \ a_type *rbn_left; \ a_type *rbn_right_red; \ } /* Root structure. */ #define rb_tree(a_type) \ struct { \ a_type *rbt_root; \ a_type rbt_nil; \ } /* Left accessors. */ #define rbp_left_get(a_type, a_field, a_node) \ ((a_node)->a_field.rbn_left) #define rbp_left_set(a_type, a_field, a_node, a_left) do { \ (a_node)->a_field.rbn_left = a_left; \ } while (0) /* Right accessors. */ #define rbp_right_get(a_type, a_field, a_node) \ ((a_type *) (((intptr_t) (a_node)->a_field.rbn_right_red) \ & ((ssize_t)-2))) #define rbp_right_set(a_type, a_field, a_node, a_right) do { \ (a_node)->a_field.rbn_right_red = (a_type *) (((uintptr_t) a_right) \ | (((uintptr_t) (a_node)->a_field.rbn_right_red) & ((size_t)1))); \ } while (0) /* Color accessors. */ #define rbp_red_get(a_type, a_field, a_node) \ ((bool) (((uintptr_t) (a_node)->a_field.rbn_right_red) \ & ((size_t)1))) #define rbp_color_set(a_type, a_field, a_node, a_red) do { \ (a_node)->a_field.rbn_right_red = (a_type *) ((((intptr_t) \ (a_node)->a_field.rbn_right_red) & ((ssize_t)-2)) \ | ((ssize_t)a_red)); \ } while (0) #define rbp_red_set(a_type, a_field, a_node) do { \ (a_node)->a_field.rbn_right_red = (a_type *) (((uintptr_t) \ (a_node)->a_field.rbn_right_red) | ((size_t)1)); \ } while (0) #define rbp_black_set(a_type, a_field, a_node) do { \ (a_node)->a_field.rbn_right_red = (a_type *) (((intptr_t) \ (a_node)->a_field.rbn_right_red) & ((ssize_t)-2)); \ } while (0) /* Node initializer. */ #define rbp_node_new(a_type, a_field, a_tree, a_node) do { \ rbp_left_set(a_type, a_field, (a_node), &(a_tree)->rbt_nil); \ rbp_right_set(a_type, a_field, (a_node), &(a_tree)->rbt_nil); \ rbp_red_set(a_type, a_field, (a_node)); \ } while (0) /* Tree initializer. */ #define rb_new(a_type, a_field, a_tree) do { \ (a_tree)->rbt_root = &(a_tree)->rbt_nil; \ rbp_node_new(a_type, a_field, a_tree, &(a_tree)->rbt_nil); \ rbp_black_set(a_type, a_field, &(a_tree)->rbt_nil); \ } while (0) /* Tree operations. */ #define rbp_black_height(a_type, a_field, a_tree, r_height) do { \ a_type *rbp_bh_t; \ for (rbp_bh_t = (a_tree)->rbt_root, (r_height) = 0; \ rbp_bh_t != &(a_tree)->rbt_nil; \ rbp_bh_t = rbp_left_get(a_type, a_field, rbp_bh_t)) { \ if (rbp_red_get(a_type, a_field, rbp_bh_t) == false) { \ (r_height)++; \ } \ } \ } while (0) #define rbp_first(a_type, a_field, a_tree, a_root, r_node) do { \ for ((r_node) = (a_root); \ rbp_left_get(a_type, a_field, (r_node)) != &(a_tree)->rbt_nil; \ (r_node) = rbp_left_get(a_type, a_field, (r_node))) { \ } \ } while (0) #define rbp_last(a_type, a_field, a_tree, a_root, r_node) do { \ for ((r_node) = (a_root); \ rbp_right_get(a_type, a_field, (r_node)) != &(a_tree)->rbt_nil; \ (r_node) = rbp_right_get(a_type, a_field, (r_node))) { \ } \ } while (0) #define rbp_next(a_type, a_field, a_cmp, a_tree, a_node, r_node) do { \ if (rbp_right_get(a_type, a_field, (a_node)) \ != &(a_tree)->rbt_nil) { \ rbp_first(a_type, a_field, a_tree, rbp_right_get(a_type, \ a_field, (a_node)), (r_node)); \ } else { \ a_type *rbp_n_t = (a_tree)->rbt_root; \ assert(rbp_n_t != &(a_tree)->rbt_nil); \ (r_node) = &(a_tree)->rbt_nil; \ while (true) { \ int rbp_n_cmp = (a_cmp)((a_node), rbp_n_t); \ if (rbp_n_cmp < 0) { \ (r_node) = rbp_n_t; \ rbp_n_t = rbp_left_get(a_type, a_field, rbp_n_t); \ } else if (rbp_n_cmp > 0) { \ rbp_n_t = rbp_right_get(a_type, a_field, rbp_n_t); \ } else { \ break; \ } \ assert(rbp_n_t != &(a_tree)->rbt_nil); \ } \ } \ } while (0) #define rbp_prev(a_type, a_field, a_cmp, a_tree, a_node, r_node) do { \ if (rbp_left_get(a_type, a_field, (a_node)) != &(a_tree)->rbt_nil) {\ rbp_last(a_type, a_field, a_tree, rbp_left_get(a_type, \ a_field, (a_node)), (r_node)); \ } else { \ a_type *rbp_p_t = (a_tree)->rbt_root; \ assert(rbp_p_t != &(a_tree)->rbt_nil); \ (r_node) = &(a_tree)->rbt_nil; \ while (true) { \ int rbp_p_cmp = (a_cmp)((a_node), rbp_p_t); \ if (rbp_p_cmp < 0) { \ rbp_p_t = rbp_left_get(a_type, a_field, rbp_p_t); \ } else if (rbp_p_cmp > 0) { \ (r_node) = rbp_p_t; \ rbp_p_t = rbp_right_get(a_type, a_field, rbp_p_t); \ } else { \ break; \ } \ assert(rbp_p_t != &(a_tree)->rbt_nil); \ } \ } \ } while (0) #define rb_first(a_type, a_field, a_tree, r_node) do { \ rbp_first(a_type, a_field, a_tree, (a_tree)->rbt_root, (r_node)); \ if ((r_node) == &(a_tree)->rbt_nil) { \ (r_node) = NULL; \ } \ } while (0) #define rb_last(a_type, a_field, a_tree, r_node) do { \ rbp_last(a_type, a_field, a_tree, (a_tree)->rbt_root, r_node); \ if ((r_node) == &(a_tree)->rbt_nil) { \ (r_node) = NULL; \ } \ } while (0) #define rb_next(a_type, a_field, a_cmp, a_tree, a_node, r_node) do { \ rbp_next(a_type, a_field, a_cmp, a_tree, (a_node), (r_node)); \ if ((r_node) == &(a_tree)->rbt_nil) { \ (r_node) = NULL; \ } \ } while (0) #define rb_prev(a_type, a_field, a_cmp, a_tree, a_node, r_node) do { \ rbp_prev(a_type, a_field, a_cmp, a_tree, (a_node), (r_node)); \ if ((r_node) == &(a_tree)->rbt_nil) { \ (r_node) = NULL; \ } \ } while (0) #define rb_search(a_type, a_field, a_cmp, a_tree, a_key, r_node) do { \ int rbp_se_cmp; \ (r_node) = (a_tree)->rbt_root; \ while ((r_node) != &(a_tree)->rbt_nil \ && (rbp_se_cmp = (a_cmp)((a_key), (r_node))) != 0) { \ if (rbp_se_cmp < 0) { \ (r_node) = rbp_left_get(a_type, a_field, (r_node)); \ } else { \ (r_node) = rbp_right_get(a_type, a_field, (r_node)); \ } \ } \ if ((r_node) == &(a_tree)->rbt_nil) { \ (r_node) = NULL; \ } \ } while (0) /* * Find a match if it exists. Otherwise, find the next greater node, if one * exists. */ #define rb_nsearch(a_type, a_field, a_cmp, a_tree, a_key, r_node) do { \ a_type *rbp_ns_t = (a_tree)->rbt_root; \ (r_node) = NULL; \ while (rbp_ns_t != &(a_tree)->rbt_nil) { \ int rbp_ns_cmp = (a_cmp)((a_key), rbp_ns_t); \ if (rbp_ns_cmp < 0) { \ (r_node) = rbp_ns_t; \ rbp_ns_t = rbp_left_get(a_type, a_field, rbp_ns_t); \ } else if (rbp_ns_cmp > 0) { \ rbp_ns_t = rbp_right_get(a_type, a_field, rbp_ns_t); \ } else { \ (r_node) = rbp_ns_t; \ break; \ } \ } \ } while (0) /* * Find a match if it exists. Otherwise, find the previous lesser node, if one * exists. */ #define rb_psearch(a_type, a_field, a_cmp, a_tree, a_key, r_node) do { \ a_type *rbp_ps_t = (a_tree)->rbt_root; \ (r_node) = NULL; \ while (rbp_ps_t != &(a_tree)->rbt_nil) { \ int rbp_ps_cmp = (a_cmp)((a_key), rbp_ps_t); \ if (rbp_ps_cmp < 0) { \ rbp_ps_t = rbp_left_get(a_type, a_field, rbp_ps_t); \ } else if (rbp_ps_cmp > 0) { \ (r_node) = rbp_ps_t; \ rbp_ps_t = rbp_right_get(a_type, a_field, rbp_ps_t); \ } else { \ (r_node) = rbp_ps_t; \ break; \ } \ } \ } while (0) #define rbp_rotate_left(a_type, a_field, a_node, r_node) do { \ (r_node) = rbp_right_get(a_type, a_field, (a_node)); \ rbp_right_set(a_type, a_field, (a_node), \ rbp_left_get(a_type, a_field, (r_node))); \ rbp_left_set(a_type, a_field, (r_node), (a_node)); \ } while (0) #define rbp_rotate_right(a_type, a_field, a_node, r_node) do { \ (r_node) = rbp_left_get(a_type, a_field, (a_node)); \ rbp_left_set(a_type, a_field, (a_node), \ rbp_right_get(a_type, a_field, (r_node))); \ rbp_right_set(a_type, a_field, (r_node), (a_node)); \ } while (0) #define rbp_lean_left(a_type, a_field, a_node, r_node) do { \ bool rbp_ll_red; \ rbp_rotate_left(a_type, a_field, (a_node), (r_node)); \ rbp_ll_red = rbp_red_get(a_type, a_field, (a_node)); \ rbp_color_set(a_type, a_field, (r_node), rbp_ll_red); \ rbp_red_set(a_type, a_field, (a_node)); \ } while (0) #define rbp_lean_right(a_type, a_field, a_node, r_node) do { \ bool rbp_lr_red; \ rbp_rotate_right(a_type, a_field, (a_node), (r_node)); \ rbp_lr_red = rbp_red_get(a_type, a_field, (a_node)); \ rbp_color_set(a_type, a_field, (r_node), rbp_lr_red); \ rbp_red_set(a_type, a_field, (a_node)); \ } while (0) #define rbp_move_red_left(a_type, a_field, a_node, r_node) do { \ a_type *rbp_mrl_t, *rbp_mrl_u; \ rbp_mrl_t = rbp_left_get(a_type, a_field, (a_node)); \ rbp_red_set(a_type, a_field, rbp_mrl_t); \ rbp_mrl_t = rbp_right_get(a_type, a_field, (a_node)); \ rbp_mrl_u = rbp_left_get(a_type, a_field, rbp_mrl_t); \ if (rbp_red_get(a_type, a_field, rbp_mrl_u)) { \ rbp_rotate_right(a_type, a_field, rbp_mrl_t, rbp_mrl_u); \ rbp_right_set(a_type, a_field, (a_node), rbp_mrl_u); \ rbp_rotate_left(a_type, a_field, (a_node), (r_node)); \ rbp_mrl_t = rbp_right_get(a_type, a_field, (a_node)); \ if (rbp_red_get(a_type, a_field, rbp_mrl_t)) { \ rbp_black_set(a_type, a_field, rbp_mrl_t); \ rbp_red_set(a_type, a_field, (a_node)); \ rbp_rotate_left(a_type, a_field, (a_node), rbp_mrl_t); \ rbp_left_set(a_type, a_field, (r_node), rbp_mrl_t); \ } else { \ rbp_black_set(a_type, a_field, (a_node)); \ } \ } else { \ rbp_red_set(a_type, a_field, (a_node)); \ rbp_rotate_left(a_type, a_field, (a_node), (r_node)); \ } \ } while (0) #define rbp_move_red_right(a_type, a_field, a_node, r_node) do { \ a_type *rbp_mrr_t; \ rbp_mrr_t = rbp_left_get(a_type, a_field, (a_node)); \ if (rbp_red_get(a_type, a_field, rbp_mrr_t)) { \ a_type *rbp_mrr_u, *rbp_mrr_v; \ rbp_mrr_u = rbp_right_get(a_type, a_field, rbp_mrr_t); \ rbp_mrr_v = rbp_left_get(a_type, a_field, rbp_mrr_u); \ if (rbp_red_get(a_type, a_field, rbp_mrr_v)) { \ rbp_color_set(a_type, a_field, rbp_mrr_u, \ rbp_red_get(a_type, a_field, (a_node))); \ rbp_black_set(a_type, a_field, rbp_mrr_v); \ rbp_rotate_left(a_type, a_field, rbp_mrr_t, rbp_mrr_u); \ rbp_left_set(a_type, a_field, (a_node), rbp_mrr_u); \ rbp_rotate_right(a_type, a_field, (a_node), (r_node)); \ rbp_rotate_left(a_type, a_field, (a_node), rbp_mrr_t); \ rbp_right_set(a_type, a_field, (r_node), rbp_mrr_t); \ } else { \ rbp_color_set(a_type, a_field, rbp_mrr_t, \ rbp_red_get(a_type, a_field, (a_node))); \ rbp_red_set(a_type, a_field, rbp_mrr_u); \ rbp_rotate_right(a_type, a_field, (a_node), (r_node)); \ rbp_rotate_left(a_type, a_field, (a_node), rbp_mrr_t); \ rbp_right_set(a_type, a_field, (r_node), rbp_mrr_t); \ } \ rbp_red_set(a_type, a_field, (a_node)); \ } else { \ rbp_red_set(a_type, a_field, rbp_mrr_t); \ rbp_mrr_t = rbp_left_get(a_type, a_field, rbp_mrr_t); \ if (rbp_red_get(a_type, a_field, rbp_mrr_t)) { \ rbp_black_set(a_type, a_field, rbp_mrr_t); \ rbp_rotate_right(a_type, a_field, (a_node), (r_node)); \ rbp_rotate_left(a_type, a_field, (a_node), rbp_mrr_t); \ rbp_right_set(a_type, a_field, (r_node), rbp_mrr_t); \ } else { \ rbp_rotate_left(a_type, a_field, (a_node), (r_node)); \ } \ } \ } while (0) #define rb_insert(a_type, a_field, a_cmp, a_tree, a_node) do { \ a_type rbp_i_s; \ a_type *rbp_i_g, *rbp_i_p, *rbp_i_c, *rbp_i_t, *rbp_i_u; \ int rbp_i_cmp = 0; \ rbp_i_g = &(a_tree)->rbt_nil; \ rbp_left_set(a_type, a_field, &rbp_i_s, (a_tree)->rbt_root); \ rbp_right_set(a_type, a_field, &rbp_i_s, &(a_tree)->rbt_nil); \ rbp_black_set(a_type, a_field, &rbp_i_s); \ rbp_i_p = &rbp_i_s; \ rbp_i_c = (a_tree)->rbt_root; \ /* Iteratively search down the tree for the insertion point, */\ /* splitting 4-nodes as they are encountered. At the end of each */\ /* iteration, rbp_i_g->rbp_i_p->rbp_i_c is a 3-level path down */\ /* the tree, assuming a sufficiently deep tree. */\ while (rbp_i_c != &(a_tree)->rbt_nil) { \ rbp_i_t = rbp_left_get(a_type, a_field, rbp_i_c); \ rbp_i_u = rbp_left_get(a_type, a_field, rbp_i_t); \ if (rbp_red_get(a_type, a_field, rbp_i_t) \ && rbp_red_get(a_type, a_field, rbp_i_u)) { \ /* rbp_i_c is the top of a logical 4-node, so split it. */\ /* This iteration does not move down the tree, due to the */\ /* disruptiveness of node splitting. */\ /* */\ /* Rotate right. */\ rbp_rotate_right(a_type, a_field, rbp_i_c, rbp_i_t); \ /* Pass red links up one level. */\ rbp_i_u = rbp_left_get(a_type, a_field, rbp_i_t); \ rbp_black_set(a_type, a_field, rbp_i_u); \ if (rbp_left_get(a_type, a_field, rbp_i_p) == rbp_i_c) { \ rbp_left_set(a_type, a_field, rbp_i_p, rbp_i_t); \ rbp_i_c = rbp_i_t; \ } else { \ /* rbp_i_c was the right child of rbp_i_p, so rotate */\ /* left in order to maintain the left-leaning */\ /* invariant. */\ assert(rbp_right_get(a_type, a_field, rbp_i_p) \ == rbp_i_c); \ rbp_right_set(a_type, a_field, rbp_i_p, rbp_i_t); \ rbp_lean_left(a_type, a_field, rbp_i_p, rbp_i_u); \ if (rbp_left_get(a_type, a_field, rbp_i_g) == rbp_i_p) {\ rbp_left_set(a_type, a_field, rbp_i_g, rbp_i_u); \ } else { \ assert(rbp_right_get(a_type, a_field, rbp_i_g) \ == rbp_i_p); \ rbp_right_set(a_type, a_field, rbp_i_g, rbp_i_u); \ } \ rbp_i_p = rbp_i_u; \ rbp_i_cmp = (a_cmp)((a_node), rbp_i_p); \ if (rbp_i_cmp < 0) { \ rbp_i_c = rbp_left_get(a_type, a_field, rbp_i_p); \ } else { \ assert(rbp_i_cmp > 0); \ rbp_i_c = rbp_right_get(a_type, a_field, rbp_i_p); \ } \ continue; \ } \ } \ rbp_i_g = rbp_i_p; \ rbp_i_p = rbp_i_c; \ rbp_i_cmp = (a_cmp)((a_node), rbp_i_c); \ if (rbp_i_cmp < 0) { \ rbp_i_c = rbp_left_get(a_type, a_field, rbp_i_c); \ } else { \ assert(rbp_i_cmp > 0); \ rbp_i_c = rbp_right_get(a_type, a_field, rbp_i_c); \ } \ } \ /* rbp_i_p now refers to the node under which to insert. */\ rbp_node_new(a_type, a_field, a_tree, (a_node)); \ if (rbp_i_cmp > 0) { \ rbp_right_set(a_type, a_field, rbp_i_p, (a_node)); \ rbp_lean_left(a_type, a_field, rbp_i_p, rbp_i_t); \ if (rbp_left_get(a_type, a_field, rbp_i_g) == rbp_i_p) { \ rbp_left_set(a_type, a_field, rbp_i_g, rbp_i_t); \ } else if (rbp_right_get(a_type, a_field, rbp_i_g) == rbp_i_p) {\ rbp_right_set(a_type, a_field, rbp_i_g, rbp_i_t); \ } \ } else { \ rbp_left_set(a_type, a_field, rbp_i_p, (a_node)); \ } \ /* Update the root and make sure that it is black. */\ (a_tree)->rbt_root = rbp_left_get(a_type, a_field, &rbp_i_s); \ rbp_black_set(a_type, a_field, (a_tree)->rbt_root); \ } while (0) #define rb_remove(a_type, a_field, a_cmp, a_tree, a_node) do { \ a_type rbp_r_s; \ a_type *rbp_r_p, *rbp_r_c, *rbp_r_xp, *rbp_r_t, *rbp_r_u; \ int rbp_r_cmp; \ rbp_left_set(a_type, a_field, &rbp_r_s, (a_tree)->rbt_root); \ rbp_right_set(a_type, a_field, &rbp_r_s, &(a_tree)->rbt_nil); \ rbp_black_set(a_type, a_field, &rbp_r_s); \ rbp_r_p = &rbp_r_s; \ rbp_r_c = (a_tree)->rbt_root; \ rbp_r_xp = &(a_tree)->rbt_nil; \ /* Iterate down the tree, but always transform 2-nodes to 3- or */\ /* 4-nodes in order to maintain the invariant that the current */\ /* node is not a 2-node. This allows simple deletion once a leaf */\ /* is reached. Handle the root specially though, since there may */\ /* be no way to convert it from a 2-node to a 3-node. */\ rbp_r_cmp = (a_cmp)((a_node), rbp_r_c); \ if (rbp_r_cmp < 0) { \ rbp_r_t = rbp_left_get(a_type, a_field, rbp_r_c); \ rbp_r_u = rbp_left_get(a_type, a_field, rbp_r_t); \ if (rbp_red_get(a_type, a_field, rbp_r_t) == false \ && rbp_red_get(a_type, a_field, rbp_r_u) == false) { \ /* Apply standard transform to prepare for left move. */\ rbp_move_red_left(a_type, a_field, rbp_r_c, rbp_r_t); \ rbp_black_set(a_type, a_field, rbp_r_t); \ rbp_left_set(a_type, a_field, rbp_r_p, rbp_r_t); \ rbp_r_c = rbp_r_t; \ } else { \ /* Move left. */\ rbp_r_p = rbp_r_c; \ rbp_r_c = rbp_left_get(a_type, a_field, rbp_r_c); \ } \ } else { \ if (rbp_r_cmp == 0) { \ assert((a_node) == rbp_r_c); \ if (rbp_right_get(a_type, a_field, rbp_r_c) \ == &(a_tree)->rbt_nil) { \ /* Delete root node (which is also a leaf node). */\ if (rbp_left_get(a_type, a_field, rbp_r_c) \ != &(a_tree)->rbt_nil) { \ rbp_lean_right(a_type, a_field, rbp_r_c, rbp_r_t); \ rbp_right_set(a_type, a_field, rbp_r_t, \ &(a_tree)->rbt_nil); \ } else { \ rbp_r_t = &(a_tree)->rbt_nil; \ } \ rbp_left_set(a_type, a_field, rbp_r_p, rbp_r_t); \ } else { \ /* This is the node we want to delete, but we will */\ /* instead swap it with its successor and delete the */\ /* successor. Record enough information to do the */\ /* swap later. rbp_r_xp is the a_node's parent. */\ rbp_r_xp = rbp_r_p; \ rbp_r_cmp = 1; /* Note that deletion is incomplete. */\ } \ } \ if (rbp_r_cmp == 1) { \ if (rbp_red_get(a_type, a_field, rbp_left_get(a_type, \ a_field, rbp_right_get(a_type, a_field, rbp_r_c))) \ == false) { \ rbp_r_t = rbp_left_get(a_type, a_field, rbp_r_c); \ if (rbp_red_get(a_type, a_field, rbp_r_t)) { \ /* Standard transform. */\ rbp_move_red_right(a_type, a_field, rbp_r_c, \ rbp_r_t); \ } else { \ /* Root-specific transform. */\ rbp_red_set(a_type, a_field, rbp_r_c); \ rbp_r_u = rbp_left_get(a_type, a_field, rbp_r_t); \ if (rbp_red_get(a_type, a_field, rbp_r_u)) { \ rbp_black_set(a_type, a_field, rbp_r_u); \ rbp_rotate_right(a_type, a_field, rbp_r_c, \ rbp_r_t); \ rbp_rotate_left(a_type, a_field, rbp_r_c, \ rbp_r_u); \ rbp_right_set(a_type, a_field, rbp_r_t, \ rbp_r_u); \ } else { \ rbp_red_set(a_type, a_field, rbp_r_t); \ rbp_rotate_left(a_type, a_field, rbp_r_c, \ rbp_r_t); \ } \ } \ rbp_left_set(a_type, a_field, rbp_r_p, rbp_r_t); \ rbp_r_c = rbp_r_t; \ } else { \ /* Move right. */\ rbp_r_p = rbp_r_c; \ rbp_r_c = rbp_right_get(a_type, a_field, rbp_r_c); \ } \ } \ } \ if (rbp_r_cmp != 0) { \ while (true) { \ assert(rbp_r_p != &(a_tree)->rbt_nil); \ rbp_r_cmp = (a_cmp)((a_node), rbp_r_c); \ if (rbp_r_cmp < 0) { \ rbp_r_t = rbp_left_get(a_type, a_field, rbp_r_c); \ if (rbp_r_t == &(a_tree)->rbt_nil) { \ /* rbp_r_c now refers to the successor node to */\ /* relocate, and rbp_r_xp/a_node refer to the */\ /* context for the relocation. */\ if (rbp_left_get(a_type, a_field, rbp_r_xp) \ == (a_node)) { \ rbp_left_set(a_type, a_field, rbp_r_xp, \ rbp_r_c); \ } else { \ assert(rbp_right_get(a_type, a_field, \ rbp_r_xp) == (a_node)); \ rbp_right_set(a_type, a_field, rbp_r_xp, \ rbp_r_c); \ } \ rbp_left_set(a_type, a_field, rbp_r_c, \ rbp_left_get(a_type, a_field, (a_node))); \ rbp_right_set(a_type, a_field, rbp_r_c, \ rbp_right_get(a_type, a_field, (a_node))); \ rbp_color_set(a_type, a_field, rbp_r_c, \ rbp_red_get(a_type, a_field, (a_node))); \ if (rbp_left_get(a_type, a_field, rbp_r_p) \ == rbp_r_c) { \ rbp_left_set(a_type, a_field, rbp_r_p, \ &(a_tree)->rbt_nil); \ } else { \ assert(rbp_right_get(a_type, a_field, rbp_r_p) \ == rbp_r_c); \ rbp_right_set(a_type, a_field, rbp_r_p, \ &(a_tree)->rbt_nil); \ } \ break; \ } \ rbp_r_u = rbp_left_get(a_type, a_field, rbp_r_t); \ if (rbp_red_get(a_type, a_field, rbp_r_t) == false \ && rbp_red_get(a_type, a_field, rbp_r_u) == false) { \ rbp_move_red_left(a_type, a_field, rbp_r_c, \ rbp_r_t); \ if (rbp_left_get(a_type, a_field, rbp_r_p) \ == rbp_r_c) { \ rbp_left_set(a_type, a_field, rbp_r_p, rbp_r_t);\ } else { \ rbp_right_set(a_type, a_field, rbp_r_p, \ rbp_r_t); \ } \ rbp_r_c = rbp_r_t; \ } else { \ rbp_r_p = rbp_r_c; \ rbp_r_c = rbp_left_get(a_type, a_field, rbp_r_c); \ } \ } else { \ /* Check whether to delete this node (it has to be */\ /* the correct node and a leaf node). */\ if (rbp_r_cmp == 0) { \ assert((a_node) == rbp_r_c); \ if (rbp_right_get(a_type, a_field, rbp_r_c) \ == &(a_tree)->rbt_nil) { \ /* Delete leaf node. */\ if (rbp_left_get(a_type, a_field, rbp_r_c) \ != &(a_tree)->rbt_nil) { \ rbp_lean_right(a_type, a_field, rbp_r_c, \ rbp_r_t); \ rbp_right_set(a_type, a_field, rbp_r_t, \ &(a_tree)->rbt_nil); \ } else { \ rbp_r_t = &(a_tree)->rbt_nil; \ } \ if (rbp_left_get(a_type, a_field, rbp_r_p) \ == rbp_r_c) { \ rbp_left_set(a_type, a_field, rbp_r_p, \ rbp_r_t); \ } else { \ rbp_right_set(a_type, a_field, rbp_r_p, \ rbp_r_t); \ } \ break; \ } else { \ /* This is the node we want to delete, but we */\ /* will instead swap it with its successor */\ /* and delete the successor. Record enough */\ /* information to do the swap later. */\ /* rbp_r_xp is a_node's parent. */\ rbp_r_xp = rbp_r_p; \ } \ } \ rbp_r_t = rbp_right_get(a_type, a_field, rbp_r_c); \ rbp_r_u = rbp_left_get(a_type, a_field, rbp_r_t); \ if (rbp_red_get(a_type, a_field, rbp_r_u) == false) { \ rbp_move_red_right(a_type, a_field, rbp_r_c, \ rbp_r_t); \ if (rbp_left_get(a_type, a_field, rbp_r_p) \ == rbp_r_c) { \ rbp_left_set(a_type, a_field, rbp_r_p, rbp_r_t);\ } else { \ rbp_right_set(a_type, a_field, rbp_r_p, \ rbp_r_t); \ } \ rbp_r_c = rbp_r_t; \ } else { \ rbp_r_p = rbp_r_c; \ rbp_r_c = rbp_right_get(a_type, a_field, rbp_r_c); \ } \ } \ } \ } \ /* Update root. */\ (a_tree)->rbt_root = rbp_left_get(a_type, a_field, &rbp_r_s); \ } while (0) /* * The rb_wrap() macro provides a convenient way to wrap functions around the * cpp macros. The main benefits of wrapping are that 1) repeated macro * expansion can cause code bloat, especially for rb_{insert,remove)(), and * 2) type, linkage, comparison functions, etc. need not be specified at every * call point. */ #define rb_wrap(a_attr, a_prefix, a_tree_type, a_type, a_field, a_cmp) \ a_attr void \ a_prefix##new(a_tree_type *tree) { \ rb_new(a_type, a_field, tree); \ } \ a_attr a_type * \ a_prefix##first(a_tree_type *tree) { \ a_type *ret; \ rb_first(a_type, a_field, tree, ret); \ return (ret); \ } \ a_attr a_type * \ a_prefix##last(a_tree_type *tree) { \ a_type *ret; \ rb_last(a_type, a_field, tree, ret); \ return (ret); \ } \ a_attr a_type * \ a_prefix##next(a_tree_type *tree, a_type *node) { \ a_type *ret; \ rb_next(a_type, a_field, a_cmp, tree, node, ret); \ return (ret); \ } \ a_attr a_type * \ a_prefix##prev(a_tree_type *tree, a_type *node) { \ a_type *ret; \ rb_prev(a_type, a_field, a_cmp, tree, node, ret); \ return (ret); \ } \ a_attr a_type * \ a_prefix##search(a_tree_type *tree, a_type *key) { \ a_type *ret; \ rb_search(a_type, a_field, a_cmp, tree, key, ret); \ return (ret); \ } \ a_attr a_type * \ a_prefix##nsearch(a_tree_type *tree, a_type *key) { \ a_type *ret; \ rb_nsearch(a_type, a_field, a_cmp, tree, key, ret); \ return (ret); \ } \ a_attr a_type * \ a_prefix##psearch(a_tree_type *tree, a_type *key) { \ a_type *ret; \ rb_psearch(a_type, a_field, a_cmp, tree, key, ret); \ return (ret); \ } \ a_attr void \ a_prefix##insert(a_tree_type *tree, a_type *node) { \ rb_insert(a_type, a_field, a_cmp, tree, node); \ } \ a_attr void \ a_prefix##remove(a_tree_type *tree, a_type *node) { \ rb_remove(a_type, a_field, a_cmp, tree, node); \ } /* * The iterators simulate recursion via an array of pointers that store the * current path. This is critical to performance, since a series of calls to * rb_{next,prev}() would require time proportional to (n lg n), whereas this * implementation only requires time proportional to (n). * * Since the iterators cache a path down the tree, any tree modification may * cause the cached path to become invalid. In order to continue iteration, * use something like the following sequence: * * { * a_type *node, *tnode; * * rb_foreach_begin(a_type, a_field, a_tree, node) { * ... * rb_next(a_type, a_field, a_cmp, a_tree, node, tnode); * rb_remove(a_type, a_field, a_cmp, a_tree, node); * rb_foreach_next(a_type, a_field, a_cmp, a_tree, tnode); * ... * } rb_foreach_end(a_type, a_field, a_tree, node) * } * * Note that this idiom is not advised if every iteration modifies the tree, * since in that case there is no algorithmic complexity improvement over a * series of rb_{next,prev}() calls, thus making the setup overhead wasted * effort. */ #define rb_foreach_begin(a_type, a_field, a_tree, a_var) { \ /* Compute the maximum possible tree depth (3X the black height). */\ unsigned rbp_f_height; \ rbp_black_height(a_type, a_field, a_tree, rbp_f_height); \ rbp_f_height *= 3; \ { \ /* Initialize the path to contain the left spine. */\ a_type *rbp_f_path[rbp_f_height]; \ a_type *rbp_f_node; \ bool rbp_f_synced = false; \ unsigned rbp_f_depth = 0; \ if ((a_tree)->rbt_root != &(a_tree)->rbt_nil) { \ rbp_f_path[rbp_f_depth] = (a_tree)->rbt_root; \ rbp_f_depth++; \ while ((rbp_f_node = rbp_left_get(a_type, a_field, \ rbp_f_path[rbp_f_depth-1])) != &(a_tree)->rbt_nil) { \ rbp_f_path[rbp_f_depth] = rbp_f_node; \ rbp_f_depth++; \ } \ } \ /* While the path is non-empty, iterate. */\ while (rbp_f_depth > 0) { \ (a_var) = rbp_f_path[rbp_f_depth-1]; /* Only use if modifying the tree during iteration. */ #define rb_foreach_next(a_type, a_field, a_cmp, a_tree, a_node) \ /* Re-initialize the path to contain the path to a_node. */\ rbp_f_depth = 0; \ if (a_node != NULL) { \ if ((a_tree)->rbt_root != &(a_tree)->rbt_nil) { \ rbp_f_path[rbp_f_depth] = (a_tree)->rbt_root; \ rbp_f_depth++; \ rbp_f_node = rbp_f_path[0]; \ while (true) { \ int rbp_f_cmp = (a_cmp)((a_node), \ rbp_f_path[rbp_f_depth-1]); \ if (rbp_f_cmp < 0) { \ rbp_f_node = rbp_left_get(a_type, a_field, \ rbp_f_path[rbp_f_depth-1]); \ } else if (rbp_f_cmp > 0) { \ rbp_f_node = rbp_right_get(a_type, a_field, \ rbp_f_path[rbp_f_depth-1]); \ } else { \ break; \ } \ assert(rbp_f_node != &(a_tree)->rbt_nil); \ rbp_f_path[rbp_f_depth] = rbp_f_node; \ rbp_f_depth++; \ } \ } \ } \ rbp_f_synced = true; #define rb_foreach_end(a_type, a_field, a_tree, a_var) \ if (rbp_f_synced) { \ rbp_f_synced = false; \ continue; \ } \ /* Find the successor. */\ if ((rbp_f_node = rbp_right_get(a_type, a_field, \ rbp_f_path[rbp_f_depth-1])) != &(a_tree)->rbt_nil) { \ /* The successor is the left-most node in the right */\ /* subtree. */\ rbp_f_path[rbp_f_depth] = rbp_f_node; \ rbp_f_depth++; \ while ((rbp_f_node = rbp_left_get(a_type, a_field, \ rbp_f_path[rbp_f_depth-1])) != &(a_tree)->rbt_nil) { \ rbp_f_path[rbp_f_depth] = rbp_f_node; \ rbp_f_depth++; \ } \ } else { \ /* The successor is above the current node. Unwind */\ /* until a left-leaning edge is removed from the */\ /* path, or the path is empty. */\ for (rbp_f_depth--; rbp_f_depth > 0; rbp_f_depth--) { \ if (rbp_left_get(a_type, a_field, \ rbp_f_path[rbp_f_depth-1]) \ == rbp_f_path[rbp_f_depth]) { \ break; \ } \ } \ } \ } \ } \ } #define rb_foreach_reverse_begin(a_type, a_field, a_tree, a_var) { \ /* Compute the maximum possible tree depth (3X the black height). */\ unsigned rbp_fr_height; \ rbp_black_height(a_type, a_field, a_tree, rbp_fr_height); \ rbp_fr_height *= 3; \ { \ /* Initialize the path to contain the right spine. */\ a_type *rbp_fr_path[rbp_fr_height]; \ a_type *rbp_fr_node; \ bool rbp_fr_synced = false; \ unsigned rbp_fr_depth = 0; \ if ((a_tree)->rbt_root != &(a_tree)->rbt_nil) { \ rbp_fr_path[rbp_fr_depth] = (a_tree)->rbt_root; \ rbp_fr_depth++; \ while ((rbp_fr_node = rbp_right_get(a_type, a_field, \ rbp_fr_path[rbp_fr_depth-1])) != &(a_tree)->rbt_nil) { \ rbp_fr_path[rbp_fr_depth] = rbp_fr_node; \ rbp_fr_depth++; \ } \ } \ /* While the path is non-empty, iterate. */\ while (rbp_fr_depth > 0) { \ (a_var) = rbp_fr_path[rbp_fr_depth-1]; /* Only use if modifying the tree during iteration. */ #define rb_foreach_reverse_prev(a_type, a_field, a_cmp, a_tree, a_node) \ /* Re-initialize the path to contain the path to a_node. */\ rbp_fr_depth = 0; \ if (a_node != NULL) { \ if ((a_tree)->rbt_root != &(a_tree)->rbt_nil) { \ rbp_fr_path[rbp_fr_depth] = (a_tree)->rbt_root; \ rbp_fr_depth++; \ rbp_fr_node = rbp_fr_path[0]; \ while (true) { \ int rbp_fr_cmp = (a_cmp)((a_node), \ rbp_fr_path[rbp_fr_depth-1]); \ if (rbp_fr_cmp < 0) { \ rbp_fr_node = rbp_left_get(a_type, a_field, \ rbp_fr_path[rbp_fr_depth-1]); \ } else if (rbp_fr_cmp > 0) { \ rbp_fr_node = rbp_right_get(a_type, a_field,\ rbp_fr_path[rbp_fr_depth-1]); \ } else { \ break; \ } \ assert(rbp_fr_node != &(a_tree)->rbt_nil); \ rbp_fr_path[rbp_fr_depth] = rbp_fr_node; \ rbp_fr_depth++; \ } \ } \ } \ rbp_fr_synced = true; #define rb_foreach_reverse_end(a_type, a_field, a_tree, a_var) \ if (rbp_fr_synced) { \ rbp_fr_synced = false; \ continue; \ } \ if (rbp_fr_depth == 0) { \ /* rb_foreach_reverse_sync() was called with a NULL */\ /* a_node. */\ break; \ } \ /* Find the predecessor. */\ if ((rbp_fr_node = rbp_left_get(a_type, a_field, \ rbp_fr_path[rbp_fr_depth-1])) != &(a_tree)->rbt_nil) { \ /* The predecessor is the right-most node in the left */\ /* subtree. */\ rbp_fr_path[rbp_fr_depth] = rbp_fr_node; \ rbp_fr_depth++; \ while ((rbp_fr_node = rbp_right_get(a_type, a_field, \ rbp_fr_path[rbp_fr_depth-1])) != &(a_tree)->rbt_nil) {\ rbp_fr_path[rbp_fr_depth] = rbp_fr_node; \ rbp_fr_depth++; \ } \ } else { \ /* The predecessor is above the current node. Unwind */\ /* until a right-leaning edge is removed from the */\ /* path, or the path is empty. */\ for (rbp_fr_depth--; rbp_fr_depth > 0; rbp_fr_depth--) {\ if (rbp_right_get(a_type, a_field, \ rbp_fr_path[rbp_fr_depth-1]) \ == rbp_fr_path[rbp_fr_depth]) { \ break; \ } \ } \ } \ } \ } \ } #endif /* RB_H_ */ varnish-3.0.5/lib/libjemalloc/malloc.30000644000175000017500000004502012247035455014500 00000000000000.\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" This code is derived from software contributed to Berkeley by .\" the American National Standards Committee X3, on Information .\" Processing Systems. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must 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. .\" .\" @(#)malloc.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD: head/lib/libc/stdlib/malloc.3 182225 2008-08-27 02:00:53Z jasone $ .\" .Dd August 26, 2008 .Dt MALLOC 3 .Os .Sh NAME .Nm malloc , calloc , realloc , free , reallocf , malloc_usable_size .Nd general purpose memory allocation functions .Sh LIBRARY .Lb libc .Sh SYNOPSIS .In stdlib.h .Ft void * .Fn malloc "size_t size" .Ft void * .Fn calloc "size_t number" "size_t size" .Ft void * .Fn realloc "void *ptr" "size_t size" .Ft void * .Fn reallocf "void *ptr" "size_t size" .Ft void .Fn free "void *ptr" .Ft const char * .Va _malloc_options ; .Ft void .Fo \*(lp*_malloc_message\*(rp .Fa "const char *p1" "const char *p2" "const char *p3" "const char *p4" .Fc .In malloc_np.h .Ft size_t .Fn malloc_usable_size "const void *ptr" .Sh DESCRIPTION The .Fn malloc function allocates .Fa size bytes of uninitialized memory. The allocated space is suitably aligned (after possible pointer coercion) for storage of any type of object. .Pp The .Fn calloc function allocates space for .Fa number objects, each .Fa size bytes in length. The result is identical to calling .Fn malloc with an argument of .Dq "number * size" , with the exception that the allocated memory is explicitly initialized to zero bytes. .Pp The .Fn realloc function changes the size of the previously allocated memory referenced by .Fa ptr to .Fa size bytes. The contents of the memory are unchanged up to the lesser of the new and old sizes. If the new size is larger, the contents of the newly allocated portion of the memory are undefined. Upon success, the memory referenced by .Fa ptr is freed and a pointer to the newly allocated memory is returned. Note that .Fn realloc and .Fn reallocf may move the memory allocation, resulting in a different return value than .Fa ptr . If .Fa ptr is .Dv NULL , the .Fn realloc function behaves identically to .Fn malloc for the specified size. .Pp The .Fn reallocf function is identical to the .Fn realloc function, except that it will free the passed pointer when the requested memory cannot be allocated. This is a .Fx specific API designed to ease the problems with traditional coding styles for realloc causing memory leaks in libraries. .Pp The .Fn free function causes the allocated memory referenced by .Fa ptr to be made available for future allocations. If .Fa ptr is .Dv NULL , no action occurs. .Pp The .Fn malloc_usable_size function returns the usable size of the allocation pointed to by .Fa ptr . The return value may be larger than the size that was requested during allocation. The .Fn malloc_usable_size function is not a mechanism for in-place .Fn realloc ; rather it is provided solely as a tool for introspection purposes. Any discrepancy between the requested allocation size and the size reported by .Fn malloc_usable_size should not be depended on, since such behavior is entirely implementation-dependent. .Sh TUNING Once, when the first call is made to one of these memory allocation routines, various flags will be set or reset, which affects the workings of this allocator implementation. .Pp The .Dq name of the file referenced by the symbolic link named .Pa /etc/malloc.conf , the value of the environment variable .Ev MALLOC_OPTIONS , and the string pointed to by the global variable .Va _malloc_options will be interpreted, in that order, from left to right as flags. .Pp Each flag is a single letter, optionally prefixed by a non-negative base 10 integer repetition count. For example, .Dq 3N is equivalent to .Dq NNN . Some flags control parameter magnitudes, where uppercase increases the magnitude, and lowercase decreases the magnitude. Other flags control boolean parameters, where uppercase indicates that a behavior is set, or on, and lowercase means that a behavior is not set, or off. .Bl -tag -width indent .It A All warnings (except for the warning about unknown flags being set) become fatal. The process will call .Xr abort 3 in these cases. .It B Double/halve the per-arena lock contention threshold at which a thread is randomly re-assigned to an arena. This dynamic load balancing tends to push threads away from highly contended arenas, which avoids worst case contention scenarios in which threads disproportionately utilize arenas. However, due to the highly dynamic load that applications may place on the allocator, it is impossible for the allocator to know in advance how sensitive it should be to contention over arenas. Therefore, some applications may benefit from increasing or decreasing this threshold parameter. This option is not available for some configurations (non-PIC). .It C Double/halve the size of the maximum size class that is a multiple of the cacheline size (64). Above this size, subpage spacing (256 bytes) is used for size classes. The default value is 512 bytes. .It D Use .Xr sbrk 2 to acquire memory in the data storage segment (DSS). This option is enabled by default. See the .Dq M option for related information and interactions. .It F Double/halve the per-arena maximum number of dirty unused pages that are allowed to accumulate before informing the kernel about at least half of those pages via .Xr madvise 2 . This provides the kernel with sufficient information to recycle dirty pages if physical memory becomes scarce and the pages remain unused. The default is 512 pages per arena; .Ev MALLOC_OPTIONS=10f will prevent any dirty unused pages from accumulating. .It G When there are multiple threads, use thread-specific caching for objects that are smaller than one page. This option is enabled by default. Thread-specific caching allows many allocations to be satisfied without performing any thread synchronization, at the cost of increased memory use. See the .Dq R option for related tuning information. This option is not available for some configurations (non-PIC). .It J Each byte of new memory allocated by .Fn malloc , .Fn realloc or .Fn reallocf will be initialized to 0xa5. All memory returned by .Fn free , .Fn realloc or .Fn reallocf will be initialized to 0x5a. This is intended for debugging and will impact performance negatively. .It K Double/halve the virtual memory chunk size. The default chunk size is 1 MB. .It M Use .Xr mmap 2 to acquire anonymously mapped memory. This option is enabled by default. If both the .Dq D and .Dq M options are enabled, the allocator prefers the DSS over anonymous mappings, but allocation only fails if memory cannot be acquired via either method. If neither option is enabled, then the .Dq M option is implicitly enabled in order to assure that there is a method for acquiring memory. .It N Double/halve the number of arenas. The default number of arenas is two times the number of CPUs, or one if there is a single CPU. .It P Various statistics are printed at program exit via an .Xr atexit 3 function. This has the potential to cause deadlock for a multi-threaded process that exits while one or more threads are executing in the memory allocation functions. Therefore, this option should only be used with care; it is primarily intended as a performance tuning aid during application development. .It Q Double/halve the size of the maximum size class that is a multiple of the quantum (8 or 16 bytes, depending on architecture). Above this size, cacheline spacing is used for size classes. The default value is 128 bytes. .It R Double/halve magazine size, which approximately doubles/halves the number of rounds in each magazine. Magazines are used by the thread-specific caching machinery to acquire and release objects in bulk. Increasing the magazine size decreases locking overhead, at the expense of increased memory usage. This option is not available for some configurations (non-PIC). .It U Generate .Dq utrace entries for .Xr ktrace 1 , for all operations. Consult the source for details on this option. .It V Attempting to allocate zero bytes will return a .Dv NULL pointer instead of a valid pointer. (The default behavior is to make a minimal allocation and return a pointer to it.) This option is provided for System V compatibility. This option is incompatible with the .Dq X option. .It X Rather than return failure for any allocation function, display a diagnostic message on .Dv stderr and cause the program to drop core (using .Xr abort 3 ) . This option should be set at compile time by including the following in the source code: .Bd -literal -offset indent _malloc_options = "X"; .Ed .It Z Each byte of new memory allocated by .Fn malloc , .Fn realloc or .Fn reallocf will be initialized to 0. Note that this initialization only happens once for each byte, so .Fn realloc and .Fn reallocf calls do not zero memory that was previously allocated. This is intended for debugging and will impact performance negatively. .El .Pp The .Dq J and .Dq Z options are intended for testing and debugging. An application which changes its behavior when these options are used is flawed. .Sh IMPLEMENTATION NOTES Traditionally, allocators have used .Xr sbrk 2 to obtain memory, which is suboptimal for several reasons, including race conditions, increased fragmentation, and artificial limitations on maximum usable memory. This allocator uses both .Xr sbrk 2 and .Xr mmap 2 by default, but it can be configured at run time to use only one or the other. If resource limits are not a primary concern, the preferred configuration is .Ev MALLOC_OPTIONS=dM or .Ev MALLOC_OPTIONS=DM . When so configured, the .Ar datasize resource limit has little practical effect for typical applications; use .Ev MALLOC_OPTIONS=Dm if that is a concern. Regardless of allocator configuration, the .Ar vmemoryuse resource limit can be used to bound the total virtual memory used by a process, as described in .Xr limits 1 . .Pp This allocator uses multiple arenas in order to reduce lock contention for threaded programs on multi-processor systems. This works well with regard to threading scalability, but incurs some costs. There is a small fixed per-arena overhead, and additionally, arenas manage memory completely independently of each other, which means a small fixed increase in overall memory fragmentation. These overheads are not generally an issue, given the number of arenas normally used. Note that using substantially more arenas than the default is not likely to improve performance, mainly due to reduced cache performance. However, it may make sense to reduce the number of arenas if an application does not make much use of the allocation functions. .Pp In addition to multiple arenas, this allocator supports thread-specific caching for small objects (smaller than one page), in order to make it possible to completely avoid synchronization for most small allocation requests. Such caching allows very fast allocation in the common case, but it increases memory usage and fragmentation, since a bounded number of objects can remain allocated in each thread cache. .Pp Memory is conceptually broken into equal-sized chunks, where the chunk size is a power of two that is greater than the page size. Chunks are always aligned to multiples of the chunk size. This alignment makes it possible to find metadata for user objects very quickly. .Pp User objects are broken into three categories according to size: small, large, and huge. Small objects are smaller than one page. Large objects are smaller than the chunk size. Huge objects are a multiple of the chunk size. Small and large objects are managed by arenas; huge objects are managed separately in a single data structure that is shared by all threads. Huge objects are used by applications infrequently enough that this single data structure is not a scalability issue. .Pp Each chunk that is managed by an arena tracks its contents as runs of contiguous pages (unused, backing a set of small objects, or backing one large object). The combination of chunk alignment and chunk page maps makes it possible to determine all metadata regarding small and large allocations in constant time. .Pp Small objects are managed in groups by page runs. Each run maintains a bitmap that tracks which regions are in use. Allocation requests that are no more than half the quantum (8 or 16, depending on architecture) are rounded up to the nearest power of two. Allocation requests that are more than half the quantum, but no more than the minimum cacheline-multiple size class (see the .Dq Q option) are rounded up to the nearest multiple of the quantum. Allocation requests that are more than the minumum cacheline-multiple size class, but no more than the minimum subpage-multiple size class (see the .Dq C option) are rounded up to the nearest multiple of the cacheline size (64). Allocation requests that are more than the minimum subpage-multiple size class are rounded up to the nearest multiple of the subpage size (256). Allocation requests that are more than one page, but small enough to fit in an arena-managed chunk (see the .Dq K option), are rounded up to the nearest run size. Allocation requests that are too large to fit in an arena-managed chunk are rounded up to the nearest multiple of the chunk size. .Pp Allocations are packed tightly together, which can be an issue for multi-threaded applications. If you need to assure that allocations do not suffer from cacheline sharing, round your allocation requests up to the nearest multiple of the cacheline size. .Sh DEBUGGING MALLOC PROBLEMS The first thing to do is to set the .Dq A option. This option forces a coredump (if possible) at the first sign of trouble, rather than the normal policy of trying to continue if at all possible. .Pp It is probably also a good idea to recompile the program with suitable options and symbols for debugger support. .Pp If the program starts to give unusual results, coredump or generally behave differently without emitting any of the messages mentioned in the next section, it is likely because it depends on the storage being filled with zero bytes. Try running it with the .Dq Z option set; if that improves the situation, this diagnosis has been confirmed. If the program still misbehaves, the likely problem is accessing memory outside the allocated area. .Pp Alternatively, if the symptoms are not easy to reproduce, setting the .Dq J option may help provoke the problem. .Pp In truly difficult cases, the .Dq U option, if supported by the kernel, can provide a detailed trace of all calls made to these functions. .Pp Unfortunately this implementation does not provide much detail about the problems it detects; the performance impact for storing such information would be prohibitive. There are a number of allocator implementations available on the Internet which focus on detecting and pinpointing problems by trading performance for extra sanity checks and detailed diagnostics. .Sh DIAGNOSTIC MESSAGES If any of the memory allocation/deallocation functions detect an error or warning condition, a message will be printed to file descriptor .Dv STDERR_FILENO . Errors will result in the process dumping core. If the .Dq A option is set, all warnings are treated as errors. .Pp The .Va _malloc_message variable allows the programmer to override the function which emits the text strings forming the errors and warnings if for some reason the .Dv stderr file descriptor is not suitable for this. Please note that doing anything which tries to allocate memory in this function is likely to result in a crash or deadlock. .Pp All messages are prefixed by .Dq Ao Ar progname Ac Ns Li : (malloc) . .Sh RETURN VALUES The .Fn malloc and .Fn calloc functions return a pointer to the allocated memory if successful; otherwise a .Dv NULL pointer is returned and .Va errno is set to .Er ENOMEM . .Pp The .Fn realloc and .Fn reallocf functions return a pointer, possibly identical to .Fa ptr , to the allocated memory if successful; otherwise a .Dv NULL pointer is returned, and .Va errno is set to .Er ENOMEM if the error was the result of an allocation failure. The .Fn realloc function always leaves the original buffer intact when an error occurs, whereas .Fn reallocf deallocates it in this case. .Pp The .Fn free function returns no value. .Pp The .Fn malloc_usable_size function returns the usable size of the allocation pointed to by .Fa ptr . .Sh ENVIRONMENT The following environment variables affect the execution of the allocation functions: .Bl -tag -width ".Ev MALLOC_OPTIONS" .It Ev MALLOC_OPTIONS If the environment variable .Ev MALLOC_OPTIONS is set, the characters it contains will be interpreted as flags to the allocation functions. .El .Sh EXAMPLES To dump core whenever a problem occurs: .Pp .Bd -literal -offset indent ln -s 'A' /etc/malloc.conf .Ed .Pp To specify in the source that a program does no return value checking on calls to these functions: .Bd -literal -offset indent _malloc_options = "X"; .Ed .Sh SEE ALSO .Xr limits 1 , .Xr madvise 2 , .Xr mmap 2 , .Xr sbrk 2 , .Xr alloca 3 , .Xr atexit 3 , .Xr getpagesize 3 , .Xr memory 3 , .Xr posix_memalign 3 .Sh STANDARDS The .Fn malloc , .Fn calloc , .Fn realloc and .Fn free functions conform to .St -isoC . .Sh HISTORY The .Fn reallocf function first appeared in .Fx 3.0 . .Pp The .Fn malloc_usable_size function first appeared in .Fx 7.0 . varnish-3.0.5/lib/libvarnishcompat/0000755000175000017500000000000012247037207014311 500000000000000varnish-3.0.5/lib/libvarnishcompat/Makefile.am0000644000175000017500000000030712247035455016270 00000000000000# INCLUDES = -I$(top_srcdir)/include pkglib_LTLIBRARIES = libvarnishcompat.la libvarnishcompat_la_LDFLAGS = -avoid-version libvarnishcompat_la_SOURCES = \ daemon.c \ execinfo.c \ srandomdev.c varnish-3.0.5/lib/libvarnishcompat/srandomdev.c0000644000175000017500000000411712234401732016534 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" #ifndef HAVE_SRANDOMDEV #include #include #include #include #include #include "compat/srandomdev.h" static int trydev(const char *fn, unsigned long *seed) { int fd; ssize_t sz; fd = open(fn, O_RDONLY); if (fd < 0) return (-1); sz = read(fd, seed, sizeof *seed); (void)close(fd); if (sz != sizeof *seed) return (-1); return (0); } void srandomdev(void) { struct timeval tv; unsigned long seed; if (trydev("/dev/urandom", &seed)) { if (trydev("/dev/random", &seed)) { gettimeofday(&tv, NULL); seed = (getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec; } } srandom(seed); } #endif varnish-3.0.5/lib/libvarnishcompat/Makefile.in0000644000175000017500000005150712247037163016307 00000000000000# Makefile.in generated by automake 1.14 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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.in $(srcdir)/Makefile.am \ $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.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 srandomdev.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 am__v_lt_1 = libvarnishcompat_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(libvarnishcompat_la_LDFLAGS) \ $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : 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_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/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_CC_1 = 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_CCLD_1 = SOURCES = $(libvarnishcompat_la_SOURCES) DIST_SOURCES = $(libvarnishcompat_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIBS = @CURSES_LIBS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ 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@ JEMALLOC_SUBDIR = @JEMALLOC_SUBDIR@ 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@ 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@ XSLTPROC = @XSLTPROC@ 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@ INCLUDES = -I$(top_srcdir)/include pkglib_LTLIBRARIES = libvarnishcompat.la libvarnishcompat_la_LDFLAGS = -avoid-version libvarnishcompat_la_SOURCES = \ daemon.c \ execinfo.c \ srandomdev.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(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: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) @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 " $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" || exit 1; \ 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)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } 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@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/srandomdev.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 -o $@ $< .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 -o $@ `$(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: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ 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-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES cscopelist-am ctags \ ctags-am 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 tags-am 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-3.0.5/lib/libvarnishcompat/daemon.c0000644000175000017500000000527112247035455015650 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-3.0.5/lib/libvarnishcompat/execinfo.c0000644000175000017500000004115312247035455016204 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); } static void * getreturnaddr(int level) { switch(level) { case 0: return __builtin_return_address(1); case 1: return __builtin_return_address(2); case 2: return __builtin_return_address(3); case 3: return __builtin_return_address(4); case 4: return __builtin_return_address(5); case 5: return __builtin_return_address(6); case 6: return __builtin_return_address(7); case 7: return __builtin_return_address(8); case 8: return __builtin_return_address(9); case 9: return __builtin_return_address(10); case 10: return __builtin_return_address(11); case 11: return __builtin_return_address(12); case 12: return __builtin_return_address(13); case 13: return __builtin_return_address(14); case 14: return __builtin_return_address(15); case 15: return __builtin_return_address(16); case 16: return __builtin_return_address(17); case 17: return __builtin_return_address(18); case 18: return __builtin_return_address(19); case 19: return __builtin_return_address(20); case 20: return __builtin_return_address(21); case 21: return __builtin_return_address(22); case 22: return __builtin_return_address(23); case 23: return __builtin_return_address(24); case 24: return __builtin_return_address(25); case 25: return __builtin_return_address(26); case 26: return __builtin_return_address(27); case 27: return __builtin_return_address(28); case 28: return __builtin_return_address(29); case 29: return __builtin_return_address(30); case 30: return __builtin_return_address(31); case 31: return __builtin_return_address(32); case 32: return __builtin_return_address(33); case 33: return __builtin_return_address(34); case 34: return __builtin_return_address(35); case 35: return __builtin_return_address(36); case 36: return __builtin_return_address(37); case 37: return __builtin_return_address(38); case 38: return __builtin_return_address(39); case 39: return __builtin_return_address(40); case 40: return __builtin_return_address(41); case 41: return __builtin_return_address(42); case 42: return __builtin_return_address(43); case 43: return __builtin_return_address(44); case 44: return __builtin_return_address(45); case 45: return __builtin_return_address(46); case 46: return __builtin_return_address(47); case 47: return __builtin_return_address(48); case 48: return __builtin_return_address(49); case 49: return __builtin_return_address(50); case 50: return __builtin_return_address(51); case 51: return __builtin_return_address(52); case 52: return __builtin_return_address(53); case 53: return __builtin_return_address(54); case 54: return __builtin_return_address(55); case 55: return __builtin_return_address(56); case 56: return __builtin_return_address(57); case 57: return __builtin_return_address(58); case 58: return __builtin_return_address(59); case 59: return __builtin_return_address(60); case 60: return __builtin_return_address(61); case 61: return __builtin_return_address(62); case 62: return __builtin_return_address(63); case 63: return __builtin_return_address(64); case 64: return __builtin_return_address(65); case 65: return __builtin_return_address(66); case 66: return __builtin_return_address(67); case 67: return __builtin_return_address(68); case 68: return __builtin_return_address(69); case 69: return __builtin_return_address(70); case 70: return __builtin_return_address(71); case 71: return __builtin_return_address(72); case 72: return __builtin_return_address(73); case 73: return __builtin_return_address(74); case 74: return __builtin_return_address(75); case 75: return __builtin_return_address(76); case 76: return __builtin_return_address(77); case 77: return __builtin_return_address(78); case 78: return __builtin_return_address(79); case 79: return __builtin_return_address(80); case 80: return __builtin_return_address(81); case 81: return __builtin_return_address(82); case 82: return __builtin_return_address(83); case 83: return __builtin_return_address(84); case 84: return __builtin_return_address(85); case 85: return __builtin_return_address(86); case 86: return __builtin_return_address(87); case 87: return __builtin_return_address(88); case 88: return __builtin_return_address(89); case 89: return __builtin_return_address(90); case 90: return __builtin_return_address(91); case 91: return __builtin_return_address(92); case 92: return __builtin_return_address(93); case 93: return __builtin_return_address(94); case 94: return __builtin_return_address(95); case 95: return __builtin_return_address(96); case 96: return __builtin_return_address(97); case 97: return __builtin_return_address(98); case 98: return __builtin_return_address(99); case 99: return __builtin_return_address(100); case 100: return __builtin_return_address(101); case 101: return __builtin_return_address(102); case 102: return __builtin_return_address(103); case 103: return __builtin_return_address(104); case 104: return __builtin_return_address(105); case 105: return __builtin_return_address(106); case 106: return __builtin_return_address(107); case 107: return __builtin_return_address(108); case 108: return __builtin_return_address(109); case 109: return __builtin_return_address(110); case 110: return __builtin_return_address(111); case 111: return __builtin_return_address(112); case 112: return __builtin_return_address(113); case 113: return __builtin_return_address(114); case 114: return __builtin_return_address(115); case 115: return __builtin_return_address(116); case 116: return __builtin_return_address(117); case 117: return __builtin_return_address(118); case 118: return __builtin_return_address(119); case 119: return __builtin_return_address(120); case 120: return __builtin_return_address(121); case 121: return __builtin_return_address(122); case 122: return __builtin_return_address(123); case 123: return __builtin_return_address(124); case 124: return __builtin_return_address(125); case 125: return __builtin_return_address(126); case 126: return __builtin_return_address(127); case 127: return __builtin_return_address(128); default: return NULL; } } static void * getframeaddr(int level) { switch(level) { case 0: return __builtin_frame_address(1); case 1: return __builtin_frame_address(2); case 2: return __builtin_frame_address(3); case 3: return __builtin_frame_address(4); case 4: return __builtin_frame_address(5); case 5: return __builtin_frame_address(6); case 6: return __builtin_frame_address(7); case 7: return __builtin_frame_address(8); case 8: return __builtin_frame_address(9); case 9: return __builtin_frame_address(10); case 10: return __builtin_frame_address(11); case 11: return __builtin_frame_address(12); case 12: return __builtin_frame_address(13); case 13: return __builtin_frame_address(14); case 14: return __builtin_frame_address(15); case 15: return __builtin_frame_address(16); case 16: return __builtin_frame_address(17); case 17: return __builtin_frame_address(18); case 18: return __builtin_frame_address(19); case 19: return __builtin_frame_address(20); case 20: return __builtin_frame_address(21); case 21: return __builtin_frame_address(22); case 22: return __builtin_frame_address(23); case 23: return __builtin_frame_address(24); case 24: return __builtin_frame_address(25); case 25: return __builtin_frame_address(26); case 26: return __builtin_frame_address(27); case 27: return __builtin_frame_address(28); case 28: return __builtin_frame_address(29); case 29: return __builtin_frame_address(30); case 30: return __builtin_frame_address(31); case 31: return __builtin_frame_address(32); case 32: return __builtin_frame_address(33); case 33: return __builtin_frame_address(34); case 34: return __builtin_frame_address(35); case 35: return __builtin_frame_address(36); case 36: return __builtin_frame_address(37); case 37: return __builtin_frame_address(38); case 38: return __builtin_frame_address(39); case 39: return __builtin_frame_address(40); case 40: return __builtin_frame_address(41); case 41: return __builtin_frame_address(42); case 42: return __builtin_frame_address(43); case 43: return __builtin_frame_address(44); case 44: return __builtin_frame_address(45); case 45: return __builtin_frame_address(46); case 46: return __builtin_frame_address(47); case 47: return __builtin_frame_address(48); case 48: return __builtin_frame_address(49); case 49: return __builtin_frame_address(50); case 50: return __builtin_frame_address(51); case 51: return __builtin_frame_address(52); case 52: return __builtin_frame_address(53); case 53: return __builtin_frame_address(54); case 54: return __builtin_frame_address(55); case 55: return __builtin_frame_address(56); case 56: return __builtin_frame_address(57); case 57: return __builtin_frame_address(58); case 58: return __builtin_frame_address(59); case 59: return __builtin_frame_address(60); case 60: return __builtin_frame_address(61); case 61: return __builtin_frame_address(62); case 62: return __builtin_frame_address(63); case 63: return __builtin_frame_address(64); case 64: return __builtin_frame_address(65); case 65: return __builtin_frame_address(66); case 66: return __builtin_frame_address(67); case 67: return __builtin_frame_address(68); case 68: return __builtin_frame_address(69); case 69: return __builtin_frame_address(70); case 70: return __builtin_frame_address(71); case 71: return __builtin_frame_address(72); case 72: return __builtin_frame_address(73); case 73: return __builtin_frame_address(74); case 74: return __builtin_frame_address(75); case 75: return __builtin_frame_address(76); case 76: return __builtin_frame_address(77); case 77: return __builtin_frame_address(78); case 78: return __builtin_frame_address(79); case 79: return __builtin_frame_address(80); case 80: return __builtin_frame_address(81); case 81: return __builtin_frame_address(82); case 82: return __builtin_frame_address(83); case 83: return __builtin_frame_address(84); case 84: return __builtin_frame_address(85); case 85: return __builtin_frame_address(86); case 86: return __builtin_frame_address(87); case 87: return __builtin_frame_address(88); case 88: return __builtin_frame_address(89); case 89: return __builtin_frame_address(90); case 90: return __builtin_frame_address(91); case 91: return __builtin_frame_address(92); case 92: return __builtin_frame_address(93); case 93: return __builtin_frame_address(94); case 94: return __builtin_frame_address(95); case 95: return __builtin_frame_address(96); case 96: return __builtin_frame_address(97); case 97: return __builtin_frame_address(98); case 98: return __builtin_frame_address(99); case 99: return __builtin_frame_address(100); case 100: return __builtin_frame_address(101); case 101: return __builtin_frame_address(102); case 102: return __builtin_frame_address(103); case 103: return __builtin_frame_address(104); case 104: return __builtin_frame_address(105); case 105: return __builtin_frame_address(106); case 106: return __builtin_frame_address(107); case 107: return __builtin_frame_address(108); case 108: return __builtin_frame_address(109); case 109: return __builtin_frame_address(110); case 110: return __builtin_frame_address(111); case 111: return __builtin_frame_address(112); case 112: return __builtin_frame_address(113); case 113: return __builtin_frame_address(114); case 114: return __builtin_frame_address(115); case 115: return __builtin_frame_address(116); case 116: return __builtin_frame_address(117); case 117: return __builtin_frame_address(118); case 118: return __builtin_frame_address(119); case 119: return __builtin_frame_address(120); case 120: return __builtin_frame_address(121); case 121: return __builtin_frame_address(122); case 122: return __builtin_frame_address(123); case 123: return __builtin_frame_address(124); case 124: return __builtin_frame_address(125); case 125: return __builtin_frame_address(126); case 126: return __builtin_frame_address(127); case 127: return __builtin_frame_address(128); 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-3.0.5/lib/libvarnish/0000755000175000017500000000000012247037207013105 500000000000000varnish-3.0.5/lib/libvarnish/vmb.c0000644000175000017500000000347212247035455013766 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 #include "libvarnish.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 varnish-3.0.5/lib/libvarnish/Makefile.am0000644000175000017500000000141512247035455015065 00000000000000INCLUDES = -I$(top_srcdir)/include @PCRE_CFLAGS@ pkglib_LTLIBRARIES = libvarnish.la libvarnish_la_LDFLAGS = -avoid-version libvarnish_la_SOURCES = \ argv.c \ assert.c \ binary_heap.c \ subproc.c \ cli_auth.c \ cli_common.c \ cli_serve.c \ flopen.c \ num.c \ time.c \ tcp.c \ vct.c \ version.c \ vev.c \ vin.c \ vlu.c \ vmb.c \ vpf.c \ vre.c \ vsb.c \ vsha256.c \ vss.c \ vtmpfile.c libvarnish_la_CFLAGS = -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"' libvarnish_la_LIBADD = ${RT_LIBS} ${NET_LIBS} ${LIBM} @PCRE_LIBS@ if ENABLE_TESTS TESTS = num_c_test noinst_PROGRAMS = ${TESTS} num_c_test_SOURCES = num.c num_c_test_CFLAGS = -DNUM_C_TEST -include config.h num_c_test_LDADD = ${LIBM} test: ${TESTS} @for test in ${TESTS} ; do ./$${test} ; done endif varnish-3.0.5/lib/libvarnish/argv.c0000644000175000017500000001220012247035455014126 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 "libvarnish.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)) { assert(!(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-3.0.5/lib/libvarnish/cli_serve.c0000644000175000017500000002722512247035455015157 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 #include #include #include #include #include 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; unsigned maxlen; }; /*--------------------------------------------------------------------*/ 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 %ld 1.0", 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; 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; if (VCLI_WriteResult(cfd->fdo, cli->result, VSB_data(cli->sb)) || 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); 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]); assert(!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, unsigned maxlen) { 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; 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->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-3.0.5/lib/libvarnish/cli_common.c0000644000175000017500000001055512247035455015321 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 "vsb.h" #include "libvarnish.h" #include "vcli.h" #include "cli_priv.h" #include "cli_common.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) (void)VSB_vprintf(cli->sb, fmt, ap); else (void)vfprintf(stdout, fmt, ap); va_end(ap); } /*lint -e{818} cli could be const */ void VCLI_Quote(struct cli *cli, const char *s) { VSB_quote(cli->sb, s, -1, 0); } void VCLI_SetResult(struct cli *cli, unsigned res) { if (cli != NULL) 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"; 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 */ i = snprintf(res, sizeof res, "%-3d %-8jd\n", status, (intmax_t)strlen(result)); assert(i == CLI_LINE0_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 = strlen(result); 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 = 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; if (status == NULL) status = &s; if (ptr != NULL) *ptr = NULL; i = read_tmo(fd, res, CLI_LINE0_LEN, tmo); if (i != CLI_LINE0_LEN) { *status = CLIS_COMMS; if (ptr != NULL) *ptr = strdup("CLI communication error (hdr)"); if (i != 0) return (i); return (*status); } assert(i == CLI_LINE0_LEN); assert(res[3] == ' '); assert(res[CLI_LINE0_LEN - 1] == '\n'); res[CLI_LINE0_LEN - 1] = '\0'; j = sscanf(res, "%u %u\n", &u, &v); assert(j == 2); *status = u; p = malloc(v + 1L); assert(p != NULL); i = read_tmo(fd, p, v + 1, tmo); if (i < 0) { *status = CLIS_COMMS; free(p); if (ptr != NULL) *ptr = strdup("CLI communication error (body)"); return (i); } assert(i == v + 1); assert(p[v] == '\n'); p[v] = '\0'; if (ptr == NULL) free(p); else *ptr = p; return (0); } varnish-3.0.5/lib/libvarnish/flopen.c0000644000175000017500000000676212234401732014461 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-3.0.5/lib/libvarnish/subproc.c0000644000175000017500000000727312247035455014662 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 "vsb.h" #include "vlu.h" #include "libvarnish.h" struct sub_priv { const char *name; struct vsb *sb; int lines; int maxlines; }; static int sub_vlu(void *priv, const char *str) { struct sub_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); } int SUB_run(struct vsb *sb, sub_func_f *func, void *priv, const char *name, int maxlines) { int rv, p[2], sfd, status; pid_t pid; struct vlu *vlu; struct sub_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 */ for (sfd = STDERR_FILENO + 1; sfd < 100; sfd++) (void)close(sfd); func(priv); _exit(1); } AZ(close(p[1])); vlu = VLU_New(&sp, sub_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) { VSB_printf(sb, "Running %s failed", name); if (WIFEXITED(status)) VSB_printf(sb, ", exit %d", WEXITSTATUS(status)); if (WIFSIGNALED(status)) VSB_printf(sb, ", signal %d", WTERMSIG(status)); if (WCOREDUMP(status)) VSB_printf(sb, ", core dumped"); VSB_printf(sb, "\n"); return (-1); } return (0); } varnish-3.0.5/lib/libvarnish/version.c0000644000175000017500000000355512247035455014671 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. * * Display a standardized version message. */ #include "config.h" #include #include "libvarnish.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-2011 Varnish Software AS\n"); } varnish-3.0.5/lib/libvarnish/vre.c0000644000175000017500000000746412247035455014003 00000000000000/*- * Copyright (c) 2006-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. */ #include #include #include "libvarnish.h" #include "miniobj.h" #include "vre.h" #if USE_PCRE_JIT #define VRE_STUDY_JIT_COMPILE PCRE_STUDY_JIT_COMPILE #else #define VRE_STUDY_JIT_COMPILE 0 #endif #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-3.0.5/lib/libvarnish/time.c0000644000175000017500000001554012247035455014137 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. * * In the highly unlikely event of performance trouble, handbuilt versions * would likely be faster than relying on the OS time functions. * * We must parse three 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() * * And always output the RFC1123 format. * */ #include "config.h" #include #include #include #include #include #include #include "libvarnish.h" /* * 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 TIM_mono(void) { #ifdef HAVE_GETHRTIME return (gethrtime() * 1e-9); #elif HAVE_CLOCK_GETTIME struct timespec ts; assert(clock_gettime(CLOCK_MONOTONIC, &ts) == 0); return (ts.tv_sec + 1e-9 * ts.tv_nsec); #else struct timeval tv; assert(gettimeofday(&tv, NULL) == 0); return (tv.tv_sec + 1e-6 * tv.tv_usec); #endif } double TIM_real(void) { #ifdef HAVE_CLOCK_GETTIME struct timespec ts; assert(clock_gettime(CLOCK_REALTIME, &ts) == 0); return (ts.tv_sec + 1e-9 * ts.tv_nsec); #else struct timeval tv; assert(gettimeofday(&tv, NULL) == 0); return (tv.tv_sec + 1e-6 * tv.tv_usec); #endif } void TIM_format(double t, char *p) { struct tm tm; time_t tt; tt = (time_t) t; (void)gmtime_r(&tt, &tm); AN(strftime(p, TIM_FORMAT_SIZE, "%a, %d %b %Y %T GMT", &tm)); } /* XXX: add statistics ? */ static const char *fmts[] = { "%a, %d %b %Y %T GMT", /* RFC 822 & RFC 1123 */ "%A, %d-%b-%y %T GMT", /* RFC 850 */ "%a %b %d %T %Y", /* ANSI-C asctime() */ "%F %T", /* ISO 8601 */ NULL }; time_t TIM_parse(const char *p) { time_t t; struct tm tm; const char **r; for (r = fmts; *r != NULL; r++) { memset(&tm, 0, sizeof tm); if (strptime(p, *r, &tm) != NULL) { /* * Make sure this is initialized on the off-chance * that some raving loonie would apply DST to UTC. */ tm.tm_isdst = -1; #if defined(HAVE_TIMEGM) t = timegm(&tm); #else /* * Ahh, another POSIX_STUPIDITY, how unexpected. * Instead of, as would have been logical, to have * tm_timezone element, mktime() is standardized as * always working in localtime. This brilliant idea * came from the same people who said "leap-seconds ? * Naah, screw it!". * * On broken systems without a working timegm(), * it is the responsibility of the calling program * to set the timezone to UTC. We check that. */ t = mktime(&tm); assert(!strcmp(tzname[0], "UTC")); #endif return (t); } } return (0); } void TIM_sleep(double t) { #ifdef HAVE_NANOSLEEP struct timespec ts; ts = TIM_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 TIM_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 TIM_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 #include /* * Compile with: * cc -o foo -DTEST_DRIVER -I../.. -I../../include time.c assert.c * (Solaris) * cc -o foo -DTEST_DRIVER -I../.. -I../../include -lm time.c assert.c * Test with: * env TZ=UTC ./foo * env TZ=CET ./foo */ static void tst(const char *s, time_t good) { time_t t; char buf[BUFSIZ]; t = TIM_parse(s); TIM_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 (2); } } 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 = TIM_real(); m_begin = TIM_mono(); TIM_sleep(ref); r_end = TIM_real(); m_end = TIM_mono(); err += tst_delta_check("TIM_mono", m_begin, m_end, ref); err += tst_delta_check("TIM_real", r_begin, r_end, ref); if (err) { printf("%d time delta test errrors\n", err); exit (2); } } int main(int argc, char **argv) { time_t t; char buf[BUFSIZ]; time(&t); memset(buf, 0x55, sizeof buf); TIM_format(t, buf); printf("scan = %d <%s>\n", TIM_parse(buf), buf); /* 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_delta(); return (0); } #endif varnish-3.0.5/lib/libvarnish/binary_heap.c0000644000175000017500000003427312247035455015466 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://portal.acm.org/citation.cfm?doid=1785414.1785434 * (or: http://queue.acm.org/detail.cfm?id=1814327) */ #include "config.h" #include #include #include #include "binary_heap.h" #include "libvarnish.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; assert(!(bh->page_size & bh->page_mask)); /* power of two */ for (u = 1; (1U << u) != bh->page_size; u++) ; bh->page_shift = u; assert(bh->page_size <= (sizeof(**bh->array) * ROW_WIDTH)); bh->cmp = cmp_f; bh->update = update_f; bh->next = ROOT_IDX; 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); assert(!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 /* Test driver -------------------------------------------------------*/ #include #include 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); assert(ff[v]->idx != 0); 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); assert(ff[v]->idx != 0); } if (0) chk2(bh); } fprintf(stderr, "%d updates OK\n", M); } return (0); } #endif varnish-3.0.5/lib/libvarnish/vin.c0000644000175000017500000000536212247035455013776 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 "libvarnish.h" #include "vsm.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-3.0.5/lib/libvarnish/tcp.c0000644000175000017500000001636012247035455013770 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 #ifdef __linux #include #endif #include #include #ifdef HAVE_SYS_FILIO_H #include #endif #include #include #include #include #include #include #include #include "config.h" #include "libvarnish.h" /*--------------------------------------------------------------------*/ int VTCP_port(const struct sockaddr_storage *addr) { if (addr->ss_family == AF_INET) { const struct sockaddr_in *ain = (const void *)addr; return ntohs((ain->sin_port)); } if (addr->ss_family == AF_INET6) { const struct sockaddr_in6 *ain = (const void *)addr; return ntohs((ain->sin6_port)); } return (-1); } /*--------------------------------------------------------------------*/ void VTCP_name(const struct sockaddr_storage *addr, unsigned l, char *abuf, unsigned alen, char *pbuf, unsigned plen) { int i; i = getnameinfo((const void *)addr, 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)); (void)snprintf(abuf, alen, "Conversion"); (void)snprintf(pbuf, plen, "Failed"); return; } /* XXX dirty hack for v4-to-v6 mapped addresses */ if (strncmp(abuf, "::ffff:", 7) == 0) { for (i = 0; abuf[i + 7]; ++i) abuf[i] = abuf[i + 7]; abuf[i] = '\0'; } } /*--------------------------------------------------------------------*/ 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_name(&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_name(&addr_s, l, abuf, alen, pbuf, plen); else { (void)snprintf(abuf, alen, ""); (void)snprintf(pbuf, plen, ""); } } /*--------------------------------------------------------------------*/ int VTCP_filter_http(int sock) { #ifdef HAVE_ACCEPT_FILTERS struct accept_filter_arg afa; int i; memset(&afa, 0, sizeof(afa)); strcpy(afa.af_name, "httpready"); errno = 0; i = setsockopt(sock, SOL_SOCKET, SO_ACCEPTFILTER, &afa, sizeof(afa)); /* XXX ugly */ if (i) printf("Acceptfilter(%d, httpready): %d %s\n", sock, i, strerror(errno)); return (i); #elif defined(__linux) int defer = 1; setsockopt(sock, SOL_TCP,TCP_DEFER_ACCEPT,(char *) &defer, sizeof(int)); return (0); #else (void)sock; return (0); #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_connect(int s, const struct sockaddr_storage *name, socklen_t namelen, int msec) { int i, k; socklen_t l; struct pollfd fds[1]; assert(s >= 0); /* Set the socket non-blocking */ if (msec > 0) (void)VTCP_nonblocking(s); /* Attempt the connect */ i = connect(s, (const void *)name, namelen); if (i == 0 || errno != EINPROGRESS) return (i); 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 */ errno = ETIMEDOUT; return (-1); } /* 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) return (-1); (void)VTCP_blocking(s); return (0); } /*-------------------------------------------------------------------- * 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) { struct timeval timeout; timeout.tv_sec = (int)floor(seconds); timeout.tv_usec = (int)(1e6 * (seconds - timeout.tv_sec)); #ifdef SO_RCVTIMEO_WORKS /* * 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; #endif } /*-------------------------------------------------------------------- * 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); } varnish-3.0.5/lib/libvarnish/vss.c0000644000175000017500000001675512247035455014025 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 #include #include "libvarnish.h" #include "vss.h" /* lightweight addrinfo */ struct vss_addr { int va_family; int va_socktype; int va_protocol; socklen_t va_addrlen; struct sockaddr_storage va_addr; }; /*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" * * See also RFC5952 */ int VSS_parse(const char *str, char **addr, char **port) { const char *p; *addr = *port = NULL; if (str[0] == '[') { /* IPv6 address of the form [::1]:80 */ if ((p = strchr(str, ']')) == NULL || p == str + 1 || (p[1] != '\0' && p[1] != ':')) return (-1); *addr = strdup(str + 1); XXXAN(*addr); (*addr)[p - (str + 1)] = '\0'; if (p[1] == ':') { *port = strdup(p + 2); XXXAN(*port); } } else { /* IPv4 address of the form 127.0.0.1:80, or non-numeric */ p = strchr(str, ' '); if (p == NULL) p = strchr(str, ':'); if (p == NULL) { *addr = strdup(str); XXXAN(*addr); } else { if (p > str) { *addr = strdup(str); XXXAN(*addr); (*addr)[p - str] = '\0'; } *port = strdup(p + 1); XXXAN(*port); } } return (0); } /* * For a given host and port, return a list of struct vss_addr, which * contains all the information necessary to open and bind a socket. One * vss_addr is returned for each distinct address returned by * getaddrinfo(). * * The value pointed to by the tap parameter receives a pointer to an * array of pointers to struct vss_addr. The caller is responsible for * freeing each individual struct vss_addr as well as the array. * * The return value is the number of addresses resoved, or zero. * * If the addr argument contains a port specification, that takes * precedence over the port argument. * * XXX: We need a function to free the allocated addresses. */ int VSS_resolve(const char *addr, const char *port, struct vss_addr ***vap) { struct addrinfo hints, *res0, *res; struct vss_addr **va; int i, ret; long int ptst; char *adp, *hop; *vap = NULL; memset(&hints, 0, sizeof hints); hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_PASSIVE; ret = VSS_parse(addr, &hop, &adp); if (ret) return (0); if (adp == NULL) ret = getaddrinfo(addr, port, &hints, &res0); else { ptst = strtol(adp,NULL,10); if (ptst < 0 || ptst > 65535) return(0); ret = getaddrinfo(hop, adp, &hints, &res0); } free(hop); free(adp); if (ret != 0) return (0); XXXAN(res0); for (res = res0, i = 0; res != NULL; res = res->ai_next, ++i) /* nothing */ ; if (i == 0) { freeaddrinfo(res0); return (0); } va = calloc(i, sizeof *va); XXXAN(va); *vap = va; for (res = res0, i = 0; res != NULL; res = res->ai_next, ++i) { va[i] = calloc(1, sizeof(**va)); XXXAN(va[i]); va[i]->va_family = res->ai_family; va[i]->va_socktype = res->ai_socktype; va[i]->va_protocol = res->ai_protocol; va[i]->va_addrlen = res->ai_addrlen; xxxassert(va[i]->va_addrlen <= sizeof va[i]->va_addr); memcpy(&va[i]->va_addr, res->ai_addr, va[i]->va_addrlen); } freeaddrinfo(res0); return (i); } /* * Given a struct vss_addr, 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 VSS_bind(const struct vss_addr *va) { int sd, val; sd = socket(va->va_family, va->va_socktype, va->va_protocol); if (sd < 0) { perror("socket()"); return (-1); } val = 1; if (setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof val) != 0) { perror("setsockopt(SO_REUSEADDR, 1)"); (void)close(sd); return (-1); } #ifdef IPV6_V6ONLY /* forcibly use separate sockets for IPv4 and IPv6 */ val = 1; if (va->va_family == AF_INET6 && setsockopt(sd, IPPROTO_IPV6, IPV6_V6ONLY, &val, sizeof val) != 0) { perror("setsockopt(IPV6_V6ONLY, 1)"); (void)close(sd); return (-1); } #endif if (bind(sd, (const void*)&va->va_addr, va->va_addrlen) != 0) { perror("bind()"); (void)close(sd); return (-1); } return (sd); } /* * Given a struct vss_addr, open a socket of the appropriate type, bind it * to the requested address, and start listening. * * If the address is an IPv6 address, the IPV6_V6ONLY option is set to * avoid conflicts between INADDR_ANY and IN6ADDR_ANY. */ int VSS_listen(const struct vss_addr *va, int depth) { int sd; sd = VSS_bind(va); if (sd >= 0) { if (listen(sd, depth) != 0) { perror("listen()"); (void)close(sd); return (-1); } } return (sd); } /* * Connect to the socket specified by the address info in va. * Return the socket. */ int VSS_connect(const struct vss_addr *va, int nonblock) { int sd, i; sd = socket(va->va_family, va->va_socktype, va->va_protocol); if (sd < 0) { if (errno != EPROTONOSUPPORT) perror("socket()"); return (-1); } if (nonblock) (void)VTCP_nonblocking(sd); i = connect(sd, (const void *)&va->va_addr, va->va_addrlen); if (i == 0 || (nonblock && errno == EINPROGRESS)) return (sd); perror("connect()"); (void)close(sd); return (-1); } /* * And the totally brutal version: Give me connection to this address */ int VSS_open(const char *str, double tmo) { int retval = -1; int nvaddr, n, i; struct vss_addr **vaddr; struct pollfd pfd; nvaddr = VSS_resolve(str, NULL, &vaddr); for (n = 0; n < nvaddr; n++) { retval = VSS_connect(vaddr[n], tmo != 0.0); if (retval >= 0 && tmo != 0.0) { pfd.fd = retval; pfd.events = POLLOUT; i = poll(&pfd, 1, tmo * 1e3); if (i == 0 || pfd.revents != POLLOUT) { (void)close(retval); retval = -1; } } if (retval >= 0) break; } for (n = 0; n < nvaddr; n++) free(vaddr[n]); free(vaddr); return (retval); } varnish-3.0.5/lib/libvarnish/Makefile.in0000644000175000017500000017402512247037162015103 00000000000000# Makefile.in generated by automake 1.14 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = num_c_test$(EXEEXT) @ENABLE_TESTS_TRUE@noinst_PROGRAMS = $(am__EXEEXT_1) subdir = lib/libvarnish DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/depcomp $(top_srcdir)/test-driver ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.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-argv.lo \ libvarnish_la-assert.lo libvarnish_la-binary_heap.lo \ libvarnish_la-subproc.lo libvarnish_la-cli_auth.lo \ libvarnish_la-cli_common.lo libvarnish_la-cli_serve.lo \ libvarnish_la-flopen.lo libvarnish_la-num.lo \ libvarnish_la-time.lo libvarnish_la-tcp.lo \ libvarnish_la-vct.lo libvarnish_la-version.lo \ libvarnish_la-vev.lo libvarnish_la-vin.lo libvarnish_la-vlu.lo \ libvarnish_la-vmb.lo libvarnish_la-vpf.lo libvarnish_la-vre.lo \ libvarnish_la-vsb.lo libvarnish_la-vsha256.lo \ libvarnish_la-vss.lo libvarnish_la-vtmpfile.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 am__v_lt_1 = 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 = num_c_test$(EXEEXT) PROGRAMS = $(noinst_PROGRAMS) am__num_c_test_SOURCES_DIST = num.c @ENABLE_TESTS_TRUE@am_num_c_test_OBJECTS = num_c_test-num.$(OBJEXT) num_c_test_OBJECTS = $(am_num_c_test_OBJECTS) @ENABLE_TESTS_TRUE@num_c_test_DEPENDENCIES = $(am__DEPENDENCIES_1) num_c_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(num_c_test_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : 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_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/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_CC_1 = 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_CCLD_1 = SOURCES = $(libvarnish_la_SOURCES) $(num_c_test_SOURCES) DIST_SOURCES = $(libvarnish_la_SOURCES) $(am__num_c_test_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # 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 # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # 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. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(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='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIBS = @CURSES_LIBS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ 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@ JEMALLOC_SUBDIR = @JEMALLOC_SUBDIR@ 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@ 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@ XSLTPROC = @XSLTPROC@ 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@ INCLUDES = -I$(top_srcdir)/include @PCRE_CFLAGS@ pkglib_LTLIBRARIES = libvarnish.la libvarnish_la_LDFLAGS = -avoid-version libvarnish_la_SOURCES = \ argv.c \ assert.c \ binary_heap.c \ subproc.c \ cli_auth.c \ cli_common.c \ cli_serve.c \ flopen.c \ num.c \ time.c \ tcp.c \ vct.c \ version.c \ vev.c \ vin.c \ vlu.c \ vmb.c \ vpf.c \ vre.c \ vsb.c \ vsha256.c \ vss.c \ vtmpfile.c libvarnish_la_CFLAGS = -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"' libvarnish_la_LIBADD = ${RT_LIBS} ${NET_LIBS} ${LIBM} @PCRE_LIBS@ @ENABLE_TESTS_TRUE@num_c_test_SOURCES = num.c @ENABLE_TESTS_TRUE@num_c_test_CFLAGS = -DNUM_C_TEST -include config.h @ENABLE_TESTS_TRUE@num_c_test_LDADD = ${LIBM} all: all-am .SUFFIXES: .SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: $(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: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) @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 " $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" || exit 1; \ 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)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } 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 num_c_test$(EXEEXT): $(num_c_test_OBJECTS) $(num_c_test_DEPENDENCIES) $(EXTRA_num_c_test_DEPENDENCIES) @rm -f num_c_test$(EXEEXT) $(AM_V_CCLD)$(num_c_test_LINK) $(num_c_test_OBJECTS) $(num_c_test_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-argv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-assert.Plo@am__quote@ @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-num.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-subproc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-tcp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvarnish_la-time.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-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-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-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-vtmpfile.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/num_c_test-num.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 -o $@ $< .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 -o $@ `$(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-argv.lo: argv.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-argv.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-argv.Tpo -c -o libvarnish_la-argv.lo `test -f 'argv.c' || echo '$(srcdir)/'`argv.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-argv.Tpo $(DEPDIR)/libvarnish_la-argv.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='argv.c' object='libvarnish_la-argv.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-argv.lo `test -f 'argv.c' || echo '$(srcdir)/'`argv.c libvarnish_la-assert.lo: assert.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-assert.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-assert.Tpo -c -o libvarnish_la-assert.lo `test -f 'assert.c' || echo '$(srcdir)/'`assert.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-assert.Tpo $(DEPDIR)/libvarnish_la-assert.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='assert.c' object='libvarnish_la-assert.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-assert.lo `test -f 'assert.c' || echo '$(srcdir)/'`assert.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-subproc.lo: subproc.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-subproc.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-subproc.Tpo -c -o libvarnish_la-subproc.lo `test -f 'subproc.c' || echo '$(srcdir)/'`subproc.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-subproc.Tpo $(DEPDIR)/libvarnish_la-subproc.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='subproc.c' object='libvarnish_la-subproc.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-subproc.lo `test -f 'subproc.c' || echo '$(srcdir)/'`subproc.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-num.lo: num.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-num.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-num.Tpo -c -o libvarnish_la-num.lo `test -f 'num.c' || echo '$(srcdir)/'`num.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-num.Tpo $(DEPDIR)/libvarnish_la-num.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='num.c' object='libvarnish_la-num.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-num.lo `test -f 'num.c' || echo '$(srcdir)/'`num.c libvarnish_la-time.lo: time.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-time.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-time.Tpo -c -o libvarnish_la-time.lo `test -f 'time.c' || echo '$(srcdir)/'`time.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-time.Tpo $(DEPDIR)/libvarnish_la-time.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='time.c' object='libvarnish_la-time.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-time.lo `test -f 'time.c' || echo '$(srcdir)/'`time.c libvarnish_la-tcp.lo: tcp.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-tcp.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-tcp.Tpo -c -o libvarnish_la-tcp.lo `test -f 'tcp.c' || echo '$(srcdir)/'`tcp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-tcp.Tpo $(DEPDIR)/libvarnish_la-tcp.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tcp.c' object='libvarnish_la-tcp.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-tcp.lo `test -f 'tcp.c' || echo '$(srcdir)/'`tcp.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-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-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 libvarnish_la-vtmpfile.lo: vtmpfile.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-vtmpfile.lo -MD -MP -MF $(DEPDIR)/libvarnish_la-vtmpfile.Tpo -c -o libvarnish_la-vtmpfile.lo `test -f 'vtmpfile.c' || echo '$(srcdir)/'`vtmpfile.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libvarnish_la-vtmpfile.Tpo $(DEPDIR)/libvarnish_la-vtmpfile.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='vtmpfile.c' object='libvarnish_la-vtmpfile.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-vtmpfile.lo `test -f 'vtmpfile.c' || echo '$(srcdir)/'`vtmpfile.c num_c_test-num.o: num.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(num_c_test_CFLAGS) $(CFLAGS) -MT num_c_test-num.o -MD -MP -MF $(DEPDIR)/num_c_test-num.Tpo -c -o num_c_test-num.o `test -f 'num.c' || echo '$(srcdir)/'`num.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/num_c_test-num.Tpo $(DEPDIR)/num_c_test-num.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='num.c' object='num_c_test-num.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) $(num_c_test_CFLAGS) $(CFLAGS) -c -o num_c_test-num.o `test -f 'num.c' || echo '$(srcdir)/'`num.c num_c_test-num.obj: num.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(num_c_test_CFLAGS) $(CFLAGS) -MT num_c_test-num.obj -MD -MP -MF $(DEPDIR)/num_c_test-num.Tpo -c -o num_c_test-num.obj `if test -f 'num.c'; then $(CYGPATH_W) 'num.c'; else $(CYGPATH_W) '$(srcdir)/num.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/num_c_test-num.Tpo $(DEPDIR)/num_c_test-num.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='num.c' object='num_c_test-num.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) $(num_c_test_CFLAGS) $(CFLAGS) -c -o num_c_test-num.obj `if test -f 'num.c'; then $(CYGPATH_W) 'num.c'; else $(CYGPATH_W) '$(srcdir)/num.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ 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-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ else \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? num_c_test.log: num_c_test$(EXEEXT) @p='num_c_test$(EXEEXT)'; \ b='num_c_test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) 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:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -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: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \ clean-generic clean-libtool clean-noinstPROGRAMS \ clean-pkglibLTLIBRARIES cscopelist-am ctags ctags-am 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 tags tags-am 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-3.0.5/lib/libvarnish/vlu.c0000644000175000017500000001104212247035455014000 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 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. * * Functions for assembling a bytestream into text-lines and calling * a function on each. */ #include "config.h" #include #include #include #include #include "libvarnish.h" #include "vlu.h" #include "miniobj.h" struct vlu { unsigned magic; #define LINEUP_MAGIC 0x8286661 char *buf; unsigned bufl; unsigned bufp; void *priv; int telnet; 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->telnet = -1; l->buf = malloc(l->bufl + 1L); if (l->buf == NULL) { FREE_OBJ(l); l = NULL; } } return (l); } void VLU_SetTelnet(struct vlu *l, int fd) { CHECK_OBJ_NOTNULL(l, LINEUP_MAGIC); assert(fd >= 0); l->telnet = fd; } void VLU_Destroy(struct vlu *l) { CHECK_OBJ_NOTNULL(l, LINEUP_MAGIC); free(l->buf); FREE_OBJ(l); } static int vlu_dotelnet(struct vlu *l, char *p) { char *e; char tno[3]; int i; e = l->buf + l->bufp; assert(p >= l->buf && p < e); assert(*p == (char)255); /* We need at least two characters */ if (p == e - 1) return (1); /* And three for will/wont/do/dont */ if (p[1] >= (char)251 && p[1] <= (char)254 && p == e - 2) return (1); switch (p[1]) { case (char)251: /* WILL */ case (char)252: /* WONT */ /* Ignore these */ i = 3; break; case (char)253: /* DO */ case (char)254: /* DONT */ /* Return WONT for these */ memcpy(tno, p, 3); tno[1] = (char)252; (void)write(l->telnet, tno, 3); i = 3; break; default: /* Ignore the rest */ /* XXX: only p[1] >= 240 ? */ i = 2; } /* Remove telnet sequence from buffer */ memmove(p, p + i, 1 + e - (p + i)); l->bufp -= i; return (0); } 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++) { while (l->telnet >= 0 && *q == (char)255) if (vlu_dotelnet(l, q)) return (0); 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)); } int VLU_File(FILE *f, struct vlu *l) { char *p; CHECK_OBJ_NOTNULL(l, LINEUP_MAGIC); p = fgets(l->buf + l->bufp, l->bufl - l->bufp, f); if (p == NULL) return (-1); l->bufp = strlen(l->buf); return (LineUpProcess(l)); } int VLU_Data(const void *ptr, int len, struct vlu *l) { const char *p; int i = 0; p = ptr; CHECK_OBJ_NOTNULL(l, LINEUP_MAGIC); if (len < 0) len = strlen(p); while (len > 0) { i = len; if (i > l->bufl - l->bufp) i = l->bufl - l->bufp; memcpy(l->buf + l->bufp, p, i); l->bufp += i; p += i; len -= i; i = LineUpProcess(l); if (i) break; } return (i); } varnish-3.0.5/lib/libvarnish/vct.c0000644000175000017500000001644512247035455014002 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 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. * * ctype(3) like functions, according to RFC2616 */ #include "config.h" #include #include /* 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, [0x22] = VCT_SEPARATOR, [0x28] = VCT_SEPARATOR, [0x29] = VCT_SEPARATOR, [0x2c] = VCT_SEPARATOR, [0x2d] = VCT_XMLNAME, [0x2e] = VCT_XMLNAME, [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, [0x5f] = VCT_XMLNAMESTART, [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, [0x7d] = VCT_SEPARATOR, [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-3.0.5/lib/libvarnish/cli_auth.c0000644000175000017500000000413012247035455014762 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 "vcli.h" #include "libvarnish.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[BUFSIZ]; 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, sizeof buf); if (i > 0) 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-3.0.5/lib/libvarnish/num.c0000644000175000017500000001250112247035455013772 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 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"; const char * str2bytes(const char *p, uintmax_t *r, uintmax_t rel) { double fval; char *end; if (p == NULL || *p == '\0') return (err_miss_num); fval = strtod(p, &end); if (end == p || !isfinite(fval)) return (err_invalid_num); if (*end == '\0') { *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" */ #include "vas.h" #include #include #include 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 }, }; int main(int argc, char *argv[]) { struct test_case *tc; uintmax_t val; int ec; const char *e; (void)argc; for (ec = 0, tc = test_cases; tc->str; ++tc) { e = str2bytes(tc->str, &val, tc->rel); if (e != tc->err) { printf("%s: str2bytes(\"%s\", %ju) (%s) != (%s)\n", *argv, tc->str, tc->rel, tc->err, e); ++ec; } else if (e == NULL && val != tc->val) { printf("%s: str2bytes(\"%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-3.0.5/lib/libvarnish/assert.c0000644000175000017500000000420612247035455014477 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 default backend function for libvarnish' assert facilities. */ #include "config.h" #include #include #include #include "libvarnish.h" static void VAS_Fail_default(const char *func, const char *file, int line, const char *cond, int err, int xxx) { if (xxx) { fprintf(stderr, "Missing errorhandling code in %s(), %s line %d:\n" " Condition(%s) not true.\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 = VAS_Fail_default; varnish-3.0.5/lib/libvarnish/vtmpfile.c0000644000175000017500000000663112247035455015030 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 "libvarnish.h" int seed_random(void) { int fd; unsigned seed; fd = open("/dev/urandom", O_RDONLY); if (fd == -1) { /* urandom not available, fall back to something * weaker */ srandom(time(NULL)); return (0); } if (read(fd, &seed, sizeof seed) != sizeof seed) return (1); (void)close(fd); srandom(seed); return (0); } int vtmpfile(char *template) { char *b, *e, *p; int fd; char ran; for (b = template; *b != '#'; ++b) /* nothing */ ; if (*b == '\0') { errno = EINVAL; return (-1); } for (e = b; *e == '#'; ++e) /* nothing */ ; for (;;) { for (p = b; p < e; ++p) { ran = random() % 63; if (ran < 10) *p = '0' + ran; else if (ran < 36) *p = 'A' + ran - 10; else if (ran < 62) *p = 'a' + ran - 36; else *p = '_'; } fd = open(template, O_RDWR|O_CREAT|O_EXCL, 0600); if (fd >= 0) return (fd); if (errno != EEXIST) return (-1); } /* not reached */ } char * vreadfd(int fd, ssize_t *sz) { struct stat st; char *f; int i; assert(0 == 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); assert(i == st.st_size); f[i] = '\0'; if (sz != NULL) *sz = st.st_size; return (f); } char * vreadfile(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 = vreadfd(fd, sz); err = errno; AZ(close(fd)); errno = err; return (r); } int vnonblocking(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); } varnish-3.0.5/lib/libvarnish/vsb.c0000644000175000017500000003205012247035455013766 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 "libvarnish.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 */ #define VSB_MAGIC 0x4a82dd8a /* * Predicates */ #define VSB_ISDYNAMIC(s) ((s)->s_flags & VSB_DYNAMIC) #define VSB_ISDYNSTRUCT(s) ((s)->s_flags & VSB_DYNSTRUCT) #define VSB_ISFINISHED(s) ((s)->s_flags & VSB_FINISHED) #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, struct vsb *s) { (void)fun; (void)s; KASSERT(s != NULL, ("%s called with a NULL vsb pointer", fun)); KASSERT(s->s_magic == VSB_MAGIC, ("%s called wih an unintialized vsb pointer", fun)); KASSERT(s->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, 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); newbuf = SBMALLOC(newsize); if (newbuf == NULL) return (-1); memcpy(newbuf, s->s_buf, s->s_size); if (VSB_ISDYNAMIC(s)) SBFREE(s->s_buf); else VSB_SETFLAG(s, VSB_DYNAMIC); s->s_buf = newbuf; s->s_size = newsize; return (0); } /* * 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->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; } /* * Set the vsb's end position to an arbitrary value. * Effectively truncates the vsb at the new position. */ int VSB_setpos(struct vsb *s, ssize_t pos) { assert_VSB_integrity(s); assert_VSB_state(s, 0); KASSERT(pos >= 0, ("attempt to seek to a negative position (%jd)", (intmax_t)pos)); KASSERT(pos < s->s_size, ("attempt to seek past end of vsb (%jd >= %jd)", (intmax_t)pos, (intmax_t)s->s_size)); if (pos < 0 || pos > s->s_len) return (-1); s->s_len = pos; return (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; 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, size_t len) { const char *str = buf; const char *end = str + len; assert_VSB_integrity(s); assert_VSB_state(s, 0); if (s->s_error != 0) return (-1); for (; str < end; str++) { VSB_put_byte(s, *str); if (s->s_error != 0) return (-1); } return (0); } /* * Copy a byte string into an vsb. */ int VSB_bcpy(struct vsb *s, const void *buf, size_t len) { assert_VSB_integrity(s); assert_VSB_state(s, 0); VSB_clear(s); return (VSB_bcat(s, buf, len)); } /* * 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); } /* * Copy a string into an vsb. */ int VSB_cpy(struct vsb *s, const char *str) { assert_VSB_integrity(s); assert_VSB_state(s, 0); VSB_clear(s); return (VSB_cat(s, str)); } /* * 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); /* * 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); 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); } /* * Trim whitespace characters from end of an vsb. */ int VSB_trim(struct vsb *s) { assert_VSB_integrity(s); assert_VSB_state(s, 0); if (s->s_error != 0) return (-1); while (s->s_len > 0 && isspace(s->s_buf[s->s_len-1])) --s->s_len; 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(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(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); } /* * Check if an vsb has been finished. */ int VSB_done(const struct vsb *s) { return(VSB_ISFINISHED(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': (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, '"'); } /* * Unquote a string */ const char * VSB_unquote(struct vsb *s, const char *p, int len, int how) { const char *q; char *r; unsigned long u; char c; (void)how; /* For future enhancements */ if (len == -1) len = strlen(p); for (q = p; q < p + len; q++) { if (*q != '\\') { (void)VSB_bcat(s, q, 1); continue; } if (++q >= p + len) return ("Incomplete '\\'-sequence at end of string"); switch(*q) { case 'n': (void)VSB_bcat(s, "\n", 1); continue; case 'r': (void)VSB_bcat(s, "\r", 1); continue; case 't': (void)VSB_bcat(s, "\t", 1); continue; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': errno = 0; u = strtoul(q, &r, 8); if (errno != 0 || (u & ~0xff)) return ("\\ooo sequence out of range"); c = (char)u; (void)VSB_bcat(s, &c, 1); q = r - 1; continue; default: (void)VSB_bcat(s, q, 1); } } return (NULL); } varnish-3.0.5/lib/libvarnish/vsha256.c0000644000175000017500000002223512247035455014376 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" #include #include #ifdef HAVE_ENDIAN_H #include #define VBYTE_ORDER __BYTE_ORDER #define VBIG_ENDIAN __BIG_ENDIAN #endif #ifdef HAVE_SYS_ENDIAN_H #include #define VBYTE_ORDER _BYTE_ORDER #define VBIG_ENDIAN _BIG_ENDIAN #endif #include "libvarnish.h" #include "vsha256.h" #include "vend.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); assert(!memcmp(o, p->output, 32)); } } varnish-3.0.5/lib/libvarnish/vpf.c0000644000175000017500000001271612247035455013776 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 "libvarnish.h" /* XXX: for assert() */ #include "flopen.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-3.0.5/lib/libvarnish/vev.c0000644000175000017500000002604712247035455014005 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 "libvarnish.h" #include "vev.h" #include "miniobj.h" #include "binary_heap.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 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 vev_bh_cmp(void *priv, void *a, void *b) { struct vev_base *evb; 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); assert(es->happened == 0); 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 += TIM_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); assert(sigaction(e->sig, &es->sigact, NULL) == 0); } 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); assert(e->__binheap_idx == 0); 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; assert(sigaction(e->sig, &es->sigact, NULL) == 0); 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 = TIM_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 = TIM_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); } } assert(i == 0); return (1); } varnish-3.0.5/lib/libvmod_std/0000755000175000017500000000000012247037207013252 500000000000000varnish-3.0.5/lib/libvmod_std/Makefile.am0000644000175000017500000000154412247035455015235 00000000000000# INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include dist_man_MANS = vmod_std.3 vmoddir = $(pkglibdir)/vmods vmod_LTLIBRARIES = libvmod_std.la libvmod_std_la_LDFLAGS = -module -export-dynamic -avoid-version libvmod_std_la_SOURCES = \ vcc_if.c \ vcc_if.h \ vmod_std.c \ vmod_std_fileread.c \ vmod_std_conversions.c vcc_if.c vcc_if.h: $(top_srcdir)/lib/libvmod_std/vmod.py $(top_srcdir)/lib/libvmod_std/vmod.vcc @PYTHON@ $(top_srcdir)/lib/libvmod_std/vmod.py $(top_srcdir)/lib/libvmod_std/vmod.vcc EXTRA_DIST = vmod.py vmod.vcc CLEANFILES = $(builddir)/vcc_if.c $(builddir)/vcc_if.h vmod_std.3: $(top_srcdir)/doc/sphinx/reference/vmod_std.rst if HAVE_RST2MAN ${RST2MAN} $? $@ else @echo "========================================" @echo "You need rst2man installed to make dist" @echo "========================================" @false endif varnish-3.0.5/lib/libvmod_std/vmod_std_conversions.c0000644000175000017500000000501712247035455017613 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 #include #include #include "../../bin/varnishd/cache.h" #include "vrt.h" #include "vcc_if.h" double __match_proto__() vmod_duration(struct sess *sp, const char *p, double d) { char *e; double r; (void)sp; if (p == NULL) return (d); while(isspace(*p)) p++; if (*p != '+' && *p != '-' && !isdigit(*p)) return (d); e = NULL; r = strtod(p, &e); if (!isfinite(r)) return (d); if (e == NULL) return (d); while(isspace(*e)) e++; /* NB: Keep this list synchronized with VCC */ switch (*e++) { case 's': break; case 'm': r *= 60.; break; case 'h': r *= 60.*60.; break; case 'd': r *= 60.*60.*24.; break; case 'w': r *= 60.*60.*24.*7.; break; default: return (d); } while(isspace(*e)) e++; if (*e != '\0') return (d); return (r); } int __match_proto__() vmod_integer(struct sess *sp, const char *p, int i) { char *e; int r; (void)sp; 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) return (i); if (*e != '\0') return (i); return (r); } varnish-3.0.5/lib/libvmod_std/vcc_if.h0000644000175000017500000000163012247037201014566 00000000000000/* * NB: This file is machine generated, DO NOT EDIT! * * Edit vmod.vcc and run vmod.py instead */ struct sess; struct VCL_conf; struct vmod_priv; const char * vmod_toupper(struct sess *, struct vmod_priv *, const char *, ...); const char * vmod_tolower(struct sess *, struct vmod_priv *, const char *, ...); void vmod_set_ip_tos(struct sess *, int); double vmod_random(struct sess *, double, double); void vmod_log(struct sess *, const char *, ...); void vmod_syslog(struct sess *, int, const char *, ...); const char * vmod_fileread(struct sess *, struct vmod_priv *, const char *); const char * vmod_author(struct sess *, const char *); double vmod_duration(struct sess *, const char *, double); int vmod_integer(struct sess *, const char *, int); void vmod_collect(struct sess *, enum gethdr_e, const char *); int init_function(struct vmod_priv *, const struct VCL_conf *); extern const void * const Vmod_Id; varnish-3.0.5/lib/libvmod_std/vmod.py0000755000175000017500000001775012247035455014531 00000000000000#!/usr/local/bin/python #- # 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. # # Read the vmod.spec file and produce the vmod.h and vmod.c files. # # vmod.h contains the prototypes for the published functions, the module # C-code should include this file to ensure type-consistency. # # vmod.c contains the symbols which VCC and varnishd will use to access # the module: A structure of properly typed function pointers, the # size of this structure in bytes, and the definition of the structure # as a string, suitable for inclusion in the C-source of the compile VCL # program. import sys import re if len(sys.argv) == 2: specfile = sys.argv[1] else: specfile = "vmod.vcc" ctypes = { 'IP': "struct sockaddr_storage *", 'STRING': "const char *", 'STRING_LIST': "const char *, ...", 'BOOL': "unsigned", 'BACKEND': "struct director *", 'ENUM': "const char *", 'TIME': "double", 'REAL': "double", 'DURATION': "double", 'INT': "int", 'HEADER': "enum gethdr_e, const char *", 'PRIV_VCL': "struct vmod_priv *", 'PRIV_CALL': "struct vmod_priv *", 'VOID': "void", } ####################################################################### initname = "" modname = "???" pstruct = "" pinit = "" tdl = "" plist = "" slist = "" def do_func(fname, rval, args, vargs): global pstruct global pinit global plist global slist global tdl #print(fname, rval, args) # C argument list cargs = "(struct sess *" for i in args: cargs += ", " + i cargs += ")" # Prototypes for vmod implementation and interface typedef proto = ctypes[rval] + " vmod_" + fname + cargs sproto = ctypes[rval] + " td_" + modname + "_" + fname + cargs # append to lists of prototypes plist += proto + ";\n" tdl += "typedef " + sproto + ";\n" # Append to struct members pstruct += "\ttd_" + modname + "_" + fname + "\t*" + fname + ";\n" # Append to struct initializer pinit += "\tvmod_" + fname + ",\n" # Compose the vmod spec-string s = modname + '.' + fname + "\\0" s += "Vmod_Func_" + modname + "." + fname + "\\0" s += rval + '\\0' for i in vargs: s += i + '\\0' slist += '\t"' + s + '",\n' ####################################################################### def partition(string, separator): if (hasattr(string,"partition")): return string.partition(separator) i = string.find(separator) if i >= 0: return (string[:i],separator,string[i+len(separator):]) return (string, '', '') ####################################################################### def is_c_name(s): return None != re.match("^[a-z][a-z0-9_]*$", s) ####################################################################### def parse_enum(tq): assert tq[0] == '{' assert tq[-1] == '}' f = tq[1:-1].split(',') s="ENUM\\0" b=dict() for i in f: i = i.strip() if not is_c_name(i): raise Exception("Enum value '%s' is illegal" % i) if i in b: raise Exception("Duplicate Enum value '%s'" % i) b[i] = True s = s + i.strip() + '\\0' return s ####################################################################### f = open(specfile, "r") def nextline(): while True: l0 = f.readline() if l0 == "": return l0 l0 = re.sub("#.*$", "", l0) l0 = re.sub("\s\s*", " ", l0.strip()) if l0 != "": return l0 while True: l0 = nextline() if l0 == "": break; l = partition(l0, " ") if l[0] == "Module": modname = l[2].strip(); if not is_c_name(modname): raise Exception("Module name '%s' is illegal" % modname) continue if l[0] == "Init": initname = l[2].strip(); if not is_c_name(initname): raise Exception("Init name '%s' is illegal" % initname) continue if l[0] != "Function": raise Exception("Expected 'Function' line, got '%s'" % l[0]) # Find the return type of the function l = partition(l[2].strip(), " ") rt_type = l[0] if rt_type not in ctypes: raise Exception("Return type '%s' not a valid type" % rt_type) # Find the function name l = partition(l[2].strip(), "(") fname = l[0].strip() if not is_c_name(fname): raise Exception("Function name '%s' is illegal" % fname) if l[1] != '(': raise Exception("Missing '('") l = l[2] while -1 == l.find(")"): l1 = nextline() if l1 == "": raise Exception("End Of Input looking for ')'") l = l + l1 if -1 != l.find("("): raise Exception("Nesting trouble with '(...)' ") if l[-1:] != ')': raise Exception("Junk after ')'") l = l[:-1] args = list() vargs = list() for i in re.finditer("([A-Z_]+)\s*({[^}]+})?(,|$)", l): at = i.group(1) tq = i.group(2) if at not in ctypes: raise Exception( "Argument type '%s' not a valid type" % at) args.append(ctypes[at]) if at == "ENUM": if tq == None: raise Exception( "Argument type '%s' needs qualifier {...}" % at) at=parse_enum(tq) elif tq != None: raise Exception( "Argument type '%s' cannot be qualified with {...}" % at) vargs.append(at) do_func(fname, rt_type, args, vargs) ####################################################################### def dumps(s): while True: l = partition(s, "\n") if len(l[0]) == 0: break fc.write('\t"' + l[0] + '\\n"\n') s = l[2] ####################################################################### if initname != "": plist += "int " + initname + "(struct vmod_priv *, const struct VCL_conf *);\n" pstruct += "\tvmod_init_f\t*_init;\n" pinit += "\t" + initname + ",\n" slist += '\t"INIT\\0Vmod_Func_' + modname + '._init",\n' ####################################################################### def file_header(fo): fo.write("""/* * NB: This file is machine generated, DO NOT EDIT! * * Edit vmod.vcc and run vmod.py instead */ """) ####################################################################### fc = open("vcc_if.c", "w") fh = open("vcc_if.h", "w") file_header(fc) file_header(fh) fh.write('struct sess;\n') fh.write('struct VCL_conf;\n') fh.write('struct vmod_priv;\n') fh.write("\n"); fh.write(plist) fc.write('#include "vrt.h"\n') fc.write('#include "vcc_if.h"\n') fc.write('#include "vmod_abi.h"\n') fc.write("\n"); fc.write("\n"); fc.write(tdl); fc.write("\n"); fc.write('const char Vmod_Name[] = "' + modname + '";\n') fc.write("const struct Vmod_Func_" + modname + " {\n") fc.write(pstruct + "} Vmod_Func = {\n" + pinit + "};\n") fc.write("\n"); fc.write("const int Vmod_Len = sizeof(Vmod_Func);\n") fc.write("\n"); fc.write('const char Vmod_Proto[] =\n') dumps(tdl); fc.write('\t"\\n"\n') dumps("struct Vmod_Func_" + modname + " {\n") dumps(pstruct + "} Vmod_Func_" + modname + ";\n") fc.write('\t;\n') fc.write("\n"); fc.write('const char * const Vmod_Spec[] = {\n' + slist + '\t0\n};\n') fc.write('const char Vmod_Varnish_ABI[] = VMOD_ABI_Version;\n') fh.write('extern const void * const Vmod_Id;\n') fc.write('const void * const Vmod_Id = &Vmod_Id;\n') fc.write("\n") varnish-3.0.5/lib/libvmod_std/vmod_std_fileread.c0000644000175000017500000000703312247035455017016 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 #include "vrt.h" #include "../../bin/varnishd/cache.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); } } const char * vmod_fileread(struct sess *sp, struct vmod_priv *priv, const char *file_name) { struct frfile *frf; char *s; (void)sp; AN(priv); if (priv->priv != NULL) { CAST_OBJ_NOTNULL(frf, priv->priv, CACHED_FILE_MAGIC); return (frf->contents); } AZ(pthread_mutex_lock(&frmtx)); 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 = vreadfile(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-3.0.5/lib/libvmod_std/vmod.vcc0000644000175000017500000000350212247035455014637 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. Module std Init init_function Function STRING toupper(PRIV_CALL, STRING_LIST) Function STRING tolower(PRIV_VCL, STRING_LIST) Function VOID set_ip_tos(INT) Function REAL random(REAL, REAL) Function VOID log(STRING_LIST) Function VOID syslog(INT, STRING_LIST) Function STRING fileread(PRIV_CALL, STRING) Function STRING author(ENUM { phk, des, kristian, mithrandir }) Function DURATION duration(STRING, DURATION) Function INT integer(STRING, INT) Function VOID collect(HEADER) varnish-3.0.5/lib/libvmod_std/vcc_if.c0000644000175000017500000000717312247037201014571 00000000000000/* * NB: This file is machine generated, DO NOT EDIT! * * Edit vmod.vcc and run vmod.py instead */ #include "vrt.h" #include "vcc_if.h" #include "vmod_abi.h" typedef const char * td_std_toupper(struct sess *, struct vmod_priv *, const char *, ...); typedef const char * td_std_tolower(struct sess *, struct vmod_priv *, const char *, ...); typedef void td_std_set_ip_tos(struct sess *, int); typedef double td_std_random(struct sess *, double, double); typedef void td_std_log(struct sess *, const char *, ...); typedef void td_std_syslog(struct sess *, int, const char *, ...); typedef const char * td_std_fileread(struct sess *, struct vmod_priv *, const char *); typedef const char * td_std_author(struct sess *, const char *); typedef double td_std_duration(struct sess *, const char *, double); typedef int td_std_integer(struct sess *, const char *, int); typedef void td_std_collect(struct sess *, enum gethdr_e, const char *); const char Vmod_Name[] = "std"; const struct Vmod_Func_std { td_std_toupper *toupper; td_std_tolower *tolower; td_std_set_ip_tos *set_ip_tos; td_std_random *random; td_std_log *log; td_std_syslog *syslog; td_std_fileread *fileread; td_std_author *author; td_std_duration *duration; td_std_integer *integer; td_std_collect *collect; vmod_init_f *_init; } Vmod_Func = { vmod_toupper, vmod_tolower, vmod_set_ip_tos, vmod_random, vmod_log, vmod_syslog, vmod_fileread, vmod_author, vmod_duration, vmod_integer, vmod_collect, init_function, }; const int Vmod_Len = sizeof(Vmod_Func); const char Vmod_Proto[] = "typedef const char * td_std_toupper(struct sess *, struct vmod_priv *, const char *, ...);\n" "typedef const char * td_std_tolower(struct sess *, struct vmod_priv *, const char *, ...);\n" "typedef void td_std_set_ip_tos(struct sess *, int);\n" "typedef double td_std_random(struct sess *, double, double);\n" "typedef void td_std_log(struct sess *, const char *, ...);\n" "typedef void td_std_syslog(struct sess *, int, const char *, ...);\n" "typedef const char * td_std_fileread(struct sess *, struct vmod_priv *, const char *);\n" "typedef const char * td_std_author(struct sess *, const char *);\n" "typedef double td_std_duration(struct sess *, const char *, double);\n" "typedef int td_std_integer(struct sess *, const char *, int);\n" "typedef void td_std_collect(struct sess *, enum gethdr_e, const char *);\n" "\n" "struct Vmod_Func_std {\n" " td_std_toupper *toupper;\n" " td_std_tolower *tolower;\n" " td_std_set_ip_tos *set_ip_tos;\n" " td_std_random *random;\n" " td_std_log *log;\n" " td_std_syslog *syslog;\n" " td_std_fileread *fileread;\n" " td_std_author *author;\n" " td_std_duration *duration;\n" " td_std_integer *integer;\n" " td_std_collect *collect;\n" " vmod_init_f *_init;\n" "} Vmod_Func_std;\n" ; const char * const Vmod_Spec[] = { "std.toupper\0Vmod_Func_std.toupper\0STRING\0PRIV_CALL\0STRING_LIST\0", "std.tolower\0Vmod_Func_std.tolower\0STRING\0PRIV_VCL\0STRING_LIST\0", "std.set_ip_tos\0Vmod_Func_std.set_ip_tos\0VOID\0INT\0", "std.random\0Vmod_Func_std.random\0REAL\0REAL\0REAL\0", "std.log\0Vmod_Func_std.log\0VOID\0STRING_LIST\0", "std.syslog\0Vmod_Func_std.syslog\0VOID\0INT\0STRING_LIST\0", "std.fileread\0Vmod_Func_std.fileread\0STRING\0PRIV_CALL\0STRING\0", "std.author\0Vmod_Func_std.author\0STRING\0ENUM\0phk\0des\0kristian\0mithrandir\0\0", "std.duration\0Vmod_Func_std.duration\0DURATION\0STRING\0DURATION\0", "std.integer\0Vmod_Func_std.integer\0INT\0STRING\0INT\0", "std.collect\0Vmod_Func_std.collect\0VOID\0HEADER\0", "INIT\0Vmod_Func_std._init", 0 }; const char Vmod_Varnish_ABI[] = VMOD_ABI_Version; const void * const Vmod_Id = &Vmod_Id; varnish-3.0.5/lib/libvmod_std/Makefile.in0000644000175000017500000005662412247037163015255 00000000000000# Makefile.in generated by automake 1.14 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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.in $(srcdir)/Makefile.am \ $(top_srcdir)/depcomp $(dist_man_MANS) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.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)" "$(DESTDIR)$(man3dir)" LTLIBRARIES = $(vmod_LTLIBRARIES) libvmod_std_la_LIBADD = am_libvmod_std_la_OBJECTS = vcc_if.lo vmod_std.lo vmod_std_fileread.lo \ vmod_std_conversions.lo libvmod_std_la_OBJECTS = $(am_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 am__v_lt_1 = 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 \ $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : 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_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/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_CC_1 = 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_CCLD_1 = SOURCES = $(libvmod_std_la_SOURCES) DIST_SOURCES = $(libvmod_std_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac man3dir = $(mandir)/man3 NROFF = nroff MANS = $(dist_man_MANS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIBS = @CURSES_LIBS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ 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@ JEMALLOC_SUBDIR = @JEMALLOC_SUBDIR@ 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@ 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@ XSLTPROC = @XSLTPROC@ 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@ INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include dist_man_MANS = vmod_std.3 vmoddir = $(pkglibdir)/vmods vmod_LTLIBRARIES = libvmod_std.la libvmod_std_la_LDFLAGS = -module -export-dynamic -avoid-version libvmod_std_la_SOURCES = \ vcc_if.c \ vcc_if.h \ vmod_std.c \ vmod_std_fileread.c \ vmod_std_conversions.c EXTRA_DIST = vmod.py vmod.vcc CLEANFILES = $(builddir)/vcc_if.c $(builddir)/vcc_if.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(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: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-vmodLTLIBRARIES: $(vmod_LTLIBRARIES) @$(NORMAL_INSTALL) @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 " $(MKDIR_P) '$(DESTDIR)$(vmoddir)'"; \ $(MKDIR_P) "$(DESTDIR)$(vmoddir)" || exit 1; \ 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)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } 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@ .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 -o $@ $< .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 -o $@ `$(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 install-man3: $(dist_man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(dist_man_MANS)'; \ test -n "$(man3dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man3dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man3dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.3[a-z]*$$/p'; \ fi; \ } | 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) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ 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-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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) $(MANS) installdirs: for dir in "$(DESTDIR)$(vmoddir)" "$(DESTDIR)$(man3dir)"; 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-man 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-man3 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-man uninstall-vmodLTLIBRARIES uninstall-man: uninstall-man3 .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-vmodLTLIBRARIES cscopelist-am ctags \ ctags-am 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-man3 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 tags-am uninstall \ uninstall-am uninstall-man uninstall-man3 \ uninstall-vmodLTLIBRARIES vcc_if.c vcc_if.h: $(top_srcdir)/lib/libvmod_std/vmod.py $(top_srcdir)/lib/libvmod_std/vmod.vcc @PYTHON@ $(top_srcdir)/lib/libvmod_std/vmod.py $(top_srcdir)/lib/libvmod_std/vmod.vcc vmod_std.3: $(top_srcdir)/doc/sphinx/reference/vmod_std.rst @HAVE_RST2MAN_TRUE@ ${RST2MAN} $? $@ @HAVE_RST2MAN_FALSE@ @echo "========================================" @HAVE_RST2MAN_FALSE@ @echo "You need rst2man installed to make dist" @HAVE_RST2MAN_FALSE@ @echo "========================================" @HAVE_RST2MAN_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-3.0.5/lib/libvmod_std/vmod_std.30000644000175000017500000001055512247036204015077 00000000000000.\" Man page generated from reStructuredText. . .TH VMOD_STD 3 "2011-05-19" "1.0" "" .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 .. .SH SYNOPSIS .sp import std .SH DESCRIPTION .sp The Varnish standard module contains useful, generic function that don\(aqt quite fit in the VCL core, but are still considered very useful to a broad audience. .SH FUNCTIONS .SS toupper .INDENT 0.0 .TP .B Prototype toupper(STRING s) .TP .B Return value String .TP .B Description Converts the string \fIs\fP to upper case. .TP .B Example set beresp.http.x\-scream = std.toupper("yes!"); .UNINDENT .SS tolower .INDENT 0.0 .TP .B Prototype tolower(STRING s) .TP .B Return value String .TP .B Description Converts the string \fIs\fP to lower case. .TP .B Example set beresp.http.x\-nice = std.tolower("VerY"); .UNINDENT .SS set_ip_tos .INDENT 0.0 .TP .B Prototype set_ip_tos(INT i) .TP .B Return value Void .TP .B Description Sets the Type\-of\-Service flag for the current session. Please note that the TOS flag 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(0x0); .in -2 } .fi .sp .UNINDENT .SS random .INDENT 0.0 .TP .B Prototype random(REAL a, REAL b) .TP .B Return value Real .TP .B Description Returns a random REAL number between \fIa\fP and \fIb\fP\&. .TP .B Example set beresp.http.x\-random\-number = std.random(1, 100); .UNINDENT .SS log .INDENT 0.0 .TP .B Prototype log(STRING string) .TP .B Return value Void .TP .B Description Logs \fIstring\fP to the shared memory log. .TP .B Example std.log("Something fishy is going on with the vhost " + req.host); .UNINDENT .SS syslog .INDENT 0.0 .TP .B Prototype syslog(INT priority, STRING string) .TP .B Return value Void .TP .B Description Logs \fIstring\fP to syslog marked with \fIpriority\fP\&. .TP .B Example std.syslog( LOG_USER|LOG_ALERT, "There is serious troble"); .UNINDENT .SS fileread .INDENT 0.0 .TP .B Prototype fileread(STRING filename) .TP .B Return value 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.x\-served\-by = std.fileread("/etc/hostname"); .UNINDENT .SS duration .INDENT 0.0 .TP .B Prototype duration(STRING s, DURATION fallback) .TP .B Return value Duration .TP .B Description Converts the string \fIs\fP to seconds. \fIs\fP can be quantified with the usual s (seconds), m (minutes), h (hours), d (days) and w (weeks) units. If \fIs\fP fails to parse, \fIfallback\fP will be used. .TP .B Example set beresp.ttl = std.duration("1w", 3600s); .UNINDENT .SS integer .INDENT 0.0 .TP .B Prototype integer(STRING s, INT fallback) .TP .B Return value Int .TP .B Description Converts the string \fIs\fP to an integer. If \fIs\fP fails to parse, \fIfallback\fP will be used .TP .B Example if (std.integer(beresp.http.x\-foo, 0) > 5) { ... } .UNINDENT .SS collect .INDENT 0.0 .TP .B Prototype collect(HEADER header) .TP .B Return value Void .TP .B Description Collapses the header, joining the headers into one. .TP .B Example std.collect(req.http.cookie); This will collapse several Cookie: headers into one, long cookie header. .UNINDENT .SH SEE ALSO .INDENT 0.0 .IP \(bu 2 vcl(7) .IP \(bu 2 varnishd(1) .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) 2011 Varnish Software .UNINDENT .SH AUTHOR Per Buer .\" Generated by docutils manpage writer. . varnish-3.0.5/lib/libvmod_std/vmod_std.c0000644000175000017500000001047612247035455015170 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 #include #include #include #include #include "vrt.h" #include "../../bin/varnishd/cache.h" #include "vcc_if.h" void __match_proto__() vmod_set_ip_tos(struct sess *sp, int tos) { VTCP_Assert(setsockopt(sp->fd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos))); } static const char * __match_proto__() vmod_updown(struct sess *sp, int up, const char *s, va_list ap) { unsigned u; char *b, *e; const char *p; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); u = WS_Reserve(sp->wrk->ws, 0); e = b = sp->wrk->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(sp->wrk->ws, 0); return (NULL); } else { e = b; b = sp->wrk->ws->f; WS_Release(sp->wrk->ws, e - b); return (b); } } const char * __match_proto__() vmod_toupper(struct sess *sp, struct vmod_priv *priv, const char *s, ...) { const char *p; va_list ap; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); if (priv->priv == NULL) { priv->priv = strdup("BAR"); priv->free = free; } else { assert(!strcmp(priv->priv, "BAR")); } va_start(ap, s); p = vmod_updown(sp, 1, s, ap); va_end(ap); return (p); } const char * __match_proto__() vmod_tolower(struct sess *sp, struct vmod_priv *priv, const char *s, ...) { const char *p; va_list ap; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); assert(!strcmp(priv->priv, "FOO")); va_start(ap, s); p = vmod_updown(sp, 0, s, ap); va_end(ap); return (p); } int init_function(struct vmod_priv *priv, const struct VCL_conf *cfg) { (void)cfg; priv->priv = strdup("FOO"); priv->free = free; return (0); } double vmod_random(struct sess *sp, double lo, double hi) { double a; (void)sp; a = drand48(); a *= hi - lo; a += lo; return (a); } void __match_proto__() vmod_log(struct sess *sp, const char *fmt, ...) { char buf[8192], *p; va_list ap; va_start(ap, fmt); p = VRT_StringList(buf, sizeof buf, fmt, ap); va_end(ap); if (p != NULL) WSP(sp, SLT_VCL_Log, "%s", buf); } void vmod_syslog(struct sess *sp, int fac, const char *fmt, ...) { char buf[8192], *p; va_list ap; (void)sp; va_start(ap, fmt); p = VRT_StringList(buf, sizeof buf, fmt, ap); va_end(ap); if (p != NULL) syslog(fac, "%s", buf); } const char * __match_proto__() vmod_author(struct sess *sp, const char *id) { (void)sp; 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"); } void __match_proto__() vmod_collect(struct sess *sp, enum gethdr_e e, const char *h) { (void)e; (void)sp; (void)h; if (e == HDR_REQ) http_CollectHdr(sp->http, h); else if (e == HDR_BERESP) http_CollectHdr(sp->wrk->beresp, h); } varnish-3.0.5/lib/Makefile.in0000644000175000017500000004547412247037162012747 00000000000000# Makefile.in generated by automake 1.14 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.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_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : 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_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` 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@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIBS = @CURSES_LIBS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ 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@ JEMALLOC_SUBDIR = @JEMALLOC_SUBDIR@ 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@ 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@ XSLTPROC = @XSLTPROC@ 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 \ libvcl \ libvgz \ libvmod_std \ @JEMALLOC_SUBDIR@ DIST_SUBDIRS = \ libvarnishcompat \ libvarnish \ libvarnishapi \ libvcl \ libvgz \ libvmod_std \ libjemalloc all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(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: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ 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: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-libtool cscopelist-am ctags \ ctags-am 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-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-3.0.5/lib/libvgz/0000755000175000017500000000000012247037207012241 500000000000000varnish-3.0.5/lib/libvgz/inffast.c0000644000175000017500000003207712247035455013773 00000000000000/* inffast.c -- fast decoding * Copyright (C) 1995-2008, 2010 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; unsigned char FAR *in; /* local strm->next_in */ unsigned char FAR *last; /* while in < last, enough input available */ 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-3.0.5/lib/libvgz/Makefile.am0000644000175000017500000000064012247035455014220 00000000000000# pkglib_LTLIBRARIES = libvgz.la libvgz_la_LDFLAGS = -avoid-version libvgz_la_CFLAGS = -D_LARGEFILE64_SOURCE=1 $(libvgz_extra_cflags) libvgz_la_SOURCES = \ adler32.c \ compress.c \ crc32.c \ crc32.h \ deflate.c \ deflate.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-3.0.5/lib/libvgz/inffixed.h0000644000175000017500000001430712247035455014136 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 the compression 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-3.0.5/lib/libvgz/inffast.h0000644000175000017500000000065312234401732013762 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-3.0.5/lib/libvgz/inflate.c0000644000175000017500000014710412247035455013761 00000000000000/* inflate.c -- zlib decompression * Copyright (C) 1995-2010 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, unsigned out)); #ifdef BUILDFIXED void makefixed OF((void)); #endif local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf, unsigned len)); 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; strm->total_in = strm->total_out = state->total = 0; strm->start_bit = strm->stop_bit = strm->last_bit = 0; strm->msg = Z_NULL; strm->adler = 1; /* to support ill-conceived Java test suite */ state->mode = HEAD; state->last = 0; state->havedict = 0; state->dmax = 32768U; state->head = Z_NULL; state->wsize = 0; state->whave = 0; state->wnext = 0; 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 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) { strm->zalloc = zcalloc; strm->opaque = (voidpf)0; } if (strm->zfree == (free_func)0) strm->zfree = zcfree; 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}", 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, out) z_streamp strm; unsigned out; { struct inflate_state FAR *state; unsigned copy, 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 */ copy = out - strm->avail_out; if (copy >= state->wsize) { zmemcpy(state->window, strm->next_out - 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, strm->next_out - copy, dist); copy -= dist; if (copy) { zmemcpy(state->window, strm->next_out - 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) /* Reverse the bytes in a 32-bit value */ #define REVERSE(q) \ ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) /* 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; 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 = REVERSE(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 = (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")); 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) { NEEDBITS(here.bits); 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 = (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_; 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 REVERSE(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 || (state->mode < CHECK && out != strm->avail_out)) if (updatewindow(strm, 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 inflateSetDictionary(strm, dictionary, dictLength) z_streamp strm; const Bytef *dictionary; uInt dictLength; { struct inflate_state FAR *state; unsigned long id; /* 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 id */ if (state->mode == DICT) { id = adler32(0L, Z_NULL, 0); id = adler32(id, dictionary, dictLength); if (id != state->check) return Z_DATA_ERROR; } /* copy dictionary to window */ if (updatewindow(strm, strm->avail_out)) { state->mode = MEM; return Z_MEM_ERROR; } if (dictLength > state->wsize) { zmemcpy(state->window, dictionary + dictLength - state->wsize, state->wsize); state->whave = state->wsize; } else { zmemcpy(state->window + state->wsize - dictLength, dictionary, dictLength); state->whave = dictLength; } 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; 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(dest, source, sizeof(z_stream)); zmemcpy(copy, 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-3.0.5/lib/libvgz/README0000644000175000017500000000070512247035455013046 00000000000000This is a modified version of the ZLIB 1.2.5 data compression library. For the original and complete version of the library please visit: http://www.zlib.net/ For copyright and licensing information, please see the zlib.h file. Modifications include: * Unnecessary files not imported. * Extension to inflate() to record the bit positions of: A) The first deflate block B) The 'last' bit C) The first (padding) bit after the last deflate block varnish-3.0.5/lib/libvgz/zutil.h0000644000175000017500000001575112247035455013515 00000000000000/* zutil.h -- internal interface and configuration of the compression library * Copyright (C) 1995-2010 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 #if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ) # define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) #else # define ZLIB_INTERNAL #endif #include "vgz.h" #ifdef STDC # if !(defined(_WIN32_WCE) && defined(_MSC_VER)) # include # endif # include # include #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 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 # 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 #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 # ifdef M_I86 # include # endif #endif #if defined(MACOS) || defined(TARGET_OS_MAC) # define OS_CODE 0x07 # 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 #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__) #pragma warn -8004 #pragma warn -8008 #pragma warn -8066 #endif /* provide prototypes for these when building zlib without LFS */ #if !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(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) # ifndef HAVE_VSNPRINTF # define HAVE_VSNPRINTF # endif #endif #if defined(__CYGWIN__) # 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 #endif #ifdef VMS # define NO_vsnprintf #endif #if defined(pyr) # 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 voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items, unsigned size)); void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr)); #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);} #endif /* ZUTIL_H */ varnish-3.0.5/lib/libvgz/trees.c0000644000175000017500000013062512247035455013461 00000000000000/* trees.c -- output deflated data using Huffman coding * Copyright (C) 1995-2010 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. */ #define Buf_size (8 * 2*sizeof(char)) /* Number of bits used within bi_buf. (bi_buf might be implemented on * more than 16 bits on some systems.) */ /* =========================================================================== * 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, ct_data *ltree, 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; s->last_eob_len = 8; /* enough lookahead for inflate */ #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 */ } /* =========================================================================== * Send one empty static block to give enough lookahead for inflate. * This takes 10 bits, of which 7 may remain in the bit buffer. * The current inflate code requires 9 bits of lookahead. If the * last two codes for the previous block (real code plus EOB) were coded * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode * the last real code. In this case we send two empty static blocks instead * of one. (There are no problems if the previous block is stored or fixed.) * To simplify the code, we assume the worst case of last real code encoded * on one bit only. */ 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); /* Of the 10 bits for the empty block, we have already sent * (10 - bi_valid) bits. The lookahead for the last real code (before * the EOB of the previous block) was thus at least one plus the length * of the EOB plus what we have just sent of the empty static block. */ if (1 + s->last_eob_len + 10 - s->bi_valid < 9) { send_bits(s, STATIC_TREES<<1, 3); send_code(s, END_BLOCK, static_ltree); #ifdef DEBUG s->compressed_len += 10L; #endif bi_flush(s); } s->last_eob_len = 7; } /* =========================================================================== * 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, (ct_data *)(uintptr_t)static_ltree, (ct_data *)(uintptr_t)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, (ct_data *)s->dyn_ltree, (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; ct_data *ltree; /* literal tree */ 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); s->last_eob_len = ltree[END_BLOCK].Len; } /* =========================================================================== * 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 */ s->last_eob_len = 8; /* enough lookahead for inflate */ 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-3.0.5/lib/libvgz/deflate.h0000644000175000017500000003060012247035455013740 00000000000000/* deflate.h -- internal compression state * Copyright (C) 1995-2010 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 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; /* STORED (for zip only) or 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 supress 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 */ int last_eob_len; /* bit length of EOB code for last block */ #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_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-3.0.5/lib/libvgz/compress.c0000644000175000017500000000474212247035455014172 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 = (Bytef*)(uintptr_t)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-3.0.5/lib/libvgz/zutil.c0000644000175000017500000001622112247035455013501 00000000000000/* zutil.c -- target dependent utility functions for the compression library * Copyright (C) 1995-2005, 2010 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ #include "zutil.h" #ifndef NO_DUMMY_DECL struct internal_state {int dummy;}; /* for buggy compilers */ #endif 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 #ifdef STDC # 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 #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 */ varnish-3.0.5/lib/libvgz/crc32.c0000644000175000017500000003256112247035455013253 00000000000000/* crc32.c -- compute the CRC-32 of a data stream * Copyright (C) 1995-2006, 2010 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(). */ #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 /* Find a four-byte integer type for crc32_little() and crc32_big(). */ #ifndef NOBYFOUR # ifdef STDC /* need ANSI C limits.h to determine sizes */ # include # define BYFOUR # if (UINT_MAX == 0xffffffffUL) typedef unsigned int u4; # else # if (ULONG_MAX == 0xffffffffUL) typedef unsigned long u4; # else # if (USHRT_MAX == 0xffffffffUL) typedef unsigned short u4; # else # undef BYFOUR /* can't find a four-byte integer type! */ # endif # endif # endif # endif /* STDC */ #endif /* !NOBYFOUR */ /* Definitions for doing the crc four data bytes at a time. */ #ifdef BYFOUR # define REV(w) ((((w)>>24)&0xff)+(((w)>>8)&0xff00)+ \ (((w)&0xff00)<<8)+(((w)&0xff)<<24)) 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_(uLong crc1, uLong crc2, z_off64_t len2); #ifdef DYNAMIC_CRC_TABLE local volatile int crc_table_empty = 1; local unsigned long FAR crc_table[TBLS][256]; local void make_crc_table OF((void)); #ifdef MAKECRCH local void write_table OF((FILE *, const unsigned long 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() { unsigned long c; int n, k; unsigned long 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 = 0UL; for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++) poly |= 1UL << (31 - p[n]); /* generate a crc for every 8-bit value */ for (n = 0; n < 256; n++) { c = (unsigned long)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] = REV(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] = REV(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 unsigned long 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 unsigned long FAR *table; { int n; for (n = 0; n < 256; n++) fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", 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 unsigned long FAR * ZEXPORT get_crc_table() { #ifdef DYNAMIC_CRC_TABLE if (crc_table_empty) make_crc_table(); #endif /* DYNAMIC_CRC_TABLE */ return (const unsigned long 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)) { u4 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 u4 c; register const u4 FAR *buf4; c = (u4)crc; c = ~c; while (len && ((ptrdiff_t)buf & 3)) { c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); len--; } buf4 = (const u4 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 u4 c; register const u4 FAR *buf4; c = REV((u4)crc); c = ~c; while (len && ((ptrdiff_t)buf & 3)) { c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); len--; } buf4 = (const u4 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)(REV(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-3.0.5/lib/libvgz/inflate.h0000644000175000017500000001437712234401732013762 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-3.0.5/lib/libvgz/infback.c0000644000175000017500000005377612247035455013747 00000000000000/* infback.c -- inflate using a call-back interface * Copyright (C) 1995-2009 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) { strm->zalloc = zcalloc; strm->opaque = (voidpf)0; } if (strm->zfree == (free_func)0) strm->zfree = zcfree; 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; 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) { NEEDBITS(here.bits); 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-3.0.5/lib/libvgz/vgz.h0000644000175000017500000023357312247035455013160 00000000000000/* zlib.h -- interface of the 'zlib' general purpose compression library version 1.2.5, April 19th, 2010 Copyright (C) 1995-2010 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://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). */ #ifndef ZLIB_H #define ZLIB_H #include "zconf.h" #ifdef __cplusplus extern "C" { #endif #define ZLIB_VERSION "1.2.5" #define ZLIB_VERNUM 0x1250 #define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MINOR 2 #define ZLIB_VER_REVISION 5 #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 { Bytef *next_in; /* next input byte */ uInt avail_in; /* number of bytes available at next_in */ uLong total_in; /* total nb 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 nb of bytes output so far */ 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). If deflate does not return Z_STREAM_END, then 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 the uncompressed data. (The size of the uncompressed data may have been saved by the compressor for this purpose.) The next operation on this stream must be inflateEnd to deallocate the decompression state. The use of Z_FINISH is never required, but can be used to inform inflate that a faster approach may be used for the single inflate() call. 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 only effect of the flush parameter in this implementation is on the return value of inflate(), as noted below, or when it returns early because Z_BLOCK or Z_TREES is used. If a preset dictionary is needed after this call (see inflateSetDictionary below), inflate sets strm->adler to the adler32 checksum of the dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise it sets strm->adler to the adler32 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. 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. This function must be called immediately after deflateInit, deflateInit2 or deflateReset, before any call of deflate. 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 the compression method is bsort). 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(). */ 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, 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 immediately after inflateInit2() or inflateReset() and before any call of inflate() to set the dictionary. 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 inflateSync OF((z_streamp strm)); /* Skips invalid compressed data until a full flush point (see above the description of deflate with Z_FULL_FLUSH) can be found, or until all available input is skipped. No output is provided. inflateSync returns Z_OK if a 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 paramaters 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 *, 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 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. This function 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) */ /* 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. */ /* 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 voidp gzFile; /* 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.) Also "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. 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. 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. 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 was not in gzip format, gzread copies the given number of bytes into the buffer. After reaching the end of a gzip stream in the input, gzread will continue to read, looking for another gzip stream, or failing that, reading the rest of the input file directly without decompression. The entire input file will be read if gzread is called until it returns less than the requested len. 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 OF((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. */ 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. This state can change from false to true while reading the input file if the end of a gzip stream is reached, but is followed by data that is not another gzip stream. 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(). */ 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, 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. */ /* 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. */ 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 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, sizeof(z_stream)) #define inflateInit(strm) \ inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ (strategy), ZLIB_VERSION, sizeof(z_stream)) #define inflateInit2(strm, windowBits) \ inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) #define inflateBackInit(strm, windowBits, window) \ inflateBackInit_((strm), (windowBits), (window), \ ZLIB_VERSION, sizeof(z_stream)) /* 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 */ #if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-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)); 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) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0 # define gzopen gzopen64 # define gzseek gzseek64 # define gztell gztell64 # define gzoffset gzoffset64 # define adler32_combine adler32_combine64 # define crc32_combine crc32_combine64 # ifdef _LARGEFILE64_SOURCExxx 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 /* 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 uLongf * ZEXPORT get_crc_table OF((void)); ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); #ifdef __cplusplus } #endif #endif /* ZLIB_H */ varnish-3.0.5/lib/libvgz/Makefile.in0000644000175000017500000010122112247037163014224 00000000000000# Makefile.in generated by automake 1.14 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/depcomp README ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.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 am__v_lt_1 = libvgz_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libvgz_la_CFLAGS) \ $(CFLAGS) $(libvgz_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : 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_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/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_CC_1 = 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_CCLD_1 = SOURCES = $(libvgz_la_SOURCES) DIST_SOURCES = $(libvgz_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIBS = @CURSES_LIBS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ 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@ JEMALLOC_SUBDIR = @JEMALLOC_SUBDIR@ 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@ 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@ XSLTPROC = @XSLTPROC@ 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@ pkglib_LTLIBRARIES = libvgz.la libvgz_la_LDFLAGS = -avoid-version libvgz_la_CFLAGS = -D_LARGEFILE64_SOURCE=1 $(libvgz_extra_cflags) libvgz_la_SOURCES = \ adler32.c \ compress.c \ crc32.c \ crc32.h \ deflate.c \ deflate.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: $(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: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) @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 " $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" || exit 1; \ 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)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } 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 -o $@ $< .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 -o $@ `$(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: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ 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-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES cscopelist-am ctags \ ctags-am 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 tags-am 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-3.0.5/lib/libvgz/deflate.c0000644000175000017500000020506012247035455013737 00000000000000/* deflate.c -- compress data using the deflation algorithm * Copyright (C) 1995-2010 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://www.ietf.org/rfc/rfc1951.txt * * 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" const char deflate_copyright[] = " deflate 1.2.5 Copyright 1995-2010 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 /* =========================================================================== * 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) { strm->zalloc = zcalloc; strm->opaque = (voidpf)0; } if (strm->zfree == (free_func)0) strm->zfree = zcfree; #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 length = dictLength; uInt n; IPos hash_head = 0; if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL || strm->state->wrap == 2 || (strm->state->wrap == 1 && strm->state->status != INIT_STATE)) return Z_STREAM_ERROR; s = strm->state; if (s->wrap) strm->adler = adler32(strm->adler, dictionary, dictLength); if (length < MIN_MATCH) return Z_OK; if (length > s->w_size) { length = s->w_size; dictionary += dictLength - length; /* use the tail of the dictionary */ } zmemcpy(s->window, dictionary, length); s->strstart = length; s->block_start = (long)length; /* Insert all strings in the hash table (except for the last two bytes). * s->lookahead stays null, so s->ins_h will be recomputed at the next * call of fill_window. */ s->ins_h = s->window[0]; UPDATE_HASH(s, s->ins_h, s->window[1]); for (n = 0; n <= length - MIN_MATCH; n++) { INSERT_STRING(s, n, hash_head); } if (hash_head) hash_head = 0; /* to make compiler happy */ return Z_OK; } /* ========================================================================= */ int ZEXPORT deflateReset (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); lm_init(s); return Z_OK; } /* ========================================================================= */ 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 deflatePrime (strm, bits, value) z_streamp strm; int bits; int value; { if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; strm->state->bi_valid = bits; strm->state->bi_buf = (ush)(value & ((1 << bits) - 1)); 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 (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 = strm->state->pending; if (len > strm->avail_out) len = strm->avail_out; if (len == 0) return; zmemcpy(strm->next_out, strm->state->pending_out, len); strm->next_out += len; strm->state->pending_out += len; strm->total_out += len; strm->avail_out -= len; strm->state->pending -= len; if (strm->state->pending == 0) { strm->state->pending_out = strm->state->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 && flush <= 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; } } } 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(dest, 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(ds, 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(ds->prev, ss->prev, ds->w_size * sizeof(Pos)); zmemcpy(ds->head, 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; if (strm->state->wrap == 1) { strm->adler = adler32(strm->adler, strm->next_in, len); } #ifdef GZIP else if (strm->state->wrap == 2) { strm->adler = crc32(strm->adler, strm->next_in, len); } #endif zmemcpy(buf, strm->next_in, len); 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->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; 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) return; /* 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 >= MIN_MATCH) { 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 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; } } } /* =========================================================================== * 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); } } FLUSH_BLOCK(s, flush == Z_FINISH); return flush == Z_FINISH ? finish_done : 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); } FLUSH_BLOCK(s, flush == Z_FINISH); return flush == Z_FINISH ? finish_done : 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; } FLUSH_BLOCK(s, flush == Z_FINISH); return flush == Z_FINISH ? finish_done : 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 encodable run. */ 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; } } /* 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); } FLUSH_BLOCK(s, flush == Z_FINISH); return flush == Z_FINISH ? finish_done : 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); } FLUSH_BLOCK(s, flush == Z_FINISH); return flush == Z_FINISH ? finish_done : block_done; } varnish-3.0.5/lib/libvgz/uncompr.c0000644000175000017500000000372412247035455014021 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 = (Bytef*)(uintptr_t)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-3.0.5/lib/libvgz/trees.h0000644000175000017500000002043012234401732013445 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-3.0.5/lib/libvgz/zconf.h0000644000175000017500000003210212247035455013452 00000000000000/* zconf.h -- configuration of the zlib compression library * Copyright (C) 1995-2010 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ #ifndef ZCONF_H #define ZCONF_H #include /* * 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 */ /* all linked symbols */ # define _dist_code z__dist_code # define _length_code z__length_code # define _tr_align z__tr_align # 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 # define compress z_compress # define compress2 z_compress2 # define compressBound z_compressBound # 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 deflatePrime z_deflatePrime # define deflateReset z_deflateReset # 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 # 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 gzgets z_gzgets # define gzoffset z_gzoffset # define gzoffset64 z_gzoffset64 # define gzopen z_gzopen # define gzopen64 z_gzopen64 # define gzprintf z_gzprintf # 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 # 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 inflateSync z_inflateSync # define inflateSyncPoint z_inflateSyncPoint # define inflateUndermine z_inflateUndermine # define inflate_copyright z_inflate_copyright # define inflate_fast z_inflate_fast # define inflate_table z_inflate_table # define uncompress z_uncompress # define zError z_zError # define zcalloc z_zcalloc # define zcfree z_zcfree # 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 # define gzFile z_gzFile # 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 /* 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 /* 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 1 /* was set to #if 1 by ./configure */ # define Z_HAVE_UNISTD_H #endif #ifdef STDC # include /* for off_t */ #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 -_LARGEFILE64_SOURCE - -1 == 1 # undef _LARGEFILE64_SOURCE #endif #if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) # include /* for SEEK_* and off_t */ # ifdef VMS # include /* for off_t */ # endif # ifndef z_off_t # define z_off_t off_t # endif #endif #ifndef SEEK_SET # 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 #ifndef z_off_t # define z_off_t long #endif #if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 # define z_off64_t off64_t #else # define z_off64_t z_off_t #endif #if defined(__OS400__) # define NO_vsnprintf #endif #if defined(__MVS__) # define NO_vsnprintf #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-3.0.5/lib/libvgz/adler32.c0000644000175000017500000001167012247035455013571 00000000000000/* adler32.c -- compute the Adler-32 checksum of a data stream * Copyright (C) 1995-2007 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_(uLong adler1, uLong adler2, z_off64_t len2); #define BASE 65521UL /* 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 */ #ifdef NO_DIVIDE # define MOD(a) \ do { \ if (a >= (BASE << 16)) a -= (BASE << 16); \ if (a >= (BASE << 15)) a -= (BASE << 15); \ if (a >= (BASE << 14)) a -= (BASE << 14); \ if (a >= (BASE << 13)) a -= (BASE << 13); \ if (a >= (BASE << 12)) a -= (BASE << 12); \ if (a >= (BASE << 11)) a -= (BASE << 11); \ if (a >= (BASE << 10)) a -= (BASE << 10); \ if (a >= (BASE << 9)) a -= (BASE << 9); \ if (a >= (BASE << 8)) a -= (BASE << 8); \ if (a >= (BASE << 7)) a -= (BASE << 7); \ if (a >= (BASE << 6)) a -= (BASE << 6); \ if (a >= (BASE << 5)) a -= (BASE << 5); \ if (a >= (BASE << 4)) a -= (BASE << 4); \ if (a >= (BASE << 3)) a -= (BASE << 3); \ if (a >= (BASE << 2)) a -= (BASE << 2); \ if (a >= (BASE << 1)) a -= (BASE << 1); \ if (a >= BASE) a -= BASE; \ } while (0) # define MOD4(a) \ do { \ if (a >= (BASE << 4)) a -= (BASE << 4); \ if (a >= (BASE << 3)) a -= (BASE << 3); \ if (a >= (BASE << 2)) a -= (BASE << 2); \ if (a >= (BASE << 1)) a -= (BASE << 1); \ if (a >= BASE) a -= BASE; \ } while (0) #else # define MOD(a) a %= BASE # define MOD4(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; MOD4(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; /* the derivation of this formula is left as an exercise for the reader */ rem = (unsigned)(len2 % BASE); 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-3.0.5/lib/libvgz/inftrees.c0000644000175000017500000003271112247035455014153 00000000000000/* inftrees.c -- generate Huffman trees for efficient decoding * Copyright (C) 1995-2010 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" #include "inftrees.h" #define MAXBITS 15 const char inflate_copyright[] = " inflate 1.2.5 Copyright 1995-2010 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, 73, 195}; 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 rest of table for incomplete codes. This loop is similar to the loop above in incrementing huff for table indices. It is assumed that len is equal to curr + drop, so there is no loop needed to increment through high index bits. When the current sub-table is filled, the loop drops back to the root table to fill in any remaining entries there. */ here.op = (unsigned char)64; /* invalid code marker */ here.bits = (unsigned char)(len - drop); here.val = (unsigned short)0; while (huff != 0) { /* when done with sub-table, drop back to root table */ if (drop != 0 && (huff & mask) != low) { drop = 0; len = root; next = *table; here.bits = (unsigned char)len; } /* put invalid code marker in table */ next[huff >> drop] = here; /* 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; } /* set return parameters */ *table += used; *bits = root; return 0; } varnish-3.0.5/lib/libvgz/inftrees.h0000644000175000017500000000556012234401732014151 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-3.0.5/lib/libvgz/crc32.h0000644000175000017500000007355012247035455013263 00000000000000/* crc32.h -- tables for rapid CRC calculation * Generated automatically by crc32.c */ local const unsigned long 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-3.0.5/autogen.sh0000755000175000017500000000144312234401732012113 00000000000000#!/bin/sh # warn() { echo "WARNING: $@" 1>&2 } case `uname -s` in Darwin) LIBTOOLIZE=glibtoolize ;; FreeBSD) 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-3.0.5/compile0000755000175000017500000001624512247037162011504 00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-10-14.11; # UTC # Copyright (C) 1999-2013 Free Software Foundation, Inc. # Written by Tom Tromey . # # 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. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # 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-3.0.5/Makefile.in0000644000175000017500000007130212247037162012166 00000000000000# Makefile.in generated by automake 1.14 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/configure $(am__configure_deps) \ $(srcdir)/config.h.in $(srcdir)/varnishapi.pc.in ChangeLog \ INSTALL README compile config.guess config.sub depcomp \ install-sh missing ltmain.sh ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.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 CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : 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_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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)$(pkgconfigdir)" DATA = $(pkgconfig_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ $(LISP)config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope 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__post_remove_distdir = $(am__remove_distdir) 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 DIST_TARGETS = dist-gzip 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@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIBS = @CURSES_LIBS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ 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@ JEMALLOC_SUBDIR = @JEMALLOC_SUBDIR@ 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@ 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@ XSLTPROC = @XSLTPROC@ 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 man etc doc redhat pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = varnishapi.pc EXTRA_DIST = LICENSE autogen.sh varnishapi.pc.in DISTCHECK_CONFIGURE_FLAGS = \ --enable-developer-warnings \ --enable-debugging-symbols \ --enable-dependency-tracking \ --enable-diagnostics \ --enable-extra-developer-warnings \ --enable-tests \ --enable-werror 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: $(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: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @test -f $@ || rm -f stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 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: $(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 $@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool config.lt install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ fi; \ 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files 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 \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ 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__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_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.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 u+w $(distdir) mkdir $(distdir)/_build $(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-$$$$/" \ && $(MAKE) $(AM_MAKEFLAGS) distcheck-hook \ && 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__post_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)$(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: 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-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-pkgconfigDATA .MAKE: $(am__recursive_targets) all install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ clean-libtool cscope cscopelist-am ctags ctags-am dist \ dist-all dist-bzip2 dist-gzip dist-lzip 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-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-am uninstall uninstall-am uninstall-pkgconfigDATA install-data-local: $(install_sh) -d -m 0755 $(DESTDIR)$(localstatedir)/varnish distcheck-hook: V="@PACKAGE_VERSION@" ; \ V="$${V%%-*}" ; \ if ! grep "^Version: $$V$$" $(top_distdir)/redhat/varnish.spec && \ [ "@PACKAGE_VERSION@" != "trunk" ]; then \ echo "$$V" ; \ echo "redhat/varnish.spec does not have a version number matching the package" ; \ exit 1 ; \ fi # 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-3.0.5/varnishapi.pc.in0000644000175000017500000000036712247035455013224 00000000000000prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ vmoddir=${libdir}/varnish/vmods Name: VarnishAPI Description: Varnish API Version: @PACKAGE_VERSION@ Cflags: -I${includedir}/varnish Libs: -L${libdir} -lvarnishapi varnish-3.0.5/aclocal.m40000644000175000017500000013730312247037160011763 00000000000000# generated automatically by aclocal 1.14 -*- Autoconf -*- # Copyright (C) 1996-2013 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_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. 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-2013 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. # 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.14' 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.14], [], [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.14])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-2013 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. # 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-2013 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. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$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-2013 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. # 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", "OBJC", "OBJCXX", "UPC", or "GJC". # 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 m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" 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 10 /bin/sh. echo '/* dummy */' > 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], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) 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-2013 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. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf 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"` # 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'`; 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-2013 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 macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # 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.65])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], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) 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], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [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([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # 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])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro 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 # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi]) 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-2013 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. # 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-2013 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. # 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])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2013 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. # 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-2013 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. # 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 is modern enough. # If it is, 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 --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # -*- Autoconf -*- # Obsolete and "removed" macros, that must however still report explicit # error messages when used, to smooth transition. # # Copyright (C) 1996-2013 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. AC_DEFUN([AM_CONFIG_HEADER], [AC_DIAGNOSE([obsolete], ['$0': this macro is obsolete. You should use the 'AC][_CONFIG_HEADERS' macro instead.])dnl AC_CONFIG_HEADERS($@)]) AC_DEFUN([AM_PROG_CC_STDC], [AC_PROG_CC am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc AC_DIAGNOSE([obsolete], ['$0': this macro is obsolete. You should simply use the 'AC][_PROG_CC' macro instead. Also, your code should no longer depend upon 'am_cv_prog_cc_stdc', but upon 'ac_cv_prog_cc_stdc'.])]) AC_DEFUN([AM_C_PROTOTYPES], [AC_FATAL([automatic de-ANSI-fication support has been removed])]) AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2013 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. # _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])]) # Copyright (C) 1999-2013 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. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2013 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. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2013 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. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # 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 ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file 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 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 if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done 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]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2013 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. # 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], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) 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-2013 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. # 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-2013 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. # _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-2013 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. # _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}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} 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_lib_readline.m4]) m4_include([m4/ax_pthread.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-3.0.5/config.sub0000755000175000017500000010535412247037162012111 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-08-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 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 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. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches with a ChangeLog entry to config-patches@gnu.org. # # 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 1992-2013 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-musl* | 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*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -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 | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | c8051 | 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 | microblazeel | 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 \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 \ | or1k | 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-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | 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-* | microblazeel-* \ | 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-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | 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 ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-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=i686-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 | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) 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* | -plan9* \ | -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* \ | -bitrig* | -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* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -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 ;; -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 ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; 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 ;; or1k-*) 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-3.0.5/doc/0000755000175000017500000000000012247037210010735 500000000000000varnish-3.0.5/doc/changes-2.0.6.html0000644000175000017500000000327312247037207013627 00000000000000 Change log for Varnish 2.0.6

Change log for Varnish 2.0.6

Changes between 2.0.5 and 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.

varnish-3.0.5/doc/changes-html.xsl0000644000175000017500000000445612247035455014001 00000000000000 ]> <xsl:call-template name="title"/>

Change log for&space; &space;

Changes between&space; &space;and&space;

  • http://varnish.projects.linpro.no/ticket/ ticket # Warning: no template for element
    varnish-3.0.5/doc/changes-2.0.xml0000644000175000017500000000051412247035455013315 00000000000000 ]> Varnish 2.0 varnish-3.0.5/doc/Makefile.am0000644000175000017500000000304712247035455012726 00000000000000# CHANGELOGS = \ changes-2.1.5.html \ changes-2.1.4.html \ changes-2.1.3.html \ changes-2.1.2.html \ changes-2.1.1.html \ changes-2.1.0.html \ changes-2.0.6.html \ changes-2.0.5.html \ changes-2.0.4.html \ changes-2.0.3.html \ changes-2.0.2.html \ changes-2.0.1.html \ changes-2.0.html \ changes-1.1.2.html \ changes-1.1.1.html \ changes-1.1.html \ changes-1.0.4.html XML = \ changes-2.1.4-2.1.5.xml \ changes-2.1.3-2.1.4.xml \ changes-2.1.2-2.1.3.xml \ changes-2.1.1-2.1.2.xml \ changes-2.1.0-2.1.1.xml \ changes-2.0.6-2.1.0.xml \ changes-2.0.5-2.0.6.xml \ changes-2.0.4-2.0.5.xml \ changes-2.0.3-2.0.4.xml \ changes-2.0.2-2.0.3.xml \ changes-2.0.1-2.0.2.xml \ changes-2.0-2.0.1.xml \ changes-1.1.2-2.0.xml \ changes-1.1.1-1.1.2.xml \ changes-1.1-1.1.1.xml \ changes-1.0.4-1.1.xml \ changes-1.0.3-1.0.4.xml \ ${CHANGELOGS:.html=.xml} if HAVE_XSLTPROC all: ${CHANGELOGS} endif EXTRA_DIST = ${CHANGELOGS} ${XML} \ changes.css changes-html.xsl \ changes.rst changes.html CLEANFILES = ${CHANGELOGS} SUFFIXES = .xml .html .xml.html: if HAVE_XSLTPROC ${XSLTPROC} --xinclude -o $@ $< else @echo "========================================" @echo "You need xsltproc installed to make dist" @echo "========================================" @false endif changes.html: changes.rst if HAVE_RST2HTML ${RST2HTML} $? $@ else @echo "========================================" @echo "You need rst2html installed to make dist" @echo "========================================" @false endif ${CHANGELOGS}: changes-html.xsl SUBDIRS = sphinx varnish-3.0.5/doc/changes.css0000644000175000017500000000054412247035455013013 00000000000000/* $Id$ */ body { background-color: white; color: black; font-family: sans-serif; max-width: 40em; margin: 1in auto 1in auto; } h1 { font-size: 200%; font-weight: bold; color: maroon; } h2 { font-size: 160%; font-weight: bold; color: maroon; } h3 { font-size: 120%; font-weight: bold; color: maroon; } .code { font-family: monospace; } varnish-3.0.5/doc/changes-2.0.3.html0000644000175000017500000001652312247037207013626 00000000000000 Change log for Varnish 2.0.3

    Change log for Varnish 2.0.3

    Changes between 2.0.2 and 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.

    varnish-3.0.5/doc/changes-2.1.5.html0000644000175000017500000000751612247037207013633 00000000000000 Change log for Varnish 2.1.5

    Change log for Varnish 2.1.5

    Changes between 2.1.4 and 2.1.5

    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.

    varnish-3.0.5/doc/changes-2.1.4-2.1.5.xml0000644000175000017500000001010012247035455014111 00000000000000 ]> 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. varnish-3.0.5/doc/changes-2.0.2-2.0.3.xml0000644000175000017500000001750212247035455014120 00000000000000 ]> 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. varnish-3.0.5/doc/changes-1.0.4-1.1.xml0000644000175000017500000002413012247035455013753 00000000000000 ]> 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. varnish-3.0.5/doc/changes-2.0.6.xml0000644000175000017500000000052012247035455013456 00000000000000 ]> Varnish 2.0.6 varnish-3.0.5/doc/changes-2.0.6-2.1.0.xml0000644000175000017500000002301512247035455014116 00000000000000 ]> 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 varnish-3.0.5/doc/changes-2.0.1-2.0.2.xml0000644000175000017500000000121412247035455014107 00000000000000 ]> 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. varnish-3.0.5/doc/changes-2.1.2-2.1.3.xml0000644000175000017500000000436512247035455014125 00000000000000 ]> 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. varnish-3.0.5/doc/changes-2.0.1.html0000644000175000017500000000142512247037207013617 00000000000000 Change log for Varnish 2.0.1

    Change log for Varnish 2.0.1

    Changes between 2.0 and 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.

    varnish-3.0.5/doc/changes-2.0.5.html0000644000175000017500000001222612247037207013624 00000000000000 Change log for Varnish 2.0.5

    Change log for Varnish 2.0.5

    Changes between 2.0.4 and 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.

    varnish-3.0.5/doc/changes-2.0.3.xml0000644000175000017500000000052012247035455013453 00000000000000 ]> Varnish 2.0.3 varnish-3.0.5/doc/changes-2.1.2.xml0000644000175000017500000000060512247035455013457 00000000000000 ]> Varnish 2.1.2 varnish-3.0.5/doc/changes-1.0.4.html0000644000175000017500000001666312247037207013633 00000000000000 Change log for Varnish 1.0.4

    Change log for Varnish 1.0.4

    Changes between 1.0.3 and 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-3.0.5/doc/changes-1.1.1.html0000644000175000017500000001142412247037207013617 00000000000000 Change log for Varnish 1.1.1

    Change log for Varnish 1.1.1

    Changes between 1.1 and 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.

    varnish-3.0.5/doc/changes-2.1.0-2.1.1.xml0000644000175000017500000000600612247035455014113 00000000000000 ]> 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 varnishhost, but for the length of objects, has been added.. varnish-3.0.5/doc/changes-2.0.3-2.0.4.xml0000644000175000017500000000602012247035455014113 00000000000000 ]> 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 accidentially 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. varnish-3.0.5/doc/changes-1.0.3-1.0.4.xml0000644000175000017500000001744412247035455014125 00000000000000 ]> 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 ). 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 ). 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-3.0.5/doc/changes-2.1.3.xml0000644000175000017500000000060512247035455013460 00000000000000 ]> Varnish 2.1.3 varnish-3.0.5/doc/changes-2.1.5.xml0000644000175000017500000000050212247035455013456 00000000000000 ]> Varnish 2.1.5 varnish-3.0.5/doc/changes-2.1.1.xml0000644000175000017500000000060312247035455013454 00000000000000 ]> Varnish 2.1 varnish-3.0.5/doc/changes-1.1.2.xml0000644000175000017500000000052012247035455013452 00000000000000 ]> Varnish 1.1.2 varnish-3.0.5/doc/changes-1.1.1.xml0000644000175000017500000000051612247035455013456 00000000000000 ]> Varnish 1.1.1 varnish-3.0.5/doc/changes.rst0000644000175000017500000006310412247036064013031 00000000000000================================ Changes from 3.0.5 rc 1 to 3.0.5 ================================ varnishd -------- - Always check the local address of a socket. This avoids a crash if server.ip is accessed after a client has closed the connection. `Bug #1376` .. _bug #1376: http://varnish-cache.org/trac/ticket/1376 ================================ Changes from 3.0.4 to 3.0.5 rc 1 ================================ varnishd -------- - Stop printing error messages on ESI parse errors - Fix a problem where Varnish would segfault if the first part of a synthetic page was NULL. `Bug #1287` - If streaming was used, you could in some cases end up with duplicate content headers being sent to clients. `Bug #1272` - If we receive a completely garbled request, don't pass through vcl_error, since we could then end up in vcl_recv through a restart and things would go downhill from there. `Bug #1367` - Prettify backtraces on panic slightly. .. _bug #1287: http://varnish-cache.org/trac/ticket/1287 .. _bug #1272: http://varnish-cache.org/trac/ticket/1272 .. _bug #1367: http://varnish-cache.org/trac/ticket/1367 varnishlog ---------- - Correct an error where -m, -c and -b would interact badly, leading to lack of matches. Also, emit BackendXID to signify the start of a transaction. `Bug #1325` .. _bug #1325: http://varnish-cache.org/trac/ticket/1325 varnishadm ---------- - Handle input from stdin properly. `Bug #1314` .. _bug #1314: http://varnish-cache.org/trac/ticket/1314 ================================ Changes from 3.0.4 rc 1 to 3.0.4 ================================ 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: http://varnish-cache.org/trac/ticket/1285 .. _bug #1312: http://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: http://varnish-cache.org/trac/ticket/1076 .. _bug #1184: http://varnish-cache.org/trac/ticket/1184 .. _bug #1224: http://varnish-cache.org/trac/ticket/1224 .. _bug #1261: http://varnish-cache.org/trac/ticket/1261 .. _bug #1275: http://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: http://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 =========================== 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: http://varnish-cache.org/trac/ticket/897 .. _bug #1023: http://varnish-cache.org/trac/ticket/1023 .. _bug #1029: http://varnish-cache.org/trac/ticket/1029 .. _bug #1023: http://varnish-cache.org/trac/ticket/1023 .. _bug #1035: http://varnish-cache.org/trac/ticket/1035 .. _bug #1037: http://varnish-cache.org/trac/ticket/1037 .. _bug #1038: http://varnish-cache.org/trac/ticket/1038 .. _bug #1043: http://varnish-cache.org/trac/ticket/1043 .. _bug #1044: http://varnish-cache.org/trac/ticket/1044 .. _bug #1047: http://varnish-cache.org/trac/ticket/1047 .. _bug #1069: http://varnish-cache.org/trac/ticket/1069 .. _bug #1073: http://varnish-cache.org/trac/ticket/1073 .. _bug #1080: http://varnish-cache.org/trac/ticket/1080 .. _bug #1091: http://varnish-cache.org/trac/ticket/1091 .. _bug #1092: http://varnish-cache.org/trac/ticket/1092 .. _bug #1100: http://varnish-cache.org/trac/ticket/1100 .. _bug #1104: http://varnish-cache.org/trac/ticket/1104 .. _bug #1109: http://varnish-cache.org/trac/ticket/1109 .. _bug #1125: http://varnish-cache.org/trac/ticket/1125 .. _bug #1126: http://varnish-cache.org/trac/ticket/1126 .. _bug #1140: http://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: http://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: http://varnish-cache.org/trac/ticket/1003 ================================ Changes from 3.0.2 rc 1 to 3.0.2 ================================ 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 ================================ 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: http://varnish-cache.org/trac/ticket/994 .. _bug #992: http://varnish-cache.org/trac/ticket/992 .. _bug #996: http://varnish-cache.org/trac/ticket/996 .. _bug #1007: http://varnish-cache.org/trac/ticket/1007 .. _bug #1008: http://varnish-cache.org/trac/ticket/1008 .. _bug #1012: http://varnish-cache.org/trac/ticket/1012 .. _bug #1016: http://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 ================================ 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 ================================ 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: http://varnish-cache.org/trac/ticket/965 .. _bug #963: http://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: http://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: http://varnish-cache.org/trac/ticket/961 ================================ Changes from 3.0 beta 2 to 3.0.0 ================================ 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: http://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: http://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: http://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: http://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: http://varnish-cache.org/trac/ticket/693 .. _bug #683: http://varnish-cache.org/trac/ticket/683 .. _bug #663: http://varnish-cache.org/trac/ticket/663 .. _bug #880: http://varnish-cache.org/trac/ticket/880 .. _bug #411: http://varnish-cache.org/trac/ticket/411 .. _bug #693: http://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: http://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: http://varnish-cache.org/trac/ticket/712 .. _bug #485: http://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: http://varnish-cache.org/trac/ticket/481 .. _bug #787: http://varnish-cache.org/trac/ticket/787 .. _bug #782: http://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 varnish-3.0.5/doc/changes-2.0.5-2.0.6.xml0000644000175000017500000000327412247035455014127 00000000000000 ]> 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. varnish-3.0.5/doc/changes-2.1.4.html0000644000175000017500000001301212247037207013616 00000000000000 Change log for Varnish 2.1.4

    Change log for Varnish 2.1.4

    Changes between 2.1.3 and 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.

    varnish-3.0.5/doc/changes-2.0.2.xml0000644000175000017500000000052012247035455013452 00000000000000 ]> Varnish 2.0.2 varnish-3.0.5/doc/changes-2.1.3-2.1.4.xml0000644000175000017500000001335112247035455014122 00000000000000 ]> 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. varnish-3.0.5/doc/changes-2.0.4-2.0.5.xml0000644000175000017500000001256412247035455014127 00000000000000 ]> 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. varnish-3.0.5/doc/changes-2.1.2.html0000644000175000017500000000131512247037207013617 00000000000000 Change log for Varnish 2.1.2

    Change log for Varnish 2.1.2

    Changes between 2.1.1 and 2.1.2

    varnishd

    • When adding Range support for 2.1.1, we accidentially 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.

    varnish-3.0.5/doc/changes-1.0.4.xml0000644000175000017500000000103212247035455013452 00000000000000 ]> Varnish 1.0.4 varnish-3.0.5/doc/changes-2.1.3.html0000644000175000017500000000416212247037207013623 00000000000000 Change log for Varnish 2.1.3

    Change log for Varnish 2.1.3

    Changes between 2.1.2 and 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.

    varnish-3.0.5/doc/Makefile.in0000644000175000017500000005055112247037162012736 00000000000000# Makefile.in generated by automake 1.14 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lib_readline.m4 \ $(top_srcdir)/m4/ax_pthread.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_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : 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_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` 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@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIBS = @CURSES_LIBS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_LIBS = @DL_LIBS@ 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@ JEMALLOC_SUBDIR = @JEMALLOC_SUBDIR@ 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@ 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@ XSLTPROC = @XSLTPROC@ 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@ CHANGELOGS = \ changes-2.1.5.html \ changes-2.1.4.html \ changes-2.1.3.html \ changes-2.1.2.html \ changes-2.1.1.html \ changes-2.1.0.html \ changes-2.0.6.html \ changes-2.0.5.html \ changes-2.0.4.html \ changes-2.0.3.html \ changes-2.0.2.html \ changes-2.0.1.html \ changes-2.0.html \ changes-1.1.2.html \ changes-1.1.1.html \ changes-1.1.html \ changes-1.0.4.html XML = \ changes-2.1.4-2.1.5.xml \ changes-2.1.3-2.1.4.xml \ changes-2.1.2-2.1.3.xml \ changes-2.1.1-2.1.2.xml \ changes-2.1.0-2.1.1.xml \ changes-2.0.6-2.1.0.xml \ changes-2.0.5-2.0.6.xml \ changes-2.0.4-2.0.5.xml \ changes-2.0.3-2.0.4.xml \ changes-2.0.2-2.0.3.xml \ changes-2.0.1-2.0.2.xml \ changes-2.0-2.0.1.xml \ changes-1.1.2-2.0.xml \ changes-1.1.1-1.1.2.xml \ changes-1.1-1.1.1.xml \ changes-1.0.4-1.1.xml \ changes-1.0.3-1.0.4.xml \ ${CHANGELOGS:.html=.xml} EXTRA_DIST = ${CHANGELOGS} ${XML} \ changes.css changes-html.xsl \ changes.rst changes.html CLEANFILES = ${CHANGELOGS} SUFFIXES = .xml .html SUBDIRS = sphinx all: all-recursive .SUFFIXES: .SUFFIXES: .xml .html $(srcdir)/Makefile.in: $(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: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ 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: -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 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: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-libtool cscopelist-am ctags \ ctags-am 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-am uninstall uninstall-am @HAVE_XSLTPROC_TRUE@all: ${CHANGELOGS} .xml.html: @HAVE_XSLTPROC_TRUE@ ${XSLTPROC} --xinclude -o $@ $< @HAVE_XSLTPROC_FALSE@ @echo "========================================" @HAVE_XSLTPROC_FALSE@ @echo "You need xsltproc installed to make dist" @HAVE_XSLTPROC_FALSE@ @echo "========================================" @HAVE_XSLTPROC_FALSE@ @false changes.html: changes.rst @HAVE_RST2HTML_TRUE@ ${RST2HTML} $? $@ @HAVE_RST2HTML_FALSE@ @echo "========================================" @HAVE_RST2HTML_FALSE@ @echo "You need rst2html installed to make dist" @HAVE_RST2HTML_FALSE@ @echo "========================================" @HAVE_RST2HTML_FALSE@ @false ${CHANGELOGS}: changes-html.xsl # 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-3.0.5/doc/changes-2.1.4.xml0000644000175000017500000000060512247035455013461 00000000000000 ]> Varnish 2.1.4 varnish-3.0.5/doc/changes-2.0.html0000644000175000017500000001351412247037207013462 00000000000000 Change log for Varnish 2.0

    Change log for Varnish 2.0

    Changes between 1.1.2 and 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 http://varnish.projects.linpro.no/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 occurences 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.

    varnish-3.0.5/doc/changes-2.0.5.xml0000644000175000017500000000052012247035455013455 00000000000000 ]> Varnish 2.0.5 varnish-3.0.5/doc/changes-1.1.xml0000644000175000017500000000051412247035455013315 00000000000000 ]> Varnish 1.1 varnish-3.0.5/doc/changes-2.0-2.0.1.xml0000644000175000017500000000126012247035455013750 00000000000000 ]> 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. varnish-3.0.5/doc/sphinx/0000755000175000017500000000000012247037213012251 500000000000000varnish-3.0.5/doc/sphinx/conf.py0000644000175000017500000001534412247037174013505 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' copyright = u'2010, Varnish Project' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = '3.0.5' # The full version, including alpha/beta/rc tags. release = '3.0.5' # 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','reference/params.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 3.0.5 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 Documentation', u'Varnish Project', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # Additional stuff for the LaTeX preamble. #latex_preamble = '' # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_use_modindex = True varnish-3.0.5/doc/sphinx/Makefile.am0000644000175000017500000001106112247035455014232 00000000000000# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = =build # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(srcdir) .PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " changes to make an overview of all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: -rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Varnish.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Varnish.qhc" latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ "run these through (pdf)latex." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." EXTRA_DIST = \ conf.py \ index.rst \ glossary/index.rst \ installation/bugs.rst \ installation/help.rst \ installation/index.rst \ installation/install.rst \ installation/prerequisites.rst \ installation/upgrade.rst \ phk/autocrap.rst \ phk/backends.rst \ phk/barriers.rst \ phk/gzip.rst \ phk/index.rst \ phk/ipv6suckage.rst \ phk/platforms.rst \ phk/sphinx.rst \ phk/ssl.rst \ phk/thoughts.rst \ phk/three-zero.rst \ phk/vcl_expr.rst \ reference/index.rst \ reference/shmem.rst \ reference/params.rst \ reference/varnishadm.rst \ reference/varnish-cli.rst \ reference/varnishd.rst \ reference/varnishhist.rst \ reference/varnishlog.rst \ reference/varnishncsa.rst \ reference/varnishreplay.rst \ reference/varnishsizes.rst \ reference/varnishstat.rst \ reference/varnishtest.rst \ reference/varnishtop.rst \ reference/vcl.rst \ reference/vmod.rst \ reference/vmod_std.rst \ tutorial/advanced_backend_servers.rst \ tutorial/advanced_topics.rst \ tutorial/backend_servers.rst \ tutorial/cookies.rst \ tutorial/esi.rst \ tutorial/handling_misbehaving_servers.rst \ tutorial/increasing_your_hitrate.rst \ tutorial/index.rst \ tutorial/logging.rst \ tutorial/purging.rst \ tutorial/putting_varnish_on_port_80.rst \ tutorial/sizing_your_cache.rst \ tutorial/starting_varnish.rst \ tutorial/statistics.rst \ tutorial/troubleshooting.rst \ tutorial/vary.rst \ tutorial/vcl.rst dist-hook: $(MAKE) html cp -r $(BUILDDIR) $(distdir) distclean-local: rm -rf $(BUILDDIR) varnish-3.0.5/doc/sphinx/tutorial/0000755000175000017500000000000012247037210014111 500000000000000varnish-3.0.5/doc/sphinx/tutorial/vary.rst0000644000175000017500000000455612247035455015567 00000000000000.. _tutorial-vary: Vary ~~~~ The Vary header is sent by the web server to indicate what makes a HTTP object Vary. This makes a lot of sense with headers like Accept-Encoding. When a server issues a "Vary: Accept-Encoding" it tells Varnish that its needs to cache a separate version for every different Accept-Encoding that is coming from the clients. So, if a clients only accepts gzip encoding Varnish won't serve the version of the page encoded with the deflate encoding. The problem is that the Accept-Encoding field contains a lot of different encodings. If one browser sends:: Accept-Encoding: gzip,deflate And another one sends:: Accept-Encoding: deflate,gzip Varnish will keep two variants of the page requested due to the different Accept-Encoding headers. Normalizing the accept-encoding header will sure that you have as few variants as possible. The following VCL code will normalize the Accept-Encoding headers:: if (req.http.Accept-Encoding) { if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg)$") { # No point in compressing these remove req.http.Accept-Encoding; } elsif (req.http.Accept-Encoding ~ "gzip") { set req.http.Accept-Encoding = "gzip"; } elsif (req.http.Accept-Encoding ~ "deflate") { set req.http.Accept-Encoding = "deflate"; } else { # unknown algorithm remove req.http.Accept-Encoding; } } The code sets the Accept-Encoding header from the client to either gzip, deflate with a preference for gzip. Vary parse errors ~~~~~~~~~~~~~~~~~ Varnish will return a 503 internal server error page when it fails to parse the Vary server 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. 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-3.0.5/doc/sphinx/tutorial/increasing_your_hitrate.rst0000644000175000017500000001564712247035455021531 00000000000000.. _tutorial-increasing_your_hitrate: Achieving a high hitrate ------------------------ Now that Varnish is up and running, and 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 hit rate 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, I'll guide you through a couple of tools that you will find useful. Note that you need a tool to see what HTTP headers fly between you and the web server. On the Varnish server, the easiest is to use varnishlog and varnishtop but sometimes a client-side tool makes sense. Here are the ones I use. Tool: varnishtop ~~~~~~~~~~~~~~~~ You can use varnishtop to identify what URLs are hitting the backend the most. ``varnishtop -i txurl`` is an essential command. You can see some other examples of varnishtop usage in :ref:`tutorial-statistics`. Tool: varnishlog ~~~~~~~~~~~~~~~~ When you have identified the an URL which is frequently sent to the backend you can use varnishlog to have a look at the request. ``varnishlog -c -m 'RxURL:^/foo/bar`` will show you the requests coming from the client (-c) matching /foo/bar. For more information on how varnishlog works please see :ref:`tutorial-logging` or man :ref:`ref-varnishlog`. For extended diagnostics headers, see http://www.varnish-cache.org/trac/wiki/VCLExampleHitMissHeader Tool: lwp-request ~~~~~~~~~~~~~~~~~ lwp-request is part of The World-Wide Web library for Perl. It's a couple of really basic programs that can execute an HTTP request and give you the result. I mostly use 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. Let me explain what it does. GET usually sends off HTTP 0.9 requests, which lack the Host header. So I 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. *Live HTTP Headers* can show you what headers are being sent and recieved. 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. Please note that when considering 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 so 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: Cache-Control ~~~~~~~~~~~~~ The Cache-Control instructs caches how to handle the content. Varnish cares about the *max-age* parameter and uses it to calculate the TTL for an object. "Cache-Control: nocache" is ignored but if you need this you can easily add support for it. 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 like this:: varnishlog -i TxHeader -I ^Age Pragma ~~~~~~ An HTTP 1.0 server might send "Pragma: nocache". Varnish ignores this header. You could easily add support for this header in VCL. In vcl_fetch:: if (beresp.http.Pragma ~ "nocache") { return(hit_for_pass); } 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 than 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_fetch { if (req.url ~ "^/legacy_broken_cms/") { set beresp.ttl = 5d; } } The 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 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 different, 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"; } Ways of increasing your hitrate even more ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The following chapters should give your ways of further increasing your hitrate, especially the chapter on Cookies. * :ref:`tutorial-cookies` * :ref:`tutorial-vary` * :ref:`tutorial-purging` * :ref:`tutorial-esi` varnish-3.0.5/doc/sphinx/tutorial/logging.rst0000644000175000017500000000452512247035455016230 00000000000000.. _tutorial-logging: Logging in Varnish ------------------ One of the really nice features in Varnish is how logging works. Instead of logging to normal log file Varnish logs to a shared memory segment. When the end of the segment is reached we start over, overwriting old data. This is much, much faster then logging to a file and it doesn't require disk space. The flip side is that if you forget to have a program actually write the logs to disk they will disappear. 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 as well, we'll show you these later. In the terminal window you started varnish now type *varnishlog* and press enter. You'll see lines like these scrolling slowly by.:: 0 CLI - Rd ping 0 CLI - Wr 200 PONG 1273698726 1.0 These is the Varnish master process checking up on the caching process to see that everything is OK. Now go to the browser and reload the page displaying your web app. You'll see lines like these.:: 11 SessionOpen c 127.0.0.1 58912 0.0.0.0:8080 11 ReqStart c 127.0.0.1 58912 595005213 11 RxRequest c GET 11 RxURL c / 11 RxProtocol c HTTP/1.1 11 RxHeader c Host: localhost:8080 11 RxHeader c Connection: keep-alive The first column is an arbitrary number, it defines the request. Lines with the same number are part of the same HTTP 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. Tags starting with Rx indicate Varnish is recieving data and Tx indicates sending data. The third column tell us whether this is is data coming or going to the client (c) or to/from the backend (b). The forth column is the data being logged. Now, you can filter quite a bit with varnishlog. The basic option you want to know are: -b Only show log lines from traffic going between Varnish and the backend servers. This will be useful when we want to optimize cache hit rates. -c Same as -b but for client side traffic. -m tag:regex Only list transactions where the tag matches a regular expression. If it matches you will get the whole transaction. Now that Varnish seem to work OK it's time to put Varnish on port 80 while we tune it. varnish-3.0.5/doc/sphinx/tutorial/cookies.rst0000644000175000017500000000600112247035455016225 00000000000000.. _tutorial-cookies: Cookies ------- Varnish will, in the default configuration, not cache a 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 application 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 don't I suggest you either pick up a book on the subject, read through the *pcrepattern* man page or read through one of many online guides. Let me show you what Varnish Software uses. We use 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 we will discard these unnecessary cookies in VCL. In the following VCL we discard all cookies that start with a 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*", ""); Let me show you an example where we remove everything except the cookies named COOKIE1 and COOKIE2 and you can marvel at 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 == "") { remove req.http.Cookie; } } The example is taken from the Varnish Wiki, where you can find other scary examples of what can be done in VCL. Cookies coming from the backend ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If your backend server sets a cookie using the Set-Cookie header Varnish will not cache the page. A hit-for-pass object (see :ref:`tutorial_vcl_fetch_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. varnish-3.0.5/doc/sphinx/tutorial/advanced_topics.rst0000644000175000017500000000350412247035455017724 00000000000000.. _tutorial-advanced_topics: Advanced topics --------------- This tutorial has covered the basics in Varnish. If you read through it all you should now have the skills to run Varnish. Here is a short overview of topics that we haven't covered in the tutorial. More VCL ~~~~~~~~ VCL is a bit more complex then what we've covered so far. There are a few more subroutines available and there a few actions that we haven't discussed. For a complete(ish) guide to VCL have a look at the VCL man page - ref:`reference-vcl`. Using In-line C to extend Varnish ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can use *in-line 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 I saw of In-line 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 } Edge Side Includes ~~~~~~~~~~~~~~~~~~ Varnish can cache create web pages by putting different pages together. These *fragments* can have individual cache policies. If you have a web site with a list showing the 5 most popular articles on your site, this list can probably be cached as a fragment and included in all the other pages. Used properly it can dramatically increase your hit rate and reduce the load on your servers. ESI looks like this:: The time is: at this very moment. ESI is processed in vcl_fetch by setting *do_esi* to true.:: sub vcl_fetch { if (req.url == "/test.html") { set beresp.do_esi = true; /* Do ESI processing */ } } varnish-3.0.5/doc/sphinx/tutorial/backend_servers.rst0000644000175000017500000000245512247035455017742 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. 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. 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 comment in this bit of text and change the port setting from 8080 to 80, making the text look like.:: backend default { .host = "127.0.0.1"; .port = "80"; } 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 80 on localhost (127.0.0.1). Varnish can have several backends defined and can you can even join several backends together into clusters of backends for load balancing purposes. Now that we have the basic Varnish configuration done, let us start up Varnish on port 8080 so we can do some fundamental testing on it. varnish-3.0.5/doc/sphinx/tutorial/sizing_your_cache.rst0000644000175000017500000000217412247035455020304 00000000000000 Sizing your cache ----------------- Picking how much memory you should give Varnish 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:`reference-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 1k per object. So, if you have lots of small objects in your cache the overhead might be significant. varnish-3.0.5/doc/sphinx/tutorial/starting_varnish.rst0000644000175000017500000000437612247035455020173 00000000000000.. _tutorial-starting_varnish: Starting Varnish ---------------- I assume varnishd is in your path. You might want to run ``pkill varnishd`` to make sure varnishd isn't running. Become root and type: ``# varnishd -f /usr/local/etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1:2000 -a 0.0.0.0:8080`` I added a few options, lets go through them: ``-f /usr/local/etc/varnish/default.vcl`` The -f options specifies what configuration varnishd should use. ``-s malloc,1G`` The -s options chooses the storage type Varnish should use for storing its content. I used the type *malloc*, which just uses memory for storage. There are other backends as well, described in :ref:tutorial-storage. 1G specifies how much memory should be allocated - one gigabyte. ``-T 127.0.0.1:2000`` Varnish has a built-in text-based administration interface. Activating the interface makes Varnish manageble without stopping it. You can specify what interface the management interface should listen to. Make sure you don't expose the management interface to the world as you can easily gain root access to a system via the Varnish management interface. I recommend tieing it to localhost. If you have users on your system that you don't fully trust, use firewall rules to restrict access to the interface to root only. ``-a 0.0.0.0:8080`` I specify that I want Varnish to listen on port 8080 for incomming HTTP requests. For a production environment you would probably make Varnish listen on port 80, which is the default. Now you have Varnish running. Let us make sure that it works properly. Use your browser to go to http://192.168.2.2:8080/ (obviously, you should replace the IP address with one on your own system) - you should now see your web application running there. Whether or not the application actually goes faster when run through Varnish depends on a few factors. If you application uses cookies for every session (a lot of PHP and Java applications seem to send a session cookie if it is needed or not) or if it uses authentication chances are Varnish won't do much caching. Ignore that for the moment, we come back to that in :ref:`tutorial-increasing_your_hitrate`. Lets make sure that Varnish really does do something to your web site. To do that we'll take a look at the logs. varnish-3.0.5/doc/sphinx/tutorial/index.rst0000644000175000017500000000151112247035455015701 00000000000000.. _tutorial-index: %%%%%%%%%%%%% Using Varnish %%%%%%%%%%%%% This tutorial is intended for system administrators managing Varnish cache. The reader should know how to configure her web- or application server and have basic knowledge of the HTTP protocol. The reader should have Varnish up and running with the default configuration. The tutorial is split into short chapters, each chapter taking on a separate topic. Good luck. .. toctree:: :maxdepth: 1 introduction backend_servers starting_varnish logging sizing_your_cache putting_varnish_on_port_80 vcl statistics increasing_your_hitrate cookies vary purging compression esi platformnotes websockets devicedetection advanced_backend_servers handling_misbehaving_servers advanced_topics troubleshooting varnish-3.0.5/doc/sphinx/tutorial/purging.rst0000644000175000017500000001331012247035455016245 00000000000000.. _tutorial-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, let me explain the HTTP purges. HTTP Purges =========== 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 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.request == "PURGE") { if (!client.ip ~ purge) { error 405 "Not allowed."; } return (lookup); } } sub vcl_hit { if (req.request == "PURGE") { purge; error 200 "Purged."; } } sub vcl_miss { if (req.request == "PURGE") { purge; error 200 "Purged."; } } As you can see we have used to new VCL subroutines, vcl_hit and vcl_miss. When we call lookup Varnish will try to lookup the object in its cache. It will either hit an object or miss it and so the corresponding subroutine is called. In vcl_hit the object that is stored in cache is available and we can set the TTL. The purge in vcl_miss is necessary to purge all variants in the cases where you hit an object, but miss a particular variant. 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.request == "BAN") { # Same ACL check as above: if (!client.ip ~ purge) { error 405 "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. error 200 "Ban added"; } } This VCL sniplet enables Varnish to handle an 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_fetch { set beresp.http.x-url = req.url; } sub vcl_deliver { unset resp.http.x-url; # Optional } sub vcl_recv { if (req.request == "PURGE") { if (client.ip !~ purge) { error 401 "Not allowed"; } ban("obj.http.x-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 CLI. This will produce a status of all current bans:: 0xb75096d0 1318329475.377475 10 obj.http.x-url ~ test 0xb7509610 1318329470.785875 20G obj.http.x-url ~ test 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-3.0.5/doc/sphinx/tutorial/handling_misbehaving_servers.rst0000644000175000017500000000653012247035455022511 00000000000000.. _tutorial-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 back end. 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 30 minutes beyond their TTL use the following VCL:: sub vcl_fetch { set beresp.grace = 30m; } Varnish still won't serve the stale objects. In order to enable Varnish to actually serve the stale object we must enable this on the request. Lets us say that we accept serving 15s old object.:: sub vcl_recv { set req.grace = 15s; } You might wonder why we should keep the objects in the cache for 30 minutes if we are unable to serve them? Well, if you have enabled :ref:`tutorial-advanced_backend_servers-health` you can check if the backend is sick and if it is we can serve the stale content for a bit longer.:: if (! req.backend.healthy) { set req.grace = 5m; } else { set req.grace = 15s; } So, to sum up, grace mode solves two problems: * it serves stale content to avoid request pile-up. * it serves stale content if the backend is not healthy. Saint mode ~~~~~~~~~~ Sometimes servers get flaky. They start throwing out random errors. You can instruct Varnish to try to handle this in a more-than-graceful way - enter *Saint mode*. Saint mode enables you to discard a certain page from one backend server and either try another server or serve stale content from cache. Lets have a look at how this can be enabled in VCL:: sub vcl_fetch { if (beresp.status == 500) { set beresp.saintmode = 10s; return(restart); } set beresp.grace = 5m; } When we set beresp.saintmode to 10 seconds Varnish will not ask *that* server for URL for 10 seconds. A blacklist, more or less. Also a restart is performed so if you have other backends capable of serving that content Varnish will try those. When you are out of backends Varnish will serve the content from its stale cache. This can really be a life saver. Known limitations on grace- and saint mode ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If your request fails while it is being fetched you're thrown into vcl_error. vcl_error has access to a rather limited set of data so you can't enable saint mode or grace mode here. This will be addressed in a future release but a work-around available. * Declare a backend that is always sick. * Set a magic marker in vcl_error * Restart the transaction * Note the magic marker in vcl_recv and set the backend to the one mentioned * Varnish will now serve stale data is any is available God mode ~~~~~~~~ Not implemented yet. :-) varnish-3.0.5/doc/sphinx/tutorial/statistics.rst0000644000175000017500000000362412247035455016773 00000000000000.. _tutorial-statistics: Statistics ---------- Now that your varnish is up and running let's have a look at how it is doing. There are several tools that can help. varnishtop ~~~~~~~~~~ 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 rxurl`` will show you what URLs are being asked for by the client. ``varnishtop -i txurl`` will show you what your backend is being asked the most. ``varnishtop -i RxHeader -I Accept-Encoding`` will show the most popular Accept-Encoding header the client are sending you. varnishhist ~~~~~~~~~~~ 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 ("#"). varnishsizes ~~~~~~~~~~~~ Varnishsizes does the same as varnishhist, except it shows the size of the objects and not the time take to complete the request. This gives you a good overview of how big the objects you are serving are. 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. varnish-3.0.5/doc/sphinx/tutorial/vcl.rst0000644000175000017500000001376012247035455015367 00000000000000Varnish 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. Varnish uses a domain specific language called Varnish Configuration Language, or VCL for short. Varnish translates this configuration into binary code which is then executed when requests arrive. The VCL files are divided 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. Varnish will execute these subroutines of code at different stages of its work. Because it is code it is execute line by line precedence isn't a problem. At some point you call an action in this subroutine and then the execution of the subroutine stops. 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 default.vcl. 99% of all the changes you'll need to do will be done in two of these subroutines. *vcl_recv* and *vcl_fetch*. vcl_recv ~~~~~~~~ vcl_recv (yes, we're skimpy with characters, it's Unix) is called at the beginning of a request, after the complete request has been received and parsed. Its purpose is to decide whether or not to serve the request, how to do it, and, if applicable, which backend to use. In vcl_recv you can also alter the request. Typically you can alter the cookies and add and remove request headers. Note that in vcl_recv only the request object, req is available. vcl_fetch ~~~~~~~~~ vcl_fetch is called *after* a document has been successfully retrieved from the backend. Normal tasks her are to alter the response headers, trigger ESI processing, try alternate backend servers in case the request failed. In vcl_fetch you still have the request object, req, available. There is also a *backend response*, beresp. beresp will contain the HTTP headers from the backend. 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 *hit_for_pass* Similar to pass, but accessible from vcl_fetch. Unlike pass, hit_for_pass will create a hitforpass object in the cache. This has the side-effect of caching the decision not to cache. This is to allow would-be uncachable requests to be passed to the backend at the same time. The same logic is not necessary in vcl_recv because this happens before any potential queueing for an object takes place. *lookup* When you return lookup from vcl_recv you tell Varnish to deliver content from cache even if the request othervise indicates that the request should be passed. You can't return lookup from vcl_fetch. *pipe* 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. Beware that with HTTP 1.1 a client can send several requests on the same connection and so you should instruct Varnish to add a "Connection: close" header before actually returning pipe. *deliver* Deliver the cached object to the client. Usually returned from vcl_fetch. Requests, responses and objects ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In VCL, there are three important data structures. The request, coming from the client, the response coming from the backend server and the object, stored in cache. In VCL you should know the following structures. *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. *beresp* The backend respons object. It contains the headers of the object comming from the backend. Most of the work you do in vcl_fetch you do on the beresp object. *obj* The cached object. Mostly a read only object that resides in memory. obj.ttl is writable, the rest is read only. 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* Example 1 - manipulating headers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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). Example 2 - manipulating beresp ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Here we override the TTL of a object comming from the backend if it matches certain criteria:: sub vcl_fetch { if (req.url ~ "\.(png|gif|jpg)$") { unset beresp.http.set-cookie; set beresp.ttl = 1h; } } Example 3 - 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.request == "PURGE") { if (client.ip ~ local) { return(lookup); } } } sub vcl_hit { if (req.request == "PURGE") { set obj.ttl = 0s; error 200 "Purged."; } } sub vcl_miss { if (req.request == "PURGE") { error 404 "Not in cache."; } } varnish-3.0.5/doc/sphinx/tutorial/advanced_backend_servers.rst0000644000175000017500000001005312247035455021560 00000000000000Advanced Backend configuration ------------------------------ 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 a 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 where to send the difference URL. Lets look at vcl_recv.:: sub vcl_recv { if (req.url ~ "^/java/") { set req.backend = java; } else { set req.backend = 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.User-agent ~ /mobile/) .... should do the trick. .. _tutorial-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.:: backend server1 { .host = "192.168.0.10"; } backend server2{ .host = "192.168.0.10"; } Now we create the director.:: director example_director round-robin { { .backend = server1; } # server2 { .backend = server2; } # foo } 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. 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. .. _tutorial-advanced_backend_servers-health: Health checks ------------- Lets set up a director with two backends and health checks. First lets define the backends.:: backend server1 { .host = "server1.example.com"; .probe = { .url = "/"; .interval = 5s; .timeout = 1 s; .window = 5; .threshold = 3; } } backend server2 { .host = "server2.example.com"; .probe = { .url = "/"; .interval = 5s; .timeout = 1 s; .window = 5; .threshold = 3; } } Whats new here is the probe. Varnish will check the health of each backend with a probe. The options are url What URL should varnish request. interval How often should we poll timeout What is the timeout of the probe window Varnish will maintain a *sliding window* of the results. Here the window has five checks. threshold How many of the .window last polls must be good for the backend to be declared healthy. initial How many of the of the probes a good when Varnish starts - defaults to the same amount as the threshold. Now we define the director.:: director example_director round-robin { { .backend = server1; } # server2 { .backend = server2; } } You use this director just as you would use any other director or 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:`tutorial-handling_misbehaving_servers` for more information on how to enable this. Please note that Varnish will keep probes active 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. varnish-3.0.5/doc/sphinx/tutorial/esi.rst0000644000175000017500000000467412247035455015367 00000000000000.. _tutorial-esi: Edge Side Includes ------------------ *Edge Side Includes* is a language to include *fragments* of web pages in other web pages. Think of it as HTML include statement that works over HTTP. On most web sites a lot of content is shared between pages. Regenerating this content for every page view is wasteful and ESI tries to address that letting you decide the cache policy for each fragment individually. In Varnish we've only implemented a small subset of ESI. As of 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. 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_fetch { if (req.url == "/test.html") { set beresp.do_esi = true; /* Do ESI processing */ set beresp.ttl = 24 h; /* Sets the TTL on the HTML above */ } elseif (req.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, becoming an 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 varnish-3.0.5/doc/sphinx/tutorial/troubleshooting.rst0000644000175000017500000000713512247035455020031 00000000000000Troubleshooting Varnish ----------------------- Sometimes Varnish misbehaves. In order for you to understand whats going on there are a couple of places you can check. varnishlog, /var/log/syslog, /var/log/messages are all places where varnish might leave clues of whats going on. When Varnish won't start ~~~~~~~~~~~~~~~~~~~~~~~~ Sometimes Varnish wont start. There is a plethora of 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 option. It will give you some more information on what is going on. Let us see how Varnish will react to something else 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. 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 ~~~~~~~~~~~~~~~~~~~ When varnish goes bust the child processes crashes. Usually the mother process will manage this by restarting the child process again. Any errors will be logged in syslog. It might look like this:: Mar 8 13:23:38 smoke varnishd[15670]: Child (15671) not responding to CLI, killing it. Mar 8 13:23:43 smoke varnishd[15670]: last message repeated 2 times Mar 8 13:23:43 smoke varnishd[15670]: Child (15671) died signal=3 Mar 8 13:23:43 smoke varnishd[15670]: Child cleanup complete Mar 8 13:23:43 smoke varnishd[15670]: child (15697) Started Specifically if you see the "Error in munmap" error on Linux you might want to increase the amount of maps available. Linux is limited to a maximum of 64k maps. Setting vm.max_map_count in sysctl.conf will enable you to increase this limit. You can inspect the number of maps your program is consuming by counting the lines in /proc/$PID/maps This is a rather odd thing to document here - but hopefully Google will serve you this page if you ever encounter this error. Varnish gives me Guru meditation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ First find the relevant log entries in varnishlog. That will probably give you a clue. Since varnishlog logs so much 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 -c -m TxStatus:503 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 option:: $ varnishlog -d -c -m TxStatus:503 Please see the varnishlog man page for elaborations on further filtering capabilities and explanation of the various options. Varnish doesn't cache ~~~~~~~~~~~~~~~~~~~~~ See :ref:`tutorial-increasing_your_hitrate`. varnish-3.0.5/doc/sphinx/tutorial/putting_varnish_on_port_80.rst0000644000175000017500000000152212247035455022067 00000000000000 Put Varnish on port 80 ---------------------- Until now we've been running with Varnish on a high port, for testing purposes. You should test your application and if it works OK we can switch, so Varnish will be running on port 80 and your web server on a high port. First we kill off varnishd:: # pkill varnishd and stop your web server. Edit the configuration for your web server and make it bind to port 8080 instead of 80. Now open the Varnish default.vcl and change the port of the *default* backend to 8080. Start up your web server and then start varnish:: # varnishd -f /usr/local/etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1:2000 Note that we've removed the -a option. Now Varnish, as its default setting dictates, will bind to the http port (80). Now everyone accessing your site will be accessing through Varnish. varnish-3.0.5/doc/sphinx/installation/0000755000175000017500000000000012247037210014747 500000000000000varnish-3.0.5/doc/sphinx/installation/help.rst0000644000175000017500000000667712234401732016371 00000000000000%%%%%%%%%%%%%%%%%% Getting hold of us %%%%%%%%%%%%%%%%%% Getting hold of the gang behind Varnish is pretty straight forward, we try to help as much as time permits and have tried to streamline this process as much as possible. But before you grab hold of us, spend a moment composing your thoughts and formulate your question, there is nothing as pointless as simply telling us "Varnish does not work for me" with no further information to give any clue to why. And before you even do that, do a couple of searches to see if your question is already answered, if it has been, you will get your answer much faster that way. IRC Channel =========== The most immediate way to get hold of us, is to join our IRC channel: ``#varnish on server irc.linpro.no`` The main timezone of the channel is Europe+America. If you can explain your problem in a few clear sentences, without too much copy&paste, IRC is a good way to try to get help. If you do need to paste log files, VCL and so on, please use a pastebin_. If the channel is all quiet, try again some time later, we do have lives, families and jobs to deal with also. You are more than welcome to just hang out, and while we don't mind the occational intrusion of the real world into the flow, keep it mostly on topic, and dont paste random links unless they are *really* spectacular and intelligent. Mailing Lists ============= Getting on or off our mailinglist happens through MailMan_. If you are going to use Varnish, subscribing to our ``varnish-announce`` mailing list is probably a very good idea. The typical pattern is that people spend some time getting Varnish running, and then more or less forget about it. Therefore the announce list is a good way to be reminded about new releases, bad bugs or security holes. The ``varnish-misc`` mailing list is for general banter, questions, suggestions, ideas and so on. If you are new to Varnish it may pay off to subscribe to -misc, simply to have an ear to the telegraph-pole and learn some smart tricks. This is a good place to ask for help with more complex issues, that require quoting of files and 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. Trouble Tickets =============== Please do not open a trouble ticket, unless you have spotted an actual bug in Varnish. Ask on IRC first if you are in doubt. The reason for this policy, is to avoid the bugs being drowned in a pile of sensible suggestions for future enhancements and call for help from people who forget to check back if they get it and so on. We track suggestions and ideas in our `"Shopping-List" wiki page`_, and user support via email and IRC. Commercial Support ================== The following companies offer commercial Varnish support, and are listed here for your convenience. If you want your company listed here, drop an email to phk@FreeBSD.org. Varnish Software sales@varnish-software.com .. _Mailman: http://lists.varnish-cache.org/mailman/listinfo .. _pastebin: http://gist.github.com/ .. _"Shopping-List" wiki page: http://varnish-cache.org/wiki/PostTwoShoppingList varnish-3.0.5/doc/sphinx/installation/bugs.rst0000644000175000017500000001274012234401732016365 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. Roughly we have three clases of bugs with Varnish, and the information we need to debug them depends on the kind of bug. Varnish crashes =============== Plain and simple: **boom** Varnish is split over two processes, the manager and the child. The child does all the work, and the manager hangs around to resurect it, if it crashes. Therefore, the first thing to do if you see a varnish crash, is to examine your syslogs, to see if it has happened before. (One site is rumoured to have had varnish restarting every 10 minutes and *still* provide better service than their CMS system.) When it crashes, if at all possible, Varnish will spew out a crash dump that looks something like:: Child (32619) died signal=6 (core dumped) Child (32619) Panic message: Assert error in ccf_panic(), cache_cli.c line 153: Condition(!strcmp("", "You asked for it")) not true. errno = 9 (Bad file descriptor) thread = (cache-main) ident = FreeBSD,9.0-CURRENT,amd64,-sfile,-hcritbit,kqueue Backtrace: 0x42bce1: pan_ic+171 0x4196af: ccf_panic+4f 0x8006b3ef2: _end+80013339a 0x8006b4307: _end+8001337af 0x8006b8b76: _end+80013801e 0x8006b8d84: _end+80013822c 0x8006b51c1: _end+800134669 0x4193f6: CLI_Run+86 0x429f8b: child_main+14b 0x43ef68: start_child+3f8 [...] If you can get that information to us, we are usually able to see exactly where things went haywire, and that speeds up bugfixing a lot. There will be a lot more information than this, and before sending it all to us, you should obscure any sensitive/secret data/cookies/passwords/ip# etc. Please make sure to keep context when you do so, ie: do not change all the IP# to "X.X.X.X", but change each IP# to something unique, otherwise we are likely to be more confused than informed. The most important line is the "Panic Message", which comes in two general forms: "Missing errorhandling code in ..." This is a place where we can conceive ending up, and have not (yet) written the padded-box error handling code for. The most likely cause here, is that you need a larger workspace for HTTP headers and Cookies. (XXX: which params to tweak) Please try that before reporting a bug. "Assert error in ..." This is something bad that should never happen, and a bug report is almost certainly in order. As always, if in doubt ask us on IRC before opening the ticket. In your syslog it may all be joined into one single line, but if you can reproduce the crash, do so while running varnishd manually: ``varnishd -d |& tee /tmp/_catch_bug`` That will get you the entire panic message into a file. (Remember to type ``start`` to launch the worker process, that is not automatic when ``-d`` is used.) Varnish goes on vacation ======================== This kind of bug is nasty to debug, because usually people tend to kill the process and send us an email saying "Varnish hung, I restarted it" which gives us only about 1.01 bit of usable debug information to work with. What we need here is all the information can you squeeze out of your operating system **before** you kill the Varnish process. One of the most valuable bits of information, is if all Varnish' threads are waiting for something or if one of them is spinning furiously on some futile condition. Commands like ``top -H`` or ``ps -Haxlw`` or ``ps -efH`` should be able to figure that out. If one or more threads are spinning, use ``strace`` or ``ktrace`` or ``truss`` (or whatever else your OS provides) to get a trace of which system calls the varnish process issues. Be aware that this may generate a lot of very repetitive data, usually one second worth is more than enough. Also, run ``varnishlog`` for a second, and collect the output for us, and if ``varnishstat`` shows any activity, capture that also. When you have done this, kill the Varnish *child* process, and let the *master* process restart it. Remember to tell us if that does or does not work. If it does not, kill all Varnish processes, and start from scratch. If that does not work either, tell us, that means that we have wedged your kernel. Varnish does something wrong ============================ These are the easy bugs: usually all we need from you is the relevant transactions recorded with ``varnishlog`` and your explanation of what is wrong about what Varnish does. Be aware, that often Varnish does exactly what you asked it to, rather than what you intended it to do, so it sounds like a bug that would have tripped up everybody else, take a moment to read though your VCL and see if it really does what you think. You can also try setting the ``vcl_trace`` parameter, that will generate log records with like and char number for each statement executed in your VCL program. varnish-3.0.5/doc/sphinx/installation/install.rst0000644000175000017500000001034312247035455017101 00000000000000.. _install-doc: Installing Varnish ================== With open source software, you can choose to install binary packages or compile stuff from source-code. To install a package or compile from source is a matter of personal taste. If you don't know which method too choose read the whole document and choose the method you are most comfortable with. Source or packages? ~~~~~~~~~~~~~~~~~~~ Installing Varnish on most relevant operating systems can usually be done with with the systems package manager, typical examples being: FreeBSD ~~~~~~~ From source: ``cd /usr/ports/varnish && make install clean`` Binary package: ``pkg_add -r varnish`` CentOS/RedHat ~~~~~~~~~~~~~ We try to keep the latest version available as prebuilt RPMs (el5) on `repo.varnish-cache.org `. See the `RedHat installation instructions ` for more information. Varnish is included in the `EPEL `_ repository. Unfortunately we had a syntax change in Varnish 2.0.6->2.1.X. This means that we can not update Varnish in `EPEL 5 `_ so the latest version there is Varnish 2.0.6. EPEL6 should have Varnish 2.1 available once it releases. 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 installation instructions for `Debian ` or `Ubuntu `. Other systems ~~~~~~~~~~~~~ You are probably best of compiling your own code. See `Compiling Varnish from source`_. If that worked for you, you can skip the rest of this document for now, and and start reading the much more interesting :ref:`tutorial-index` instead. Compiling Varnish from source ============================= If there are no binary packages available for your system, or if you want to compile Varnish from source for other reasons, follow these steps: We recommend downloading a release tarball, which you can find on `repo.varnish-cache.org `. 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 Please note that a git checkout will need some more build-dependencies than listed below, in particular the Python Docutils and Sphinx. 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: * autotools-dev * automake1.9 * libtool * autoconf * libncurses-dev * xsltproc * groff-base * libpcre3-dev * pkg-config Build dependencies on Red Hat / CentOS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To build Varnish on a Red Hat or CentOS system you need the following packages installed: * automake * autoconf * libtool * ncurses-devel * libxslt * groff * pcre-devel * pkgconfig Configuring and compiling ~~~~~~~~~~~~~~~~~~~~~~~~~ Next, configuration: 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 are run time parameters. Before you install, you may want to run the regression tests, make a cup of tea while it runs, it takes some minutes:: make check Don't worry of a single or two tests fail, some of the tests are a bit too timing sensitive (Please tell us which so we can fix it) but if a lot of them fails, and in particular if the ``b00000.vtc`` test fails, something is horribly wrong, and you will get nowhere without figuring out what. Installing ~~~~~~~~~~ And finally, the true test of a brave heart:: make install Varnish will now be installed in /usr/local. The varnishd binary is in /usr/local/sbin/varnishd and its default configuration will be /usr/local/etc/varnish/default.vcl. You can now proceed to the :ref:`tutorial-index`. varnish-3.0.5/doc/sphinx/installation/index.rst0000644000175000017500000000057112247035455016544 00000000000000.. _install-index: %%%%%%%%%%%%%%%%%%%% Varnish Installation %%%%%%%%%%%%%%%%%%%% This document explains how to get Varnish onto your system, where to get help, how report bugs etc. In other words, it is a manual about pretty much everything else than actually using Varnish to move traffic. .. toctree:: prerequisites.rst install.rst help.rst bugs.rst upgrade.rst varnish-3.0.5/doc/sphinx/installation/upgrade.rst0000644000175000017500000001071512247035455017065 00000000000000%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Upgrading from Varnish 2.1 to 3.0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% This is a compilation of items you need to pay attention to when upgrading from Varnish 2.1 to 3.0 Changes to VCL ============== In most cases you need to update your VCL since there has been some changes to the syntax. string concatenation operator ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ String concatenation did not have an operator previously, but this has now been changed to ``+``. no more %-escapes in strings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To simplify strings, the %-encoding has been removed. If you need non-printable characters, you need to use inline C. ``log`` moved to the std vmod ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``log`` has moved to the std vmod:: log "log something"; becomes:: import std; std.log("log something"); You only need to import std once. purges are now called bans ~~~~~~~~~~~~~~~~~~~~~~~~~~ ``purge()`` and ``purge_url()`` are now respectively ``ban()`` and ``ban_url()``, so you should replace all occurences:: purge("req.url = " req.url); becomes:: ban("req.url = " + req.url); ``purge`` does not take any arguments anymore, but can be used in vcl_hit or vcl_miss to purge the item from the cache, where you would reduce ttl to 0 in Varnish 2.1:: sub vcl_hit { if (req.request == "PURGE") { set obj.ttl = 0s; error 200 "Purged."; } } becomes:: sub vcl_hit { if (req.request == "PURGE") { purge; error 200 "Purged."; } } ``beresp.cacheable`` and ``obj.cacheable`` are gone ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``beresp.cacheable`` is gone, and can be replaced with ``beresp.ttl > 0s``. Similarly ``obj.cacheable`` can be replaced with ``obj.ttl > 0s``. returns are now done with the ``return()`` function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``pass``, ``pipe``, ``lookup``, ``deliver``, ``fetch``, ``hash``, ``pipe`` and ``restart`` are no longer keywords, but arguments to ``return()``, so:: sub vcl_pass { pass; } becomes:: sub vcl_pass { return(pass); } ``req.hash`` is replaced with ``hash_data()`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You no longer append to the hash with ``+=``, so:: set req.hash += req.url; becomes:: hash_data(req.url); ``esi`` is replaced with ``beresp.do_esi`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You no longer enable ESI with ``esi``, so:: esi; in ``vcl_fetch`` becomes:: set beresp.do_esi = true; ``pass`` in ``vcl_fetch`` renamed to ``hit_for_pass`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The difference in behaviour of ``pass`` in ``vcl_recv`` and ``vcl_fetch`` confused people, so to make it clearer that they are different, you must now do ``return(hit_for_pass)`` when doing a pass in ``vcl_fetch``. Changes to runtime parameters ============================= Deleted parameters ~~~~~~~~~~~~~~~~~~ ``cache_vbe_conns`` and ``err_ttl`` has been removed. New parameters ~~~~~~~~~~~~~~ The following parameters have been added, see man varnishd for reference: * ``default_keep`` * ``expiry_sleep`` * ``fetch_maxchunksize`` * ``gzip_level`` * ``gzip_memlevel`` * ``gzip_stack_buffer`` * ``gzip_tmp_space`` * ``gzip_window`` * ``http_gzip_support`` * ``http_req_hdr_len`` * ``http_req_size`` * ``http_resp_hdr_len`` * ``http_resp_size`` * ``shortlived`` * ``thread_pool_workspace`` * ``vcc_err_unref`` * ``vcl_dir`` * ``vmod_dir`` Changed default values ~~~~~~~~~~~~~~~~~~~~~~ The following parameters have new defaults: * ``ban_lurker_sleep`` changed from 0 to 0.01 seconds, enabling the ban lurker by default. * ``connect_timeout`` changed from 0.4 to 0.7 seconds. * ``log_hashstring`` changed from off to on. * ``send_timeout`` changed from 600 to 60 seconds. * ``thread_pool_add_delay`` changed from 20 to 2 ms. Changed parameter names ~~~~~~~~~~~~~~~~~~~~~~~ The following parameters have new names: * ``http_headers`` has been renamed to ``http_max_hdr``. * ``max_esi_includes`` has been renamed to ``max_esi_depth``. * ``overflow_max`` has been renamed to ``queue_max``. * ``purge_dups`` has been renamed to ``ban_dups``. Changes to behaviour ==================== Varnish will return an error when headers are too large instead of just ignoring them. If the limits are too low, Varnish will return HTTP 413. You can change the limits by increasing http_req_hdr_len and http_req_size. thread_pool_max is now per thread pool, while it was a total across all pools in 2.1. If you had this set in 2.1, you should adjust it for 3.0. varnish-3.0.5/doc/sphinx/installation/prerequisites.rst0000644000175000017500000000072612247035455020343 00000000000000Prerequisites ============= In order for you to install Varnish you must have the following: * A fairly modern and 64 bit version of either - Linux - FreeBSD - Solaris * root access to said system Varnish can be installed on other UNIX systems as well, but it is not tested particularly well on these plattforms. Varnish is, from time to time, said to work on: * 32 bit versions of the before-mentioned systems. * OS X * NetBSD * OpenBSD varnish-3.0.5/doc/sphinx/=build/0000755000175000017500000000000012247037213013445 500000000000000varnish-3.0.5/doc/sphinx/=build/doctrees/0000755000175000017500000000000012247037213015255 500000000000000varnish-3.0.5/doc/sphinx/=build/doctrees/tutorial/0000755000175000017500000000000012247037213017120 500000000000000varnish-3.0.5/doc/sphinx/=build/doctrees/tutorial/devicedetection.doctree0000644000175000017500000007021512247037213023552 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(X+serve the different content on the same urlqNX&example 1: send http header to backendqNXtutorial-devicedetectqˆXdevice detectionq NXredirecting mobile clientsq NX*example 2: normalize the user-agent stringq NX8example 3: add the device class as a get query parameterq NX$different backend for mobile clientsq NuUsubstitution_defsq}qUparse_messagesq]q(cdocutils.nodes system_message q)q}q(U rawsourceqUUparentqcdocutils.nodes section q)q}q(hUhh)q}q(hUhh)q}q(hUhhUsourceqcdocutils.nodes reprunicode qX</home/tfheen/varnish/doc/sphinx/tutorial/devicedetection.rstq …q!}q"bUexpect_referenced_by_nameq#}q$hcdocutils.nodes target q%)q&}q'(hX.. _tutorial-devicedetect:hhhh!Utagnameq(Utargetq)U attributesq*}q+(Uidsq,]Ubackrefsq-]Udupnamesq.]Uclassesq/]Unamesq0]Urefidq1Ututorial-devicedetectq2uUlineq3KUdocumentq4hUchildrenq5]ubsh(Usectionq6h*}q7(h.]h/]h-]h,]q8(Udevice-detectionq9h2eh0]q:(h heuh3Kh4hUexpect_referenced_by_idq;}q)q?}q@(hXDevice detectionqAhhhh!h(UtitleqBh*}qC(h.]h/]h-]h,]h0]uh3Kh4hh5]qDcdocutils.nodes Text qEXDevice detectionqF…qG}qH(hhAhh?ubaubcdocutils.nodes paragraph qI)qJ}qK(hX€Device detection is figuring out what kind of content to serve to a client based on the User-Agent string supplied in a request.qLhhhh!h(U paragraphqMh*}qN(h.]h/]h-]h,]h0]uh3Kh4hh5]qOhEX€Device detection is figuring out what kind of content to serve to a client based on the User-Agent string supplied in a request.qP…qQ}qR(hhLhhJubaubhI)qS}qT(hXÃ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.qUhhhh!h(hMh*}qV(h.]h/]h-]h,]h0]uh3K h4hh5]qWhEXÃ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.qX…qY}qZ(hhUhhSubaubhI)q[}q\(hXâThere are a couple of strategies on what to do with such clients: 1) Redirect them to another URL. 2) Use a different backend for the special clients. 3) Change the backend requests so the usual backend sends tailored content.q]hhhh!h(hMh*}q^(h.]h/]h-]h,]h0]uh3K h4hh5]q_hEXâThere are a couple of strategies on what to do with such clients: 1) Redirect them to another URL. 2) Use a different backend for the special clients. 3) Change the backend requests so the usual backend sends tailored content.q`…qa}qb(hh]hh[ubaubhI)qc}qd(hX¶To make the examples easier to understand, it is assumed in this text that all the req.http.X-UA-Device header is present and unique per client class that content is to be served to.qehhhh!h(hMh*}qf(h.]h/]h-]h,]h0]uh3Kh4hh5]qghEX¶To make the examples easier to understand, it is assumed in this text that all the req.http.X-UA-Device header is present and unique per client class that content is to be served to.qh…qi}qj(hhehhcubaubhI)qk}ql(hX)Setting this header can be as simple as::qmhhhh!h(hMh*}qn(h.]h/]h-]h,]h0]uh3Kh4hh5]qohEX(Setting this header can be as simple as:qp…qq}qr(hX(Setting this header can be as simple as:hhkubaubcdocutils.nodes literal_block qs)qt}qu(hXxsub vcl_recv { if (req.http.User-Agent ~ "(?i)iphone" { set req.http.X-UA-Device = "mobile-iphone"; } }hhhh!h(U literal_blockqvh*}qw(U xml:spaceqxUpreserveqyh,]h-]h.]h/]h0]uh3Kh4hh5]qzhEXxsub vcl_recv { if (req.http.User-Agent ~ "(?i)iphone" { set req.http.X-UA-Device = "mobile-iphone"; } }q{…q|}q}(hUhhtubaubhI)q~}q(hXèThere are different commercial and free offerings in doing grouping and identifiying clients in further detail than this. For a basic and community based regular expression set, see https://github.com/varnish/varnish-devicedetect/ .hhhh!h(hMh*}q€(h.]h/]h-]h,]h0]uh3Kh4hh5]q(hEX¶There are different commercial and free offerings in doing grouping and identifiying clients in further detail than this. For a basic and community based regular expression set, see q‚…qƒ}q„(hX¶There are different commercial and free offerings in doing grouping and identifiying clients in further detail than this. For a basic and community based regular expression set, see hh~ubcdocutils.nodes reference q…)q†}q‡(hX0https://github.com/varnish/varnish-devicedetect/qˆh*}q‰(Urefurihˆh,]h-]h.]h/]h0]uhh~h5]qŠhEX0https://github.com/varnish/varnish-devicedetect/q‹…qŒ}q(hUhh†ubah(U referenceqŽubhEX .q…q}q‘(hX .hh~ubeubhh)q’}q“(hUhhhh!h(h6h*}q”(h.]h/]h-]h,]q•U$different-backend-for-mobile-clientsq–ah0]q—h auh3KÖh4hh5]q˜(h>)q™}qš(hX$Different backend for mobile clientsq›hh’hh!h(hBh*}qœ(h.]h/]h-]h,]h0]uh3KÖh4hh5]qhEX$Different backend for mobile clientsqž…qŸ}q (hh›hh™ubaubhI)q¡}q¢(hX‘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::hh’hh!h(hMh*}q£(h.]h/]h-]h,]h0]uh3KØh4hh5]q¤hEXIf 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:q¥…q¦}q§(hXIf 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:hh¡ubaubhs)q¨}q©(hXHbackend 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 = mobile; } } sub vcl_hash { if (req.http.X-UA-Device) { hash_data(req.http.X-UA-Device); } }hh’hh!h(hvh*}qª(hxhyh,]h-]h.]h/]h0]uh3KÛh4hh5]q«hEXHbackend 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 = mobile; } } sub vcl_hash { if (req.http.X-UA-Device) { hash_data(req.http.X-UA-Device); } }q¬…q­}q®(hUhh¨ubaubeubh)q¯}q°(hUhhhh!h(h6h*}q±(h.]h/]h-]h,]q²Uredirecting-mobile-clientsq³ah0]q´h auh3Kîh4hh5]qµ(h>)q¶}q·(hXRedirecting mobile clientsq¸hh¯hh!h(hBh*}q¹(h.]h/]h-]h,]h0]uh3Kîh4hh5]qºhEXRedirecting mobile clientsq»…q¼}q½(hh¸hh¶ubaubhI)q¾}q¿(hXIIf you want to redirect mobile clients you can use the following snippet.qÀhh¯hh!h(hMh*}qÁ(h.]h/]h-]h,]h0]uh3Kðh4hh5]qÂhEXIIf you want to redirect mobile clients you can use the following snippet.qÃ…qÄ}qÅ(hhÀhh¾ubaubcdocutils.nodes comment qÆ)qÇ}qÈ(hX065-redir-mobile-starthh¯hh!h(UcommentqÉh*}qÊ(hxhyh,]h-]h.]h/]h0]uh3Kòh4hh5]qËhEX065-redir-mobile-startqÌ…qÍ}qÎ(hUhhÇubaubhI)qÏ}qÐ(hXVCL::qÑhh¯hh!h(hMh*}qÒ(h.]h/]h-]h,]h0]uh3Kóh4hh5]qÓhEXVCL:qÔ…qÕ}qÖ(hXVCL:hhÏubaubhs)q×}qØ(hX^sub vcl_recv { # call some detection engine if (req.http.X-UA-Device ~ "^mobile" || req.http.X-UA-device ~ "^tablet") { error 750 "Moved Temporarily"; } } sub vcl_error { if (obj.status == 750) { set obj.http.Location = "http://m.example.com" + req.url; set obj.status = 302; return(deliver); } }hh¯hh!h(hvh*}qÙ(hxhyh,]h-]h.]h/]h0]uh3Kõh4hh5]qÚhEX^sub vcl_recv { # call some detection engine if (req.http.X-UA-Device ~ "^mobile" || req.http.X-UA-device ~ "^tablet") { error 750 "Moved Temporarily"; } } sub vcl_error { if (obj.status == 750) { set obj.http.Location = "http://m.example.com" + req.url; set obj.status = 302; return(deliver); } }qÛ…qÜ}qÝ(hUhh×ubaubhÆ)qÞ}qß(hX065-redir-mobile-endhh¯hh!h(hÉh*}qà(hxhyh,]h-]h.]h/]h0]uh3Mh4hh5]qáhEX065-redir-mobile-endqâ…qã}qä(hUhhÞubaubeubeubhh!h(h6h*}qå(h.]h/]h-]h,]qæU+serve-the-different-content-on-the-same-urlqçah0]qèhauh3K%h4hh5]qé(h>)qê}që(hX+Serve the different content on the same URLqìhhhh!h(hBh*}qí(h.]h/]h-]h,]h0]uh3K%h4hh5]qîhEX+Serve the different content on the same URLqï…qð}qñ(hhìhhêubaubhI)qò}qó(hXí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 what client class this is. 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.qôhhhh!h(hMh*}qõ(h.]h/]h-]h,]h0]uh3K'h4hh5]qöhEXí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 what client class this is. 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.q÷…qø}qù(hhôhhòubaubhI)qú}qû(hX[All this while still making sure that we only get 1 cached object per URL per device class.qühhhh!h(hMh*}qý(h.]h/]h-]h,]h0]uh3K2h4hh5]qþhEX[All this while still making sure that we only get 1 cached object per URL per device class.qÿ…r}r(hhühhúubaubhh)r}r(hUhhhh!h(h6h*}r(h.]h/]h-]h,]rU)example-2-normalize-the-user-agent-stringrah0]rh auh3Keh4hh5]r(h>)r }r (hX*Example 2: Normalize the User-Agent stringr hjhh!h(hBh*}r (h.]h/]h-]h,]h0]uh3Keh4hh5]r hEX*Example 2: Normalize the User-Agent stringr…r}r(hj hj ubaubhI)r}r(hXoAnother way of signaling the device type is to override or normalize the User-Agent header sent to the backend.rhjhh!h(hMh*}r(h.]h/]h-]h,]h0]uh3Kgh4hh5]rhEXoAnother way of signaling the device type is to override or normalize the User-Agent header sent to the backend.r…r}r(hjhjubaubhI)r}r(hX For examplerhjhh!h(hMh*}r(h.]h/]h-]h,]h0]uh3Kjh4hh5]rhEX For exampler…r}r (hjhjubaubcdocutils.nodes block_quote r!)r"}r#(hUhjhh!h(U block_quoter$h*}r%(h.]h/]h-]h,]h0]uh3Nh4hh5]r&hI)r'}r((hX”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.1r)hj"hh!h(hMh*}r*(h.]h/]h-]h,]h0]uh3Klh5]r+hEX”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.1r,…r-}r.(hj)hj'ubaubaubhI)r/}r0(hXbecomes:r1hjhh!h(hMh*}r2(h.]h/]h-]h,]h0]uh3Knh4hh5]r3hEXbecomes:r4…r5}r6(hj1hj/ubaubj!)r7}r8(hUhjhh!h(j$h*}r9(h.]h/]h-]h,]h0]uh3Nh4hh5]r:hI)r;}r<(hXUser-Agent: mobile-androidr=hj7hh!h(hMh*}r>(h.]h/]h-]h,]h0]uh3Kph5]r?hEXUser-Agent: mobile-androidr@…rA}rB(hj=hj;ubaubaubhI)rC}rD(hXwhen seen by the backend.rEhjhh!h(hMh*}rF(h.]h/]h-]h,]h0]uh3Krh4hh5]rGhEXwhen seen by the backend.rH…rI}rJ(hjEhjCubaubhI)rK}rL(hXÐ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.rMhjhh!h(hMh*}rN(h.]h/]h-]h,]h0]uh3Kth4hh5]rOhEXÐ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.rP…rQ}rR(hjMhjKubaubhÆ)rS}rT(hX072-example2-starthjhh!h(hÉh*}rU(hxhyh,]h-]h.]h/]h0]uh3Kxh4hh5]rVhEX072-example2-startrW…rX}rY(hUhjSubaubhI)rZ}r[(hXVCL::r\hjhh!h(hMh*}r](h.]h/]h-]h,]h0]uh3Kyh4hh5]r^hEXVCL:r_…r`}ra(hXVCL:hjZubaubhs)rb}rc(hX•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 bereq.http.User-Agent = req.http.X-UA-Device; } } sub vcl_pass { if (req.http.X-UA-Device) { set bereq.http.User-Agent = req.http.X-UA-Device; } } # standard Vary handling code from previous examples. sub vcl_fetch { if (req.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 = req.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"); } }hjhh!h(hvh*}rd(hxhyh,]h-]h.]h/]h0]uh3K{h4hh5]rehEX•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 bereq.http.User-Agent = req.http.X-UA-Device; } } sub vcl_pass { if (req.http.X-UA-Device) { set bereq.http.User-Agent = req.http.X-UA-Device; } } # standard Vary handling code from previous examples. sub vcl_fetch { if (req.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 = req.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"); } }rf…rg}rh(hUhjbubaubhÆ)ri}rj(hX072-example2-endhjhh!h(hÉh*}rk(hxhyh,]h-]h.]h/]h0]uh3K•h4hh5]rlhEX072-example2-endrm…rn}ro(hUhjiubaubeubh)rp}rq(hUhhhh!h(h6h*}rr(h.]h/]h-]h,]rsU7example-3-add-the-device-class-as-a-get-query-parameterrtah0]ruh auh3K—h4hh5]rv(h>)rw}rx(hX8Example 3: Add the device class as a GET query parameterryhjphh!h(hBh*}rz(h.]h/]h-]h,]h0]uh3K—h4hh5]r{hEX8Example 3: Add the device class as a GET query parameterr|…r}}r~(hjyhjwubaubhI)r}r€(hXHIf everything else fails, you can add the device type as a GET argument.rhjphh!h(hMh*}r‚(h.]h/]h-]h,]h0]uh3K™h4hh5]rƒhEXHIf everything else fails, you can add the device type as a GET argument.r„…r…}r†(hjhjubaubj!)r‡}rˆ(hUhjphh!h(j$h*}r‰(h.]h/]h-]h,]h0]uh3Nh4hh5]rŠhI)r‹}rŒ(hXfhttp://example.com/article/1234.html --> http://example.com/article/1234.html?devicetype=mobile-iphonerhj‡hh!h(hMh*}rŽ(h.]h/]h-]h,]h0]uh3K›h5]r(h…)r}r‘(hX$http://example.com/article/1234.htmlr’h*}r“(Urefurij’h,]h-]h.]h/]h0]uhj‹h5]r”hEX$http://example.com/article/1234.htmlr•…r–}r—(hUhjubah(hŽubhEX --> r˜…r™}rš(hX --> hj‹ubh…)r›}rœ(hX=http://example.com/article/1234.html?devicetype=mobile-iphonerh*}rž(Urefurijh,]h-]h.]h/]h0]uhj‹h5]rŸhEX=http://example.com/article/1234.html?devicetype=mobile-iphoner …r¡}r¢(hUhj›ubah(hŽubeubaubhI)r£}r¤(hXXThe client itself does not see this classification, only the backend request is changed.r¥hjphh!h(hMh*}r¦(h.]h/]h-]h,]h0]uh3Kh4hh5]r§hEXXThe client itself does not see this classification, only the backend request is changed.r¨…r©}rª(hj¥hj£ubaubhÆ)r«}r¬(hX073-example3-starthjphh!h(hÉh*}r­(hxhyh,]h-]h.]h/]h0]uh3K h4hh5]r®hEX073-example3-startr¯…r°}r±(hUhj«ubaubhI)r²}r³(hXVCL::r´hjphh!h(hMh*}rµ(h.]h/]h-]h,]h0]uh3K¡h4hh5]r¶hEXVCL:r·…r¸}r¹(hXVCL:hj²ubaubhs)rº}r»(hXðsub vcl_recv { # call some detection engine that set req.http.X-UA-Device } sub append_ua { if ((req.http.X-UA-Device) && (req.request == "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_fetch { if (req.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 = req.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"); } }hjphh!h(hvh*}r¼(hxhyh,]h-]h.]h/]h0]uh3K£h4hh5]r½hEXðsub vcl_recv { # call some detection engine that set req.http.X-UA-Device } sub append_ua { if ((req.http.X-UA-Device) && (req.request == "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_fetch { if (req.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 = req.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"); } }r¾…r¿}rÀ(hUhjºubaubhÆ)rÁ}rÂ(hX073-example3-endhjphh!h(hÉh*}rÃ(hxhyh,]h-]h.]h/]h0]uh3KÔh4hh5]rÄhEX073-example3-endrÅ…rÆ}rÇ(hUhjÁubaubeubeubhh!h(h6h*}rÈ(h.]h/]h-]h,]rÉU%example-1-send-http-header-to-backendrÊah0]rËhauh3K7h4hh5]rÌ(h>)rÍ}rÎ(hX&Example 1: Send HTTP header to backendrÏhhhh!h(hBh*}rÐ(h.]h/]h-]h,]h0]uh3K7h4hh5]rÑhEX&Example 1: Send HTTP header to backendrÒ…rÓ}rÔ(hjÏhjÍubaubhI)rÕ}rÖ(hX»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.r×hhhh!h(hMh*}rØ(h.]h/]h-]h,]h0]uh3K9h4hh5]rÙhEX»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.rÚ…rÛ}rÜ(hj×hjÕubaubhI)rÝ}rÞ(hX:Everything works out of the box from Varnish' perspective.rßhhhh!h(hMh*}rà(h.]h/]h-]h,]h0]uh3K=h4hh5]ráhEX:Everything works out of the box from Varnish' perspective.râ…rã}rä(hjßhjÝubaubhÆ)rå}ræ(hX071-example1-starthhhh!h(hÉh*}rç(hxhyh,]h-]h.]h/]h0]uh3K?h4hh5]rèhEX071-example1-startré…rê}rë(hUhjåubaubhI)rì}rí(hXVCL::rîhhhh!h(hMh*}rï(h.]h/]h-]h,]h0]uh3K@h4hh5]rðhEXVCL:rñ…rò}ró(hXVCL:hjìubaubhs)rô}rõ(hX>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 conterintuitive. 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_fetch { if (req.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 = req.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"); } }hhhh!h(hvh*}rö(hxhyh,]h-]h.]h/]h0]uh3KBh4hh5]r÷hEX>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 conterintuitive. 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_fetch { if (req.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 = req.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"); } }rø…rù}rú(hUhjôubaubhÆ)rû}rü(hX071-example1-endhhhh!h(hÉh*}rý(hxhyh,]h-]h.]h/]h0]uh3Kch4hh5]rþhEX071-example1-endrÿ…r}r(hUhjûubaubeubhh!h(Usystem_messagerh*}r(h.]UlevelKh,]h-]Usourceh!h/]h0]UlineK@UtypeUWARNINGruh3K?h4hh5]rhI)r}r(hUh*}r(h.]h/]h-]h,]h0]uhhh5]r hEX?Explicit markup ends without a blank line; unexpected unindent.r …r }r (hUhjubah(hMubaubh)r }r(hUhhhh!h(jh*}r(h.]UlevelKh,]h-]Usourceh!h/]h0]UlineKbUtypejuh3Kah4hh5]rhI)r}r(hUh*}r(h.]h/]h-]h,]h0]uhj h5]rhEX=Literal block ends without a blank line; unexpected unindent.r…r}r(hUhjubah(hMubaubh)r}r(hUhjhh!h(jh*}r(h.]UlevelKh,]h-]Usourceh!h/]h0]UlineKyUtypejuh3Kxh4hh5]rhI)r}r(hUh*}r(h.]h/]h-]h,]h0]uhjh5]rhEX?Explicit markup ends without a blank line; unexpected unindent.r …r!}r"(hUhjubah(hMubaubh)r#}r$(hUhjphh!h(jh*}r%(h.]UlevelKh,]h-]Usourceh!h/]h0]UlineK¡Utypejuh3K h4hh5]r&hI)r'}r((hUh*}r)(h.]h/]h-]h,]h0]uhj#h5]r*hEX?Explicit markup ends without a blank line; unexpected unindent.r+…r,}r-(hUhj'ubah(hMubaubh)r.}r/(hUhh¯hh!h(jh*}r0(h.]UlevelKh,]h-]Usourceh!h/]h0]UlineKóUtypejuh3Kòh4hh5]r1hI)r2}r3(hUh*}r4(h.]h/]h-]h,]h0]uhj.h5]r5hEX?Explicit markup ends without a blank line; unexpected unindent.r6…r7}r8(hUhj2ubah(hMubaubeUcurrent_sourcer9NU decorationr:NUautofootnote_startr;KUnameidsr<}r=(hhçhjÊhh2h h9h h³h jh jth h–uh5]r>(h&hehUU transformerr?NU footnote_refsr@}rAUrefnamesrB}rCUsymbol_footnotesrD]rEUautofootnote_refsrF]rGUsymbol_footnote_refsrH]rIU citationsrJ]rKh4hU current_linerLNUtransform_messagesrM]rNh)rO}rP(hUh*}rQ(h.]UlevelKh,]h-]Usourceh!h/]h0]UlineKUtypeUINFOrRuh5]rShI)rT}rU(hUh*}rV(h.]h/]h-]h,]h0]uhjOh5]rWhEX;Hyperlink target "tutorial-devicedetect" is not referenced.rX…rY}rZ(hUhjTubah(hMubah(jubaUreporterr[NUid_startr\KU autofootnotesr]]r^U citation_refsr_}r`Uindirect_targetsra]rbUsettingsrc(cdocutils.frontend Values rdore}rf(Ufootnote_backlinksrgKUrecord_dependenciesrhNU rfc_base_urlriUhttp://tools.ietf.org/html/rjU tracebackrkˆUpep_referencesrlNUstrip_commentsrmNU toc_backlinksrnUentryroU language_coderpUenrqU datestamprrNU report_levelrsKU _destinationrtNU halt_levelruKU strip_classesrvNhBNUerror_encoding_error_handlerrwUbackslashreplacerxUdebugryNUembed_stylesheetrz‰Uoutput_encoding_error_handlerr{Ustrictr|U sectnum_xformr}KUdump_transformsr~NU docinfo_xformrKUwarning_streamr€NUpep_file_url_templaterUpep-%04dr‚Uexit_status_levelrƒKUconfigr„NUstrict_visitorr…NUcloak_email_addressesr†ˆUtrim_footnote_reference_spacer‡‰UenvrˆNUdump_pseudo_xmlr‰NUexpose_internalsrŠNUsectsubtitle_xformr‹‰U source_linkrŒNUrfc_referencesrNUoutput_encodingrŽUutf-8rU source_urlrNUinput_encodingr‘U utf-8-sigr’U_disable_configr“NU id_prefixr”UU tab_widthr•KUerror_encodingr–UUTF-8r—U_sourcer˜Uhauh,Kh-hh]q?(h/)q@}qA(hX2Transparent hugepages on Redhat Enterprise Linux 6qBhh:hhh!h3h#}qC(h%]h&]h']h(]h*]uh,Kh-hh]qDh6X2Transparent hugepages on Redhat Enterprise Linux 6qE…qF}qG(hhBhh@ubaubcdocutils.nodes paragraph qH)qI}qJ(hXwOn RHEL6 Transparent Hugepage kernel support is enabled by default. This is known to cause sporadic crashes of Varnish.qKhh:hhh!U paragraphqLh#}qM(h%]h&]h']h(]h*]uh,Kh-hh]qNh6XwOn RHEL6 Transparent Hugepage kernel support is enabled by default. This is known to cause sporadic crashes of Varnish.qO…qP}qQ(hhKhhIubaubhH)qR}qS(hXHIt is recommended to disable transparent hugepages on affected systems::qThh:hhh!hLh#}qU(h%]h&]h']h(]h*]uh,K h-hh]qVh6XGIt is recommended to disable transparent hugepages on affected systems:qW…qX}qY(hXGIt is recommended to disable transparent hugepages on affected systems:hhRubaubcdocutils.nodes literal_block qZ)q[}q\(hXC$ echo "never" > /sys/kernel/mm/redhat_transparent_hugepage/enabledhh:hhh!U literal_blockq]h#}q^(U xml:spaceq_Upreserveq`h(]h']h%]h&]h*]uh,K h-hh]qah6XC$ echo "never" > /sys/kernel/mm/redhat_transparent_hugepage/enabledqb…qc}qd(hUhh[ubaubhH)qe}qf(hXiOn Debian/Ubuntu systems running 3.2 kernels the default value is "madvise" and does not need to changed.qghh:hhh!hLh#}qh(h%]h&]h']h(]h*]uh,Kh-hh]qih6XiOn Debian/Ubuntu systems running 3.2 kernels the default value is "madvise" and does not need to changed.qj…qk}ql(hhghheubaubeubh)qm}qn(hUhhhhh!h"h#}qo(h%]h&]h']h(]qphah*]qqhauh,Kh-hh]qr(h/)qs}qt(hXOpenVZquhhmhhh!h3h#}qv(h%]h&]h']h(]h*]uh,Kh-hh]qwh6XOpenVZqx…qy}qz(hhuhhsubaubhH)q{}q|(hXÛ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.q}hhmhhh!hLh#}q~(h%]h&]h']h(]h*]uh,Kh-hh]qh6XÛ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.q€…q}q‚(hh}hh{ubaubhH)qƒ}q„(hXvIf you are running on 64bit OpenVZ (or Parallels VPS), you must reduce the maximum stack size before starting Varnish.q…hhmhhh!hLh#}q†(h%]h&]h']h(]h*]uh,Kh-hh]q‡h6XvIf you are running on 64bit OpenVZ (or Parallels VPS), you must reduce the maximum stack size before starting Varnish.qˆ…q‰}qŠ(hh…hhƒubaubhH)q‹}qŒ(hXƒThe default allocates to much memory per thread, which will make varnish fail as soon as the number of threads (traffic) increases.qhhmhhh!hLh#}qŽ(h%]h&]h']h(]h*]uh,Kh-hh]qh6XƒThe default allocates to much memory per thread, which will make varnish fail as soon as the number of threads (traffic) increases.q…q‘}q’(hhhh‹ubaubhH)q“}q”(hX*Reduce the maximum stack size by running::q•hhmhhh!hLh#}q–(h%]h&]h']h(]h*]uh,K h-hh]q—h6X)Reduce the maximum stack size by running:q˜…q™}qš(hX)Reduce the maximum stack size by running:hh“ubaubhZ)q›}qœ(hX ulimit -s 256hhmhhh!h]h#}q(h_h`h(]h']h%]h&]h*]uh,K"h-hh]qžh6X ulimit -s 256qŸ…q }q¡(hUhh›ubaubhH)q¢}q£(hXin the Varnish startup script.q¤hhmhhh!hLh#}q¥(h%]h&]h']h(]h*]uh,K$h-hh]q¦h6Xin the Varnish startup script.q§…q¨}q©(hh¤hh¢ubaubeubeubahUU transformerqªNU footnote_refsq«}q¬Urefnamesq­}q®Usymbol_footnotesq¯]q°Uautofootnote_refsq±]q²Usymbol_footnote_refsq³]q´U citationsqµ]q¶h-hU current_lineq·NUtransform_messagesq¸]q¹UreporterqºNUid_startq»KU autofootnotesq¼]q½U citation_refsq¾}q¿Uindirect_targetsqÀ]qÁUsettingsqÂ(cdocutils.frontend Values qÃoqÄ}qÅ(Ufootnote_backlinksqÆKUrecord_dependenciesqÇNU rfc_base_urlqÈUhttp://tools.ietf.org/html/qÉU tracebackqʈUpep_referencesqËNUstrip_commentsqÌNU toc_backlinksqÍUentryqÎU language_codeqÏUenqÐU datestampqÑNU report_levelqÒKU _destinationqÓNU halt_levelqÔKU strip_classesqÕNh3NUerror_encoding_error_handlerqÖUbackslashreplaceq×UdebugqØNUembed_stylesheetqÙ‰Uoutput_encoding_error_handlerqÚUstrictqÛU sectnum_xformqÜKUdump_transformsqÝNU docinfo_xformqÞKUwarning_streamqßNUpep_file_url_templateqàUpep-%04dqáUexit_status_levelqâKUconfigqãNUstrict_visitorqäNUcloak_email_addressesqåˆUtrim_footnote_reference_spaceqæ‰UenvqçNUdump_pseudo_xmlqèNUexpose_internalsqéNUsectsubtitle_xformqê‰U source_linkqëNUrfc_referencesqìNUoutput_encodingqíUutf-8qîU source_urlqïNUinput_encodingqðU utf-8-sigqñU_disable_configqòNU id_prefixqóUU tab_widthqôKUerror_encodingqõUUTF-8qöU_sourceq÷U:/home/tfheen/varnish/doc/sphinx/tutorial/platformnotes.rstqøUgettext_compactqùˆU generatorqúNUdump_internalsqûNU smart_quotesqü‰U pep_base_urlqýUhttp://www.python.org/dev/peps/qþUsyntax_highlightqÿUlongrUinput_encoding_error_handlerrhÛUauto_id_prefixrUidrUdoctitle_xformr‰Ustrip_elements_with_classesrNU _config_filesr]rUfile_insertion_enabledrKU raw_enabledr KU dump_settingsr NubUsymbol_footnote_startr KUidsr }r (hhhhmhh:uUsubstitution_namesr}rh!h-h#}r(h%]h(]h']Usourcehh&]h*]uU footnotesr]rUrefidsr}rub.varnish-3.0.5/doc/sphinx/=build/doctrees/tutorial/starting_varnish.doctree0000644000175000017500000003207012247037213023776 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(Xstarting varnishqNXtutorial-starting_varnishqˆuUsubstitution_defsq}q Uparse_messagesq ]q Ucurrent_sourceq NU decorationq NUautofootnote_startqKUnameidsq}q(hUstarting-varnishqhUtutorial-starting-varnishquUchildrenq]q(cdocutils.nodes target q)q}q(U rawsourceqX.. _tutorial-starting_varnish:UparentqhUsourceqcdocutils.nodes reprunicode qX=/home/tfheen/varnish/doc/sphinx/tutorial/starting_varnish.rstq…q}qbUtagnameqUtargetq U attributesq!}q"(Uidsq#]Ubackrefsq$]Udupnamesq%]Uclassesq&]Unamesq']Urefidq(huUlineq)KUdocumentq*hh]ubcdocutils.nodes section q+)q,}q-(hUhhhhUexpect_referenced_by_nameq.}q/hhshUsectionq0h!}q1(h%]h&]h$]h#]q2(hheh']q3(hheuh)Kh*hUexpect_referenced_by_idq4}q5hhsh]q6(cdocutils.nodes title q7)q8}q9(hXStarting Varnishq:hh,hhhUtitleq;h!}q<(h%]h&]h$]h#]h']uh)Kh*hh]q=cdocutils.nodes Text q>XStarting Varnishq?…q@}qA(hh:hh8ubaubcdocutils.nodes paragraph qB)qC}qD(hX†I assume varnishd is in your path. You might want to run ``pkill varnishd`` to make sure varnishd isn't running. Become root and type:hh,hhhU paragraphqEh!}qF(h%]h&]h$]h#]h']uh)Kh*hh]qG(h>X9I assume varnishd is in your path. You might want to run qH…qI}qJ(hX9I assume varnishd is in your path. You might want to run hhCubcdocutils.nodes literal qK)qL}qM(hX``pkill varnishd``h!}qN(h%]h&]h$]h#]h']uhhCh]qOh>Xpkill varnishdqP…qQ}qR(hUhhLubahUliteralqSubh>X; to make sure varnishd isn't running. Become root and type:qT…qU}qV(hX; to make sure varnishd isn't running. Become root and type:hhCubeubhB)qW}qX(hXc``# varnishd -f /usr/local/etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1:2000 -a 0.0.0.0:8080``qYhh,hhhhEh!}qZ(h%]h&]h$]h#]h']uh)K h*hh]q[hK)q\}q](hhYh!}q^(h%]h&]h$]h#]h']uhhWh]q_h>X_# varnishd -f /usr/local/etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1:2000 -a 0.0.0.0:8080q`…qa}qb(hUhh\ubahhSubaubhB)qc}qd(hX,I added a few options, lets go through them:qehh,hhhhEh!}qf(h%]h&]h$]h#]h']uh)K h*hh]qgh>X,I added a few options, lets go through them:qh…qi}qj(hhehhcubaubcdocutils.nodes definition_list qk)ql}qm(hUhh,hhhUdefinition_listqnh!}qo(h%]h&]h$]h#]h']uh)Nh*hh]qp(cdocutils.nodes definition_list_item qq)qr}qs(hXk``-f /usr/local/etc/varnish/default.vcl`` The -f options specifies what configuration varnishd should use. hhlhhhUdefinition_list_itemqth!}qu(h%]h&]h$]h#]h']uh)Kh]qv(cdocutils.nodes term qw)qx}qy(hX)``-f /usr/local/etc/varnish/default.vcl``qzhhrhhhUtermq{h!}q|(h%]h&]h$]h#]h']uh)Kh]q}hK)q~}q(hhzh!}q€(h%]h&]h$]h#]h']uhhxh]qh>X%-f /usr/local/etc/varnish/default.vclq‚…qƒ}q„(hUhh~ubahhSubaubcdocutils.nodes definition q…)q†}q‡(hUh!}qˆ(h%]h&]h$]h#]h']uhhrh]q‰hB)qŠ}q‹(hX@The -f options specifies what configuration varnishd should use.qŒhh†hhhhEh!}q(h%]h&]h$]h#]h']uh)Kh]qŽh>X@The -f options specifies what configuration varnishd should use.q…q}q‘(hhŒhhŠubaubahU definitionq’ubeubhq)q“}q”(hX*``-s malloc,1G`` The -s options chooses the storage type Varnish should use for storing its content. I used the type *malloc*, which just uses memory for storage. There are other backends as well, described in :ref:tutorial-storage. 1G specifies how much memory should be allocated - one gigabyte. hhlhhhhth!}q•(h%]h&]h$]h#]h']uh)Kh*hh]q–(hw)q—}q˜(hX``-s malloc,1G``q™hh“hhhh{h!}qš(h%]h&]h$]h#]h']uh)Kh]q›hK)qœ}q(hh™h!}qž(h%]h&]h$]h#]h']uhh—h]qŸh>X -s malloc,1Gq …q¡}q¢(hUhhœubahhSubaubh…)q£}q¤(hUh!}q¥(h%]h&]h$]h#]h']uhh“h]q¦hB)q§}q¨(hXThe -s options chooses the storage type Varnish should use for storing its content. I used the type *malloc*, which just uses memory for storage. There are other backends as well, described in :ref:tutorial-storage. 1G specifies how much memory should be allocated - one gigabyte.hh£hhhhEh!}q©(h%]h&]h$]h#]h']uh)Kh]qª(h>XdThe -s options chooses the storage type Varnish should use for storing its content. I used the type q«…q¬}q­(hXdThe -s options chooses the storage type Varnish should use for storing its content. I used the type hh§ubcdocutils.nodes emphasis q®)q¯}q°(hX*malloc*h!}q±(h%]h&]h$]h#]h']uhh§h]q²h>Xmallocq³…q´}qµ(hUhh¯ubahUemphasisq¶ubh>X¬, which just uses memory for storage. There are other backends as well, described in :ref:tutorial-storage. 1G specifies how much memory should be allocated - one gigabyte.q·…q¸}q¹(hX¬, which just uses memory for storage. There are other backends as well, described in :ref:tutorial-storage. 1G specifies how much memory should be allocated - one gigabyte.hh§ubeubahh’ubeubhq)qº}q»(hX``-T 127.0.0.1:2000`` Varnish has a built-in text-based administration interface. Activating the interface makes Varnish manageble without stopping it. You can specify what interface the management interface should listen to. Make sure you don't expose the management interface to the world as you can easily gain root access to a system via the Varnish management interface. I recommend tieing it to localhost. If you have users on your system that you don't fully trust, use firewall rules to restrict access to the interface to root only. hhlhhhhth!}q¼(h%]h&]h$]h#]h']uh)Kh*hh]q½(hw)q¾}q¿(hX``-T 127.0.0.1:2000``qÀhhºhhhh{h!}qÁ(h%]h&]h$]h#]h']uh)Kh]qÂhK)qÃ}qÄ(hhÀh!}qÅ(h%]h&]h$]h#]h']uhh¾h]qÆh>X-T 127.0.0.1:2000qÇ…qÈ}qÉ(hUhhÃubahhSubaubh…)qÊ}qË(hUh!}qÌ(h%]h&]h$]h#]h']uhhºh]qÍhB)qÎ}qÏ(hXVarnish has a built-in text-based administration interface. Activating the interface makes Varnish manageble without stopping it. You can specify what interface the management interface should listen to. Make sure you don't expose the management interface to the world as you can easily gain root access to a system via the Varnish management interface. I recommend tieing it to localhost. If you have users on your system that you don't fully trust, use firewall rules to restrict access to the interface to root only.qÐhhÊhhhhEh!}qÑ(h%]h&]h$]h#]h']uh)Kh]qÒh>XVarnish has a built-in text-based administration interface. Activating the interface makes Varnish manageble without stopping it. You can specify what interface the management interface should listen to. Make sure you don't expose the management interface to the world as you can easily gain root access to a system via the Varnish management interface. I recommend tieing it to localhost. If you have users on your system that you don't fully trust, use firewall rules to restrict access to the interface to root only.qÓ…qÔ}qÕ(hhÐhhÎubaubahh’ubeubhq)qÖ}q×(hXÌ``-a 0.0.0.0:8080`` I specify that I want Varnish to listen on port 8080 for incomming HTTP requests. For a production environment you would probably make Varnish listen on port 80, which is the default. hhlhhhhth!}qØ(h%]h&]h$]h#]h']uh)K$h*hh]qÙ(hw)qÚ}qÛ(hX``-a 0.0.0.0:8080``qÜhhÖhhhh{h!}qÝ(h%]h&]h$]h#]h']uh)K$h]qÞhK)qß}qà(hhÜh!}qá(h%]h&]h$]h#]h']uhhÚh]qâh>X-a 0.0.0.0:8080qã…qä}qå(hUhhßubahhSubaubh…)qæ}qç(hUh!}qè(h%]h&]h$]h#]h']uhhÖh]qéhB)qê}që(hX·I specify that I want Varnish to listen on port 8080 for incomming HTTP requests. For a production environment you would probably make Varnish listen on port 80, which is the default.qìhhæhhhhEh!}qí(h%]h&]h$]h#]h']uh)K"h]qîh>X·I specify that I want Varnish to listen on port 8080 for incomming HTTP requests. For a production environment you would probably make Varnish listen on port 80, which is the default.qï…qð}qñ(hhìhhêubaubahh’ubeubeubhB)qò}qó(hXýNow you have Varnish running. Let us make sure that it works properly. Use your browser to go to http://192.168.2.2:8080/ (obviously, you should replace the IP address with one on your own system) - you should now see your web application running there.hh,hhhhEh!}qô(h%]h&]h$]h#]h']uh)K&h*hh]qõ(h>XaNow you have Varnish running. Let us make sure that it works properly. Use your browser to go to qö…q÷}qø(hXaNow you have Varnish running. Let us make sure that it works properly. Use your browser to go to hhòubcdocutils.nodes reference qù)qú}qû(hXhttp://192.168.2.2:8080/qüh!}qý(Urefurihüh#]h$]h%]h&]h']uhhòh]qþh>Xhttp://192.168.2.2:8080/qÿ…r}r(hUhhúubahU referencerubh>X„ (obviously, you should replace the IP address with one on your own system) - you should now see your web application running there.r…r}r(hX„ (obviously, you should replace the IP address with one on your own system) - you should now see your web application running there.hhòubeubhB)r}r(hX—Whether or not the application actually goes faster when run through Varnish depends on a few factors. If you application uses cookies for every session (a lot of PHP and Java applications seem to send a session cookie if it is needed or not) or if it uses authentication chances are Varnish won't do much caching. Ignore that for the moment, we come back to that in :ref:`tutorial-increasing_your_hitrate`.hh,hhhhEh!}r(h%]h&]h$]h#]h']uh)K+h*hh]r (h>XoWhether or not the application actually goes faster when run through Varnish depends on a few factors. If you application uses cookies for every session (a lot of PHP and Java applications seem to send a session cookie if it is needed or not) or if it uses authentication chances are Varnish won't do much caching. Ignore that for the moment, we come back to that in r …r }r (hXoWhether or not the application actually goes faster when run through Varnish depends on a few factors. If you application uses cookies for every session (a lot of PHP and Java applications seem to send a session cookie if it is needed or not) or if it uses authentication chances are Varnish won't do much caching. Ignore that for the moment, we come back to that in hjubcsphinx.addnodes pending_xref r )r}r(hX':ref:`tutorial-increasing_your_hitrate`rhjhhhU pending_xrefrh!}r(UreftypeXrefUrefwarnrˆU reftargetrX tutorial-increasing_your_hitrateU refdomainXstdrh#]h$]U refexplicit‰h%]h&]h']UrefdocrUtutorial/starting_varnishruh)K+h]rh®)r}r(hjh!}r(h%]h&]r(UxrefrjXstd-refreh$]h#]h']uhjh]rh>X tutorial-increasing_your_hitrater …r!}r"(hUhjubahh¶ubaubh>X.…r#}r$(hX.hjubeubhB)r%}r&(hXpLets make sure that Varnish really does do something to your web site. To do that we'll take a look at the logs.r'hh,hhhhEh!}r((h%]h&]h$]h#]h']uh)K2h*hh]r)h>XpLets make sure that Varnish really does do something to your web site. To do that we'll take a look at the logs.r*…r+}r,(hj'hj%ubaubeubehUU transformerr-NU footnote_refsr.}r/Urefnamesr0}r1Usymbol_footnotesr2]r3Uautofootnote_refsr4]r5Usymbol_footnote_refsr6]r7U citationsr8]r9h*hU current_liner:NUtransform_messagesr;]r<cdocutils.nodes system_message r=)r>}r?(hUh!}r@(h%]UlevelKh#]h$]Usourcehh&]h']UlineKUtypeUINFOrAuh]rBhB)rC}rD(hUh!}rE(h%]h&]h$]h#]h']uhj>h]rFh>X?Hyperlink target "tutorial-starting-varnish" is not referenced.rG…rH}rI(hUhjCubahhEubahUsystem_messagerJubaUreporterrKNUid_startrLKU autofootnotesrM]rNU citation_refsrO}rPUindirect_targetsrQ]rRUsettingsrS(cdocutils.frontend Values rTorU}rV(Ufootnote_backlinksrWKUrecord_dependenciesrXNU rfc_base_urlrYUhttp://tools.ietf.org/html/rZU tracebackr[ˆUpep_referencesr\NUstrip_commentsr]NU toc_backlinksr^Uentryr_U language_coder`UenraU datestamprbNU report_levelrcKU _destinationrdNU halt_levelreKU strip_classesrfNh;NUerror_encoding_error_handlerrgUbackslashreplacerhUdebugriNUembed_stylesheetrj‰Uoutput_encoding_error_handlerrkUstrictrlU sectnum_xformrmKUdump_transformsrnNU docinfo_xformroKUwarning_streamrpNUpep_file_url_templaterqUpep-%04drrUexit_status_levelrsKUconfigrtNUstrict_visitorruNUcloak_email_addressesrvˆUtrim_footnote_reference_spacerw‰UenvrxNUdump_pseudo_xmlryNUexpose_internalsrzNUsectsubtitle_xformr{‰U source_linkr|NUrfc_referencesr}NUoutput_encodingr~Uutf-8rU source_urlr€NUinput_encodingrU utf-8-sigr‚U_disable_configrƒNU id_prefixr„UU tab_widthr…KUerror_encodingr†UUTF-8r‡U_sourcerˆU=/home/tfheen/varnish/doc/sphinx/tutorial/starting_varnish.rstr‰Ugettext_compactrŠˆU generatorr‹NUdump_internalsrŒNU smart_quotesr‰U pep_base_urlrŽUhttp://www.python.org/dev/peps/rUsyntax_highlightrUlongr‘Uinput_encoding_error_handlerr’jlUauto_id_prefixr“Uidr”Udoctitle_xformr•‰Ustrip_elements_with_classesr–NU _config_filesr—]Ufile_insertion_enabledr˜KU raw_enabledr™KU dump_settingsršNubUsymbol_footnote_startr›KUidsrœ}r(hh,hh,uUsubstitution_namesrž}rŸhh*h!}r (h%]h#]h$]Usourcehh&]h']uU footnotesr¡]r¢Urefidsr£}r¤h]r¥hasub.varnish-3.0.5/doc/sphinx/=build/doctrees/tutorial/vcl.doctree0000644000175000017500000007473712247037213021215 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(Xexample 3 - aclsqNX$varnish configuration language - vclqNXrequests, responses and objectsqNX vcl_fetchq NXexample 2 - manipulating berespq NX example 1 - manipulating headersq NX operatorsq NXactionsq NXvcl_recvqNuUsubstitution_defsq}qUparse_messagesq]q(cdocutils.nodes system_message q)q}q(U rawsourceqUUparentqcdocutils.nodes section q)q}q(hUhh)q}q(hUhhUsourceqcdocutils.nodes reprunicode qX0/home/tfheen/varnish/doc/sphinx/tutorial/vcl.rstq…q }q!bUtagnameq"Usectionq#U attributesq$}q%(Udupnamesq&]Uclassesq']Ubackrefsq(]Uidsq)]q*U"varnish-configuration-language-vclq+aUnamesq,]q-hauUlineq.KUdocumentq/hUchildrenq0]q1(cdocutils.nodes title q2)q3}q4(hX$Varnish Configuration Language - VCLq5hhhh h"Utitleq6h$}q7(h&]h']h(]h)]h,]uh.Kh/hh0]q8cdocutils.nodes Text q9X$Varnish Configuration Language - VCLq:…q;}q<(hh5hh3ubaubcdocutils.nodes paragraph q=)q>}q?(hXUVarnish has a great configuration system. Most other systems use configuration directives, where you basically turn on and off lots of switches. Varnish uses a domain specific language called Varnish Configuration Language, or VCL for short. Varnish translates this configuration into binary code which is then executed when requests arrive.q@hhhh h"U paragraphqAh$}qB(h&]h']h(]h)]h,]uh.Kh/hh0]qCh9XUVarnish has a great configuration system. Most other systems use configuration directives, where you basically turn on and off lots of switches. Varnish uses a domain specific language called Varnish Configuration Language, or VCL for short. Varnish translates this configuration into binary code which is then executed when requests arrive.qD…qE}qF(hh@hh>ubaubh=)qG}qH(hXÇThe VCL files are divided 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.qIhhhh h"hAh$}qJ(h&]h']h(]h)]h,]uh.K h/hh0]qKh9XÇThe VCL files are divided 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.qL…qM}qN(hhIhhGubaubh=)qO}qP(hXýVarnish will execute these subroutines of code at different stages of its work. Because it is code it is execute line by line precedence isn't a problem. At some point you call an action in this subroutine and then the execution of the subroutine stops.qQhhhh h"hAh$}qR(h&]h']h(]h)]h,]uh.Kh/hh0]qSh9XýVarnish will execute these subroutines of code at different stages of its work. Because it is code it is execute line by line precedence isn't a problem. At some point you call an action in this subroutine and then the execution of the subroutine stops.qT…qU}qV(hhQhhOubaubh=)qW}qX(hX«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 default.vcl.qYhhhh h"hAh$}qZ(h&]h']h(]h)]h,]uh.Kh/hh0]q[h9X«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 default.vcl.q\…q]}q^(hhYhhWubaubh=)q_}q`(hXn99% of all the changes you'll need to do will be done in two of these subroutines. *vcl_recv* and *vcl_fetch*.hhhh h"hAh$}qa(h&]h']h(]h)]h,]uh.Kh/hh0]qb(h9XS99% of all the changes you'll need to do will be done in two of these subroutines. qc…qd}qe(hXS99% of all the changes you'll need to do will be done in two of these subroutines. hh_ubcdocutils.nodes emphasis qf)qg}qh(hX *vcl_recv*h$}qi(h&]h']h(]h)]h,]uhh_h0]qjh9Xvcl_recvqk…ql}qm(hUhhgubah"Uemphasisqnubh9X and qo…qp}qq(hX and hh_ubhf)qr}qs(hX *vcl_fetch*h$}qt(h&]h']h(]h)]h,]uhh_h0]quh9X vcl_fetchqv…qw}qx(hUhhrubah"hnubh9X.…qy}qz(hX.hh_ubeubh)q{}q|(hUhhhh h"h#h$}q}(h&]h']h(]h)]q~Uvcl-recvqah,]q€hauh.Kh/hh0]q(h2)q‚}qƒ(hXvcl_recvq„hh{hh h"h6h$}q…(h&]h']h(]h)]h,]uh.Kh/hh0]q†h9Xvcl_recvq‡…qˆ}q‰(hh„hh‚ubaubh=)qŠ}q‹(hXvcl_recv (yes, we're skimpy with characters, it's Unix) is called at the beginning of a request, after the complete request has been received and parsed. Its purpose is to decide whether or not to serve the request, how to do it, and, if applicable, which backend to use.qŒhh{hh h"hAh$}q(h&]h']h(]h)]h,]uh.Kh/hh0]qŽh9Xvcl_recv (yes, we're skimpy with characters, it's Unix) is called at the beginning of a request, after the complete request has been received and parsed. Its purpose is to decide whether or not to serve the request, how to do it, and, if applicable, which backend to use.q…q}q‘(hhŒhhŠubaubh=)q’}q“(hXsIn vcl_recv you can also alter the request. Typically you can alter the cookies and add and remove request headers.q”hh{hh h"hAh$}q•(h&]h']h(]h)]h,]uh.K#h/hh0]q–h9XsIn vcl_recv you can also alter the request. Typically you can alter the cookies and add and remove request headers.q—…q˜}q™(hh”hh’ubaubh=)qš}q›(hX@Note that in vcl_recv only the request object, req is available.qœhh{hh h"hAh$}q(h&]h']h(]h)]h,]uh.K&h/hh0]qžh9X@Note that in vcl_recv only the request object, req is available.qŸ…q }q¡(hhœhhšubaubeubh)q¢}q£(hUhhhh h"h#h$}q¤(h&]h']h(]h)]q¥U vcl-fetchq¦ah,]q§h auh.K)h/hh0]q¨(h2)q©}qª(hX vcl_fetchq«hh¢hh h"h6h$}q¬(h&]h']h(]h)]h,]uh.K)h/hh0]q­h9X vcl_fetchq®…q¯}q°(hh«hh©ubaubh=)q±}q²(hXÞvcl_fetch is called *after* a document has been successfully retrieved from the backend. Normal tasks her are to alter the response headers, trigger ESI processing, try alternate backend servers in case the request failed.hh¢hh h"hAh$}q³(h&]h']h(]h)]h,]uh.K+h/hh0]q´(h9Xvcl_fetch is called qµ…q¶}q·(hXvcl_fetch is called hh±ubhf)q¸}q¹(hX*after*h$}qº(h&]h']h(]h)]h,]uhh±h0]q»h9Xafterq¼…q½}q¾(hUhh¸ubah"hnubh9Xà a document has been successfully retrieved from the backend. Normal tasks her are to alter the response headers, trigger ESI processing, try alternate backend servers in case the request failed.q¿…qÀ}qÁ(hXà a document has been successfully retrieved from the backend. Normal tasks her are to alter the response headers, trigger ESI processing, try alternate backend servers in case the request failed.hh±ubeubh=)qÂ}qÃ(hX¢In vcl_fetch you still have the request object, req, available. There is also a *backend response*, beresp. beresp will contain the HTTP headers from the backend.hh¢hh h"hAh$}qÄ(h&]h']h(]h)]h,]uh.K0h/hh0]qÅ(h9XPIn vcl_fetch you still have the request object, req, available. There is also a qÆ…qÇ}qÈ(hXPIn vcl_fetch you still have the request object, req, available. There is also a hhÂubhf)qÉ}qÊ(hX*backend response*h$}qË(h&]h']h(]h)]h,]uhhÂh0]qÌh9Xbackend responseqÍ…qÎ}qÏ(hUhhÉubah"hnubh9X@, beresp. beresp will contain the HTTP headers from the backend.qÐ…qÑ}qÒ(hX@, beresp. beresp will contain the HTTP headers from the backend.hhÂubeubeubh)qÓ}qÔ(hUhhhh h"h#h$}qÕ(h&]h']h(]h)]qÖUactionsq×ah,]qØh auh.K6h/hh0]qÙ(h2)qÚ}qÛ(hXactionsqÜhhÓhh h"h6h$}qÝ(h&]h']h(]h)]h,]uh.K6h/hh0]qÞh9Xactionsqß…qà}qá(hhÜhhÚubaubh=)qâ}qã(hX,The most common actions to return are these:qähhÓhh h"hAh$}qå(h&]h']h(]h)]h,]uh.K8h/hh0]qæh9X,The most common actions to return are these:qç…qè}qé(hhähhâubaubcdocutils.nodes definition_list qê)që}qì(hUhhÓhh h"Udefinition_listqíh$}qî(h&]h']h(]h)]h,]uh.Nh/hh0]qï(cdocutils.nodes definition_list_item qð)qñ}qò(hX¦*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 hhëhh h"Udefinition_list_itemqóh$}qô(h&]h']h(]h)]h,]uh.K=h0]qõ(cdocutils.nodes term qö)q÷}qø(hX*pass*qùhhñhh h"Utermqúh$}qû(h&]h']h(]h)]h,]uh.K=h0]qühf)qý}qþ(hhùh$}qÿ(h&]h']h(]h)]h,]uhh÷h0]rh9Xpassr…r}r(hUhhýubah"hnubaubcdocutils.nodes definition r)r}r(hUh$}r(h&]h']h(]h)]h,]uhhñh0]rh=)r }r (hXž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_recvr hjhh h"hAh$}r (h&]h']h(]h)]h,]uh.K;h0]r h9Xž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_recvr…r}r(hj hj ubaubah"U definitionrubeubhð)r}r(hXœ*hit_for_pass* Similar to pass, but accessible from vcl_fetch. Unlike pass, hit_for_pass will create a hitforpass object in the cache. This has the side-effect of caching the decision not to cache. This is to allow would-be uncachable requests to be passed to the backend at the same time. The same logic is not necessary in vcl_recv because this happens before any potential queueing for an object takes place. hhëhh h"hóh$}r(h&]h']h(]h)]h,]uh.KEh/hh0]r(hö)r}r(hX*hit_for_pass*rhjhh h"húh$}r(h&]h']h(]h)]h,]uh.KEh0]rhf)r}r(hjh$}r(h&]h']h(]h)]h,]uhjh0]rh9X hit_for_passr…r }r!(hUhjubah"hnubaubj)r"}r#(hUh$}r$(h&]h']h(]h)]h,]uhjh0]r%h=)r&}r'(hXŒSimilar to pass, but accessible from vcl_fetch. Unlike pass, hit_for_pass will create a hitforpass object in the cache. This has the side-effect of caching the decision not to cache. This is to allow would-be uncachable requests to be passed to the backend at the same time. The same logic is not necessary in vcl_recv because this happens before any potential queueing for an object takes place.r(hj"hh h"hAh$}r)(h&]h']h(]h)]h,]uh.K@h0]r*h9XŒSimilar to pass, but accessible from vcl_fetch. Unlike pass, hit_for_pass will create a hitforpass object in the cache. This has the side-effect of caching the decision not to cache. This is to allow would-be uncachable requests to be passed to the backend at the same time. The same logic is not necessary in vcl_recv because this happens before any potential queueing for an object takes place.r+…r,}r-(hj(hj&ubaubah"jubeubhð)r.}r/(hXÐ*lookup* When you return lookup from vcl_recv you tell Varnish to deliver content from cache even if the request othervise indicates that the request should be passed. You can't return lookup from vcl_fetch. hhëhh h"hóh$}r0(h&]h']h(]h)]h,]uh.KJh/hh0]r1(hö)r2}r3(hX*lookup*r4hj.hh h"húh$}r5(h&]h']h(]h)]h,]uh.KJh0]r6hf)r7}r8(hj4h$}r9(h&]h']h(]h)]h,]uhj2h0]r:h9Xlookupr;…r<}r=(hUhj7ubah"hnubaubj)r>}r?(hUh$}r@(h&]h']h(]h)]h,]uhj.h0]rAh=)rB}rC(hXÆWhen you return lookup from vcl_recv you tell Varnish to deliver content from cache even if the request othervise indicates that the request should be passed. You can't return lookup from vcl_fetch.rDhj>hh h"hAh$}rE(h&]h']h(]h)]h,]uh.KHh0]rFh9XÆWhen you return lookup from vcl_recv you tell Varnish to deliver content from cache even if the request othervise indicates that the request should be passed. You can't return lookup from vcl_fetch.rG…rH}rI(hjDhjBubaubah"jubeubhð)rJ}rK(hXÊ*pipe* 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. Beware that with HTTP 1.1 a client can send several requests on the same connection and so you should instruct Varnish to add a "Connection: close" header before actually returning pipe. hhëhh h"hóh$}rL(h&]h']h(]h)]h,]uh.KSh/hh0]rM(hö)rN}rO(hX*pipe*rPhjJhh h"húh$}rQ(h&]h']h(]h)]h,]uh.KSh0]rRhf)rS}rT(hjPh$}rU(h&]h']h(]h)]h,]uhjNh0]rVh9XpiperW…rX}rY(hUhjSubah"hnubaubj)rZ}r[(hUh$}r\(h&]h']h(]h)]h,]uhjJh0]r]h=)r^}r_(hXÂ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. Beware that with HTTP 1.1 a client can send several requests on the same connection and so you should instruct Varnish to add a "Connection: close" header before actually returning pipe.r`hjZhh h"hAh$}ra(h&]h']h(]h)]h,]uh.KMh0]rbh9XÂ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. Beware that with HTTP 1.1 a client can send several requests on the same connection and so you should instruct Varnish to add a "Connection: close" header before actually returning pipe.rc…rd}re(hj`hj^ubaubah"jubeubhð)rf}rg(hXU*deliver* Deliver the cached object to the client. Usually returned from vcl_fetch. hhëhh h"hóh$}rh(h&]h']h(]h)]h,]uh.KVh/hh0]ri(hö)rj}rk(hX *deliver*rlhjfhh h"húh$}rm(h&]h']h(]h)]h,]uh.KVh0]rnhf)ro}rp(hjlh$}rq(h&]h']h(]h)]h,]uhjjh0]rrh9Xdeliverrs…rt}ru(hUhjoubah"hnubaubj)rv}rw(hUh$}rx(h&]h']h(]h)]h,]uhjfh0]ryh=)rz}r{(hXJDeliver the cached object to the client. Usually returned from vcl_fetch.r|hjvhh h"hAh$}r}(h&]h']h(]h)]h,]uh.KVh0]r~h9XJDeliver the cached object to the client. Usually returned from vcl_fetch.r…r€}r(hj|hjzubaubah"jubeubeubeubh)r‚}rƒ(hUhhhh h"h#h$}r„(h&]h']h(]h)]r…Urequests-responses-and-objectsr†ah,]r‡hauh.KYh/hh0]rˆ(h2)r‰}rŠ(hXRequests, responses and objectsr‹hj‚hh h"h6h$}rŒ(h&]h']h(]h)]h,]uh.KYh/hh0]rh9XRequests, responses and objectsrŽ…r}r(hj‹hj‰ubaubh=)r‘}r’(hX¤In VCL, there are three important data structures. The request, coming from the client, the response coming from the backend server and the object, stored in cache.r“hj‚hh h"hAh$}r”(h&]h']h(]h)]h,]uh.K[h/hh0]r•h9X¤In VCL, there are three important data structures. The request, coming from the client, the response coming from the backend server and the object, stored in cache.r–…r—}r˜(hj“hj‘ubaubh=)r™}rš(hX0In VCL you should know the following structures.r›hj‚hh h"hAh$}rœ(h&]h']h(]h)]h,]uh.K_h/hh0]rh9X0In VCL you should know the following structures.rž…rŸ}r (hj›hj™ubaubhê)r¡}r¢(hUhj‚hh h"híh$}r£(h&]h']h(]h)]h,]uh.Nh/hh0]r¤(hð)r¥}r¦(hX¯*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. hj¡hh h"hóh$}r§(h&]h']h(]h)]h,]uh.Kdh0]r¨(hö)r©}rª(hX*req*r«hj¥hh h"húh$}r¬(h&]h']h(]h)]h,]uh.Kdh0]r­hf)r®}r¯(hj«h$}r°(h&]h']h(]h)]h,]uhj©h0]r±h9Xreqr²…r³}r´(hUhj®ubah"hnubaubj)rµ}r¶(hUh$}r·(h&]h']h(]h)]h,]uhj¥h0]r¸h=)r¹}rº(hX¨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.r»hjµhh h"hAh$}r¼(h&]h']h(]h)]h,]uh.Kbh0]r½h9X¨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.r¾…r¿}rÀ(hj»hj¹ubaubah"jubeubhð)rÁ}rÂ(hX§*beresp* The backend respons object. It contains the headers of the object comming from the backend. Most of the work you do in vcl_fetch you do on the beresp object. hj¡hh h"hóh$}rÃ(h&]h']h(]h)]h,]uh.Kih/hh0]rÄ(hö)rÅ}rÆ(hX*beresp*rÇhjÁhh h"húh$}rÈ(h&]h']h(]h)]h,]uh.Kih0]rÉhf)rÊ}rË(hjÇh$}rÌ(h&]h']h(]h)]h,]uhjÅh0]rÍh9XberesprÎ…rÏ}rÐ(hUhjÊubah"hnubaubj)rÑ}rÒ(hUh$}rÓ(h&]h']h(]h)]h,]uhjÁh0]rÔh=)rÕ}rÖ(hXThe backend respons object. It contains the headers of the object comming from the backend. Most of the work you do in vcl_fetch you do on the beresp object.r×hjÑhh h"hAh$}rØ(h&]h']h(]h)]h,]uh.Kgh0]rÙh9XThe backend respons object. It contains the headers of the object comming from the backend. Most of the work you do in vcl_fetch you do on the beresp object.rÚ…rÛ}rÜ(hj×hjÕubaubah"jubeubhð)rÝ}rÞ(hXw*obj* The cached object. Mostly a read only object that resides in memory. obj.ttl is writable, the rest is read only. hj¡hh h"hóh$}rß(h&]h']h(]h)]h,]uh.Kmh/hh0]rà(hö)rá}râ(hX*obj*rãhjÝhh h"húh$}rä(h&]h']h(]h)]h,]uh.Kmh0]råhf)ræ}rç(hjãh$}rè(h&]h']h(]h)]h,]uhjáh0]réh9Xobjrê…rë}rì(hUhjæubah"hnubaubj)rí}rî(hUh$}rï(h&]h']h(]h)]h,]uhjÝh0]rðh=)rñ}rò(hXpThe cached object. Mostly a read only object that resides in memory. obj.ttl is writable, the rest is read only.róhjíhh h"hAh$}rô(h&]h']h(]h)]h,]uh.Klh0]rõh9XpThe cached object. Mostly a read only object that resides in memory. obj.ttl is writable, the rest is read only.rö…r÷}rø(hjóhjñubaubah"jubeubeubeubhh)rù}rú(hUhhhh h"h#h$}rû(h&]h']h(]h)]rüUexample-1-manipulating-headersrýah,]rþh auh.Kˆh/hh0]rÿ(h2)r}r(hX Example 1 - manipulating headersrhjùhh h"h6h$}r(h&]h']h(]h)]h,]uh.Kˆh/hh0]rh9X Example 1 - manipulating headersr…r}r(hjhjubaubh=)r}r (hXbLets say we want to remove the cookie for all objects in the /images directory of our web server::hjùhh h"hAh$}r (h&]h']h(]h)]h,]uh.KŠh/hh0]r h9XaLets say we want to remove the cookie for all objects in the /images directory of our web server:r …r }r(hXaLets say we want to remove the cookie for all objects in the /images directory of our web server:hjubaubcdocutils.nodes literal_block r)r}r(hXMsub vcl_recv { if (req.url ~ "^/images") { unset req.http.cookie; } }hjùhh h"U literal_blockrh$}r(U xml:spacerUpreserverh)]h(]h&]h']h,]uh.Kh/hh0]rh9XMsub vcl_recv { if (req.url ~ "^/images") { unset req.http.cookie; } }r…r}r(hUhjubaubh=)r}r(hXLNow, 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).rhjùhh h"hAh$}r(h&]h']h(]h)]h,]uh.K“h/hh0]rh9XLNow, 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).r…r }r!(hjhjubaubeubh)r"}r#(hUhhhh h"h#h$}r$(h&]h']h(]h)]r%Uexample-2-manipulating-berespr&ah,]r'h auh.Kšh/hh0]r((h2)r)}r*(hXExample 2 - manipulating berespr+hj"hh h"h6h$}r,(h&]h']h(]h)]h,]uh.Kšh/hh0]r-h9XExample 2 - manipulating berespr.…r/}r0(hj+hj)ubaubh=)r1}r2(hX^Here we override the TTL of a object comming from the backend if it matches certain criteria::hj"hh h"hAh$}r3(h&]h']h(]h)]h,]uh.Kœh/hh0]r4h9X]Here we override the TTL of a object comming from the backend if it matches certain criteria:r5…r6}r7(hX]Here we override the TTL of a object comming from the backend if it matches certain criteria:hj1ubaubj)r8}r9(hXysub vcl_fetch { if (req.url ~ "\.(png|gif|jpg)$") { unset beresp.http.set-cookie; set beresp.ttl = 1h; } }hj"hh h"jh$}r:(jjh)]h(]h&]h']h,]uh.KŸh/hh0]r;h9Xysub vcl_fetch { if (req.url ~ "\.(png|gif|jpg)$") { unset beresp.http.set-cookie; set beresp.ttl = 1h; } }r<…r=}r>(hUhj8ubaubeubh)r?}r@(hUhhhh h"h#h$}rA(h&]h']h(]h)]rBUexample-3-aclsrCah,]rDhauh.K§h/hh0]rE(h2)rF}rG(hXExample 3 - ACLsrHhj?hh h"h6h$}rI(h&]h']h(]h)]h,]uh.K§h/hh0]rJh9XExample 3 - ACLsrK…rL}rM(hjHhjFubaubh=)rN}rO(hX“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.::hj?hh h"hAh$}rP(h&]h']h(]h)]h,]uh.K©h/hh0]rQ(h9X0You create a named access control list with the rR…rS}rT(hX0You create a named access control list with the hjNubhf)rU}rV(hX*acl*h$}rW(h&]h']h(]h)]h,]uhjNh0]rXh9XaclrY…rZ}r[(hUhjUubah"hnubh9X] keyword. You can match the IP address of the client against an ACL with the match operator.:r\…r]}r^(hX] keyword. You can match the IP address of the client against an ACL with the match operator.:hjNubeubj)r_}r`(hXá# 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.request == "PURGE") { if (client.ip ~ local) { return(lookup); } } } sub vcl_hit { if (req.request == "PURGE") { set obj.ttl = 0s; error 200 "Purged."; } } sub vcl_miss { if (req.request == "PURGE") { error 404 "Not in cache."; } }hj?hh h"jh$}ra(jjh)]h(]h&]h']h,]uh.K¬h/hh0]rbh9Xá# 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.request == "PURGE") { if (client.ip ~ local) { return(lookup); } } } sub vcl_hit { if (req.request == "PURGE") { set obj.ttl = 0s; error 200 "Purged."; } } sub vcl_miss { if (req.request == "PURGE") { error 404 "Not in cache."; } }rc…rd}re(hUhj_ubaubeubeubhh h"h#h$}rf(h&]h']h(]h)]rgU operatorsrhah,]rih auh.Kph/hh0]rj(h2)rk}rl(hX Operatorsrmhhhh h"h6h$}rn(h&]h']h(]h)]h,]uh.Kph/hh0]roh9X Operatorsrp…rq}rr(hjmhjkubaubh=)rs}rt(hX_The following operators are available in VCL. See the examples further down for, uhm, examples.ruhhhh h"hAh$}rv(h&]h']h(]h)]h,]uh.Krh/hh0]rwh9X_The following operators are available in VCL. See the examples further down for, uhm, examples.rx…ry}rz(hjuhjsubaubhê)r{}r|(hUhhhh h"híh$}r}(h&]h']h(]h)]h,]uh.Nh/hh0]r~hð)r}r€(hX= Assignment operator. hj{hh h"hóh$}r(h&]h']h(]h)]h,]uh.Kvh0]r‚(hö)rƒ}r„(hX=hjhh h"húh$}r…(h&]h']h(]h)]h,]uh.Kvh0]r†h9X=…r‡}rˆ(hX=hjƒubaubj)r‰}rŠ(hUh$}r‹(h&]h']h(]h)]h,]uhjh0]rŒh=)r}rŽ(hXAssignment operator.rhj‰hh h"hAh$}r(h&]h']h(]h)]h,]uh.Kvh0]r‘h9XAssignment operator.r’…r“}r”(hjhjubaubah"jubeubaubhê)r•}r–(hUhhhh h"híh$}r—(h&]h']h(]h)]h,]uh.Nh/hh0]r˜hð)r™}rš(hX== Comparison. hj•hh h"hóh$}r›(h&]h']h(]h)]h,]uh.Kyh0]rœ(hö)r}rž(hX==rŸhj™hh h"húh$}r (h&]h']h(]h)]h,]uh.Kyh0]r¡h9X==r¢…r£}r¤(hjŸhjubaubj)r¥}r¦(hUh$}r§(h&]h']h(]h)]h,]uhj™h0]r¨h=)r©}rª(hX Comparison.r«hj¥hh h"hAh$}r¬(h&]h']h(]h)]h,]uh.Kyh0]r­h9X Comparison.r®…r¯}r°(hj«hj©ubaubah"jubeubaubhê)r±}r²(hUhhhh h"híh$}r³(h&]h']h(]h)]h,]uh.Nh/hh0]r´hð)rµ}r¶(hX>~ Match. Can either be used with regular expressions or ACLs. hj±hh h"hóh$}r·(h&]h']h(]h)]h,]uh.K|h0]r¸(hö)r¹}rº(hX~hjµhh h"húh$}r»(h&]h']h(]h)]h,]uh.K|h0]r¼h9X~…r½}r¾(hX~hj¹ubaubj)r¿}rÀ(hUh$}rÁ(h&]h']h(]h)]h,]uhjµh0]rÂh=)rÃ}rÄ(hX;Match. Can either be used with regular expressions or ACLs.rÅhj¿hh h"hAh$}rÆ(h&]h']h(]h)]h,]uh.K|h0]rÇh9X;Match. Can either be used with regular expressions or ACLs.rÈ…rÉ}rÊ(hjÅhjÃubaubah"jubeubaubhê)rË}rÌ(hUhhhh h"híh$}rÍ(h&]h']h(]h)]h,]uh.Nh/hh0]rÎhð)rÏ}rÐ(hX ! Negation. hjËhh h"hóh$}rÑ(h&]h']h(]h)]h,]uh.Kh0]rÒ(hö)rÓ}rÔ(hX!hjÏhh h"húh$}rÕ(h&]h']h(]h)]h,]uh.Kh0]rÖh9X!…r×}rØ(hX!hjÓubaubj)rÙ}rÚ(hUh$}rÛ(h&]h']h(]h)]h,]uhjÏh0]rÜh=)rÝ}rÞ(hX Negation.rßhjÙhh h"hAh$}rà(h&]h']h(]h)]h,]uh.Kh0]ráh9X Negation.râ…rã}rä(hjßhjÝubaubah"jubeubaubhê)rå}ræ(hUhhhh h"híh$}rç(h&]h']h(]h)]h,]uh.Nh/hh0]rèhð)ré}rê(hX&& Logical *and* hjåhh h"hóh$}rë(h&]h']h(]h)]h,]uh.K‚h0]rì(hö)rí}rî(hX&&rïhjéhh h"húh$}rð(h&]h']h(]h)]h,]uh.K‚h0]rñh9X&&rò…ró}rô(hjïhjíubaubj)rõ}rö(hUh$}r÷(h&]h']h(]h)]h,]uhjéh0]røh=)rù}rú(hX Logical *and*hjõhh h"hAh$}rû(h&]h']h(]h)]h,]uh.K‚h0]rü(h9XLogical rý…rþ}rÿ(hXLogical hjùubhf)r}r(hX*and*h$}r(h&]h']h(]h)]h,]uhjùh0]rh9Xandr…r}r(hUhjubah"hnubeubah"jubeubaubhê)r}r(hUhhhh h"híh$}r (h&]h']h(]h)]h,]uh.Nh/hh0]r hð)r }r (hX|| Logical *or* hjhh h"hóh$}r (h&]h']h(]h)]h,]uh.K…h0]r(hö)r}r(hX||rhj hh h"húh$}r(h&]h']h(]h)]h,]uh.K…h0]rh9X||r…r}r(hjhjubaubj)r}r(hUh$}r(h&]h']h(]h)]h,]uhj h0]rh=)r}r(hX Logical *or*rhjhh h"hAh$}r(h&]h']h(]h)]h,]uh.K…h0]r(h9XLogical r …r!}r"(hXLogical hjubhf)r#}r$(hX*or*h$}r%(h&]h']h(]h)]h,]uhjh0]r&h9Xorr'…r(}r)(hUhj#ubah"hnubeubah"jubeubaubeubhh h"Usystem_messager*h$}r+(h&]UlevelKh)]h(]Usourceh h']h,]UlineKuUtypeUINFOr,uh.Kwh/hh0]r-h=)r.}r/(hUh$}r0(h&]h']h(]h)]h,]uhhh0]r1h9X`Possible incomplete section title. Treating the overline as ordinary text because it's so short.r2…r3}r4(hUhj.ubah"hAubaubh)r5}r6(hUhhhh h"j*h$}r7(h&]UlevelKh)]h(]Usourceh h']h,]UlineKxUtypej,uh.Kzh/hh0]r8h=)r9}r:(hUh$}r;(h&]h']h(]h)]h,]uhj5h0]r<h9X`Possible incomplete section title. Treating the overline as ordinary text because it's so short.r=…r>}r?(hUhj9ubah"hAubaubh)r@}rA(hUhhhh h"j*h$}rB(h&]UlevelKh)]h(]Usourceh h']h,]UlineK{Utypej,uh.K}h/hh0]rCh=)rD}rE(hUh$}rF(h&]h']h(]h)]h,]uhj@h0]rGh9X`Possible incomplete section title. Treating the overline as ordinary text because it's so short.rH…rI}rJ(hUhjDubah"hAubaubh)rK}rL(hUhhhh h"j*h$}rM(h&]UlevelKh)]h(]Usourceh h']h,]UlineK~Utypej,uh.K€h/hh0]rNh=)rO}rP(hUh$}rQ(h&]h']h(]h)]h,]uhjKh0]rRh9X`Possible incomplete section title. Treating the overline as ordinary text because it's so short.rS…rT}rU(hUhjOubah"hAubaubh)rV}rW(hUhhhh h"j*h$}rX(h&]UlevelKh)]h(]Usourceh h']h,]UlineKUtypej,uh.Kƒh/hh0]rYh=)rZ}r[(hUh$}r\(h&]h']h(]h)]h,]uhjVh0]r]h9X`Possible incomplete section title. Treating the overline as ordinary text because it's so short.r^…r_}r`(hUhjZubah"hAubaubh)ra}rb(hUhhhh h"j*h$}rc(h&]UlevelKh)]h(]Usourceh h']h,]UlineK„Utypej,uh.K†h/hh0]rdh=)re}rf(hUh$}rg(h&]h']h(]h)]h,]uhjah0]rhh9X`Possible incomplete section title. Treating the overline as ordinary text because it's so short.ri…rj}rk(hUhjeubah"hAubaubeUcurrent_sourcerlNU decorationrmNUautofootnote_startrnKUnameidsro}rp(hjChh+hj†h h¦h j&h jýh jhh h×hhuh0]rqhahUU transformerrrNU footnote_refsrs}rtUrefnamesru}rvUsymbol_footnotesrw]rxUautofootnote_refsry]rzUsymbol_footnote_refsr{]r|U citationsr}]r~h/hU current_linerNUtransform_messagesr€]rUreporterr‚NUid_startrƒKU autofootnotesr„]r…U citation_refsr†}r‡Uindirect_targetsrˆ]r‰UsettingsrŠ(cdocutils.frontend Values r‹orŒ}r(Ufootnote_backlinksrŽKUrecord_dependenciesrNU rfc_base_urlrUhttp://tools.ietf.org/html/r‘U tracebackr’ˆUpep_referencesr“NUstrip_commentsr”NU toc_backlinksr•Uentryr–U language_coder—Uenr˜U datestampr™NU report_levelršKU _destinationr›NU halt_levelrœKU strip_classesrNh6NUerror_encoding_error_handlerržUbackslashreplacerŸUdebugr NUembed_stylesheetr¡‰Uoutput_encoding_error_handlerr¢Ustrictr£U sectnum_xformr¤KUdump_transformsr¥NU docinfo_xformr¦KUwarning_streamr§NUpep_file_url_templater¨Upep-%04dr©Uexit_status_levelrªKUconfigr«NUstrict_visitorr¬NUcloak_email_addressesr­ˆUtrim_footnote_reference_spacer®‰Uenvr¯NUdump_pseudo_xmlr°NUexpose_internalsr±NUsectsubtitle_xformr²‰U source_linkr³NUrfc_referencesr´NUoutput_encodingrµUutf-8r¶U source_urlr·NUinput_encodingr¸U utf-8-sigr¹U_disable_configrºNU id_prefixr»UU tab_widthr¼KUerror_encodingr½UUTF-8r¾U_sourcer¿U0/home/tfheen/varnish/doc/sphinx/tutorial/vcl.rstrÀUgettext_compactrÁˆU generatorrÂNUdump_internalsrÃNU smart_quotesrĉU pep_base_urlrÅUhttp://www.python.org/dev/peps/rÆUsyntax_highlightrÇUlongrÈUinput_encoding_error_handlerrÉj£Uauto_id_prefixrÊUidrËUdoctitle_xformr̉Ustrip_elements_with_classesrÍNU _config_filesrÎ]Ufile_insertion_enabledrÏKU raw_enabledrÐKU dump_settingsrÑNubUsymbol_footnote_startrÒKUidsrÓ}rÔ(jhhj†j‚h×hÓjýjùhh{h¦h¢j&j"h+hjCj?uUsubstitution_namesrÕ}rÖh"h/h$}r×(h&]h)]h(]Usourceh h']h,]uU footnotesrØ]rÙUrefidsrÚ}rÛub.varnish-3.0.5/doc/sphinx/=build/doctrees/tutorial/introduction.doctree0000644000175000017500000001447012247037213023136 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(X performanceqNX flexibilityqNXtutorial-introqˆXwhat is varnish?q NXsupported platformsq NuUsubstitution_defsq }q Uparse_messagesq ]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hU performanceqhU flexibilityqhUtutorial-introqh Uwhat-is-varnishqh Usupported-platformsquUchildrenq]q(cdocutils.nodes target q)q}q(U rawsourceqX.. _tutorial-intro:UparentqhUsourceq cdocutils.nodes reprunicode q!X9/home/tfheen/varnish/doc/sphinx/tutorial/introduction.rstq"…q#}q$bUtagnameq%Utargetq&U attributesq'}q((Uidsq)]Ubackrefsq*]Udupnamesq+]Uclassesq,]Unamesq-]Urefidq.huUlineq/KUdocumentq0hh]ubcdocutils.nodes section q1)q2}q3(hUhhh h#Uexpect_referenced_by_nameq4}q5hhsh%Usectionq6h'}q7(h+]h,]h*]h)]q8(hheh-]q9(h heuh/Kh0hUexpect_referenced_by_idq:}q;hhsh]q<(cdocutils.nodes title q=)q>}q?(hXWhat is Varnish?q@hh2h h#h%UtitleqAh'}qB(h+]h,]h*]h)]h-]uh/Kh0hh]qCcdocutils.nodes Text qDXWhat is Varnish?qE…qF}qG(hh@hh>ubaubcdocutils.nodes paragraph qH)qI}qJ(hX=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.qKhh2h h#h%U paragraphqLh'}qM(h+]h,]h*]h)]h-]uh/Kh0hh]qNhDX=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.qO…qP}qQ(hhKhhIubaubh1)qR}qS(hUhh2h h#h%h6h'}qT(h+]h,]h*]h)]qUhah-]qVhauh/Kh0hh]qW(h=)qX}qY(hX PerformanceqZhhRh h#h%hAh'}q[(h+]h,]h*]h)]h-]uh/Kh0hh]q\hDX Performanceq]…q^}q_(hhZhhXubaubhH)q`}qa(hXÐVarnish performs really, really well. It is usually bound by the speed of the network, effectivly turning performance into a non-issue. We've seen Varnish delivering 20 Gbps on regular off-the-shelf hardware.qbhhRh h#h%hLh'}qc(h+]h,]h*]h)]h-]uh/Kh0hh]qdhDXÐVarnish performs really, really well. It is usually bound by the speed of the network, effectivly turning performance into a non-issue. We've seen Varnish delivering 20 Gbps on regular off-the-shelf hardware.qe…qf}qg(hhbhh`ubaubeubh1)qh}qi(hUhh2h h#h%h6h'}qj(h+]h,]h*]h)]qkhah-]qlhauh/Kh0hh]qm(h=)qn}qo(hX Flexibilityqphhhh h#h%hAh'}qq(h+]h,]h*]h)]h-]uh/Kh0hh]qrhDX Flexibilityqs…qt}qu(hhphhnubaubhH)qv}qw(hX˜One of the key features of Varnish Cache, in addition to it's performance, is the flexibility of it's 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. You can read more about this in our tutorial.qxhhhh h#h%hLh'}qy(h+]h,]h*]h)]h-]uh/Kh0hh]qzhDX˜One of the key features of Varnish Cache, in addition to it's performance, is the flexibility of it's 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. You can read more about this in our tutorial.q{…q|}q}(hhxhhvubaubeubh1)q~}q(hUhh2h h#h%h6h'}q€(h+]h,]h*]h)]qhah-]q‚h auh/K!h0hh]qƒ(h=)q„}q…(hXSupported platformsq†hh~h h#h%hAh'}q‡(h+]h,]h*]h)]h-]uh/K!h0hh]qˆhDXSupported platformsq‰…qŠ}q‹(hh†hh„ubaubhH)qŒ}q(hX¹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 and OS X.qŽhh~h h#h%hLh'}q(h+]h,]h*]h)]h-]uh/K#h0hh]qhDX¹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 and OS X.q‘…q’}q“(hhŽhhŒubaubeubeubehUU transformerq”NU footnote_refsq•}q–Urefnamesq—}q˜Usymbol_footnotesq™]qšUautofootnote_refsq›]qœUsymbol_footnote_refsq]qžU citationsqŸ]q h0hU current_lineq¡NUtransform_messagesq¢]q£cdocutils.nodes system_message q¤)q¥}q¦(hUh'}q§(h+]UlevelKh)]h*]Usourceh#h,]h-]UlineKUtypeUINFOq¨uh]q©hH)qª}q«(hUh'}q¬(h+]h,]h*]h)]h-]uhh¥h]q­hDX4Hyperlink target "tutorial-intro" is not referenced.q®…q¯}q°(hUhhªubah%hLubah%Usystem_messageq±ubaUreporterq²NUid_startq³KU autofootnotesq´]qµU citation_refsq¶}q·Uindirect_targetsq¸]q¹Usettingsqº(cdocutils.frontend Values q»oq¼}q½(Ufootnote_backlinksq¾KUrecord_dependenciesq¿NU rfc_base_urlqÀUhttp://tools.ietf.org/html/qÁU tracebackqˆUpep_referencesqÃNUstrip_commentsqÄNU toc_backlinksqÅUentryqÆU language_codeqÇUenqÈU datestampqÉNU report_levelqÊKU _destinationqËNU halt_levelqÌKU strip_classesqÍNhANUerror_encoding_error_handlerqÎUbackslashreplaceqÏUdebugqÐNUembed_stylesheetqщUoutput_encoding_error_handlerqÒUstrictqÓU sectnum_xformqÔKUdump_transformsqÕNU docinfo_xformqÖKUwarning_streamq×NUpep_file_url_templateqØUpep-%04dqÙUexit_status_levelqÚKUconfigqÛNUstrict_visitorqÜNUcloak_email_addressesq݈Utrim_footnote_reference_spaceqÞ‰UenvqßNUdump_pseudo_xmlqàNUexpose_internalsqáNUsectsubtitle_xformqâ‰U source_linkqãNUrfc_referencesqäNUoutput_encodingqåUutf-8qæU source_urlqçNUinput_encodingqèU utf-8-sigqéU_disable_configqêNU id_prefixqëUU tab_widthqìKUerror_encodingqíUUTF-8qîU_sourceqïU9/home/tfheen/varnish/doc/sphinx/tutorial/introduction.rstqðUgettext_compactqñˆU generatorqòNUdump_internalsqóNU smart_quotesqô‰U pep_base_urlqõUhttp://www.python.org/dev/peps/qöUsyntax_highlightq÷UlongqøUinput_encoding_error_handlerqùhÓUauto_id_prefixqúUidqûUdoctitle_xformqü‰Ustrip_elements_with_classesqýNU _config_filesqþ]qÿUfile_insertion_enabledrKU raw_enabledrKU dump_settingsrNubUsymbol_footnote_startrKUidsr}r(hhRhh2hhhhh2hh~uUsubstitution_namesr}rh%h0h'}r(h+]h)]h*]Usourceh#h,]h-]uU footnotesr ]r Urefidsr }r h]r hasub.varnish-3.0.5/doc/sphinx/=build/doctrees/tutorial/index.doctree0000644000175000017500000001172712247037213021526 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(X using varnishqNXtutorial-indexqˆuUsubstitution_defsq}q Uparse_messagesq ]q Ucurrent_sourceq NU decorationq NUautofootnote_startqKUnameidsq}q(hU using-varnishqhUtutorial-indexquUchildrenq]q(cdocutils.nodes target q)q}q(U rawsourceqX.. _tutorial-index:UparentqhUsourceqcdocutils.nodes reprunicode qX2/home/tfheen/varnish/doc/sphinx/tutorial/index.rstq…q}qbUtagnameqUtargetq U attributesq!}q"(Uidsq#]Ubackrefsq$]Udupnamesq%]Uclassesq&]Unamesq']Urefidq(huUlineq)KUdocumentq*hh]ubcdocutils.nodes section q+)q,}q-(hUhhhhUexpect_referenced_by_nameq.}q/hhshUsectionq0h!}q1(h%]h&]h$]h#]q2(hheh']q3(hheuh)Kh*hUexpect_referenced_by_idq4}q5hhsh]q6(cdocutils.nodes title q7)q8}q9(hX Using Varnishq:hh,hhhUtitleq;h!}q<(h%]h&]h$]h#]h']uh)Kh*hh]q=cdocutils.nodes Text q>X Using Varnishq?…q@}qA(hh:hh8ubaubcdocutils.nodes paragraph qB)qC}qD(hXThis tutorial is intended for system administrators managing Varnish cache. The reader should know how to configure her web- or application server and have basic knowledge of the HTTP protocol. The reader should have Varnish up and running with the default configuration.qEhh,hhhU paragraphqFh!}qG(h%]h&]h$]h#]h']uh)Kh*hh]qHh>XThis tutorial is intended for system administrators managing Varnish cache. The reader should know how to configure her web- or application server and have basic knowledge of the HTTP protocol. The reader should have Varnish up and running with the default configuration.qI…qJ}qK(hhEhhCubaubhB)qL}qM(hX^The tutorial is split into short chapters, each chapter taking on a separate topic. Good luck.qNhh,hhhhFh!}qO(h%]h&]h$]h#]h']uh)K h*hh]qPh>X^The tutorial is split into short chapters, each chapter taking on a separate topic. Good luck.qQ…qR}qS(hhNhhLubaubcdocutils.nodes compound qT)qU}qV(hUhh,hhhUcompoundqWh!}qX(h%]h&]qYUtoctree-wrapperqZah$]h#]h']uh)Nh*hh]q[csphinx.addnodes toctree q\)q]}q^(hUhhUhhhUtoctreeq_h!}q`(UnumberedqaKhUtutorial/indexqbU titlesonlyqc‰Uglobqd‰h#]h$]h%]h&]h']Uentriesqe]qf(NXtutorial/introductionqg†qhNXtutorial/backend_serversqi†qjNXtutorial/starting_varnishqk†qlNXtutorial/loggingqm†qnNXtutorial/sizing_your_cacheqo†qpNX#tutorial/putting_varnish_on_port_80qq†qrNX tutorial/vclqs†qtNXtutorial/statisticsqu†qvNX tutorial/increasing_your_hitrateqw†qxNXtutorial/cookiesqy†qzNX tutorial/varyq{†q|NXtutorial/purgingq}†q~NXtutorial/compressionq†q€NX tutorial/esiq†q‚NXtutorial/platformnotesqƒ†q„NXtutorial/websocketsq…†q†NXtutorial/devicedetectionq‡†qˆNX!tutorial/advanced_backend_serversq‰†qŠNX%tutorial/handling_misbehaving_serversq‹†qŒNXtutorial/advanced_topicsq†qŽNXtutorial/troubleshootingq†qeUhiddenq‘‰U includefilesq’]q“(hghihkhmhohqhshuhwhyh{h}hhhƒh…h‡h‰h‹hheUmaxdepthq”Kuh)Kh]ubaubeubehUU transformerq•NU footnote_refsq–}q—Urefnamesq˜}q™Usymbol_footnotesqš]q›Uautofootnote_refsqœ]qUsymbol_footnote_refsqž]qŸU citationsq ]q¡h*hU current_lineq¢NUtransform_messagesq£]q¤cdocutils.nodes system_message q¥)q¦}q§(hUh!}q¨(h%]UlevelKh#]h$]Usourcehh&]h']UlineKUtypeUINFOq©uh]qªhB)q«}q¬(hUh!}q­(h%]h&]h$]h#]h']uhh¦h]q®h>X4Hyperlink target "tutorial-index" is not referenced.q¯…q°}q±(hUhh«ubahhFubahUsystem_messageq²ubaUreporterq³NUid_startq´KU autofootnotesqµ]q¶U citation_refsq·}q¸Uindirect_targetsq¹]qºUsettingsq»(cdocutils.frontend Values q¼oq½}q¾(Ufootnote_backlinksq¿KUrecord_dependenciesqÀNU rfc_base_urlqÁUhttp://tools.ietf.org/html/qÂU tracebackqÈUpep_referencesqÄNUstrip_commentsqÅNU toc_backlinksqÆUentryqÇU language_codeqÈUenqÉU datestampqÊNU report_levelqËKU _destinationqÌNU halt_levelqÍKU strip_classesqÎNh;NUerror_encoding_error_handlerqÏUbackslashreplaceqÐUdebugqÑNUembed_stylesheetqÒ‰Uoutput_encoding_error_handlerqÓUstrictqÔU sectnum_xformqÕKUdump_transformsqÖNU docinfo_xformq×KUwarning_streamqØNUpep_file_url_templateqÙUpep-%04dqÚUexit_status_levelqÛKUconfigqÜNUstrict_visitorqÝNUcloak_email_addressesqÞˆUtrim_footnote_reference_spaceq߉UenvqàNUdump_pseudo_xmlqáNUexpose_internalsqâNUsectsubtitle_xformqã‰U source_linkqäNUrfc_referencesqåNUoutput_encodingqæUutf-8qçU source_urlqèNUinput_encodingqéU utf-8-sigqêU_disable_configqëNU id_prefixqìUU tab_widthqíKUerror_encodingqîUUTF-8qïU_sourceqðU2/home/tfheen/varnish/doc/sphinx/tutorial/index.rstqñUgettext_compactqòˆU generatorqóNUdump_internalsqôNU smart_quotesqõ‰U pep_base_urlqöUhttp://www.python.org/dev/peps/q÷Usyntax_highlightqøUlongqùUinput_encoding_error_handlerqúhÔUauto_id_prefixqûUidqüUdoctitle_xformqý‰Ustrip_elements_with_classesqþNU _config_filesqÿ]rUfile_insertion_enabledrKU raw_enabledrKU dump_settingsrNubUsymbol_footnote_startrKUidsr}r(hh,hh,uUsubstitution_namesr}rhh*h!}r (h%]h#]h$]Usourcehh&]h']uU footnotesr ]r Urefidsr }r h]rhasub.varnish-3.0.5/doc/sphinx/=build/doctrees/tutorial/sizing_your_cache.doctree0000644000175000017500000001702212247037213024115 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}qXsizing your cacheqNsUsubstitution_defsq}qUparse_messagesq ]q Ucurrent_sourceq NU decorationq NUautofootnote_startq KUnameidsq}qhUsizing-your-cacheqsUchildrenq]qcdocutils.nodes section q)q}q(U rawsourceqUUparentqhUsourceqcdocutils.nodes reprunicode qX>/home/tfheen/varnish/doc/sphinx/tutorial/sizing_your_cache.rstq…q}qbUtagnameqUsectionqU attributesq}q (Udupnamesq!]Uclassesq"]Ubackrefsq#]Uidsq$]q%haUnamesq&]q'hauUlineq(KUdocumentq)hh]q*(cdocutils.nodes title q+)q,}q-(hXSizing your cacheq.hhhhhUtitleq/h}q0(h!]h"]h#]h$]h&]uh(Kh)hh]q1cdocutils.nodes Text q2XSizing your cacheq3…q4}q5(hh.hh,ubaubcdocutils.nodes paragraph q6)q7}q8(hX_Picking how much memory you should give Varnish can be a tricky task. A few things to consider:q9hhhhhU paragraphq:h}q;(h!]h"]h#]h$]h&]uh(Kh)hh]q}q?(hh9hh7ubaubcdocutils.nodes block_quote q@)qA}qB(hUhhhNhU block_quoteqCh}qD(h!]h"]h#]h$]h&]uh(Nh)hh]qEcdocutils.nodes bullet_list qF)qG}qH(hUh}qI(UbulletqJX*h$]h#]h!]h"]h&]uhhAh]qK(cdocutils.nodes list_item qL)qM}qN(hXÂ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.h}qO(h!]h"]h#]h$]h&]uhhGh]qPh6)qQ}qR(hXÂ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.hhMhhhh:h}qS(h!]h"]h#]h$]h&]uh(Kh]qT(h2XHow big is your qU…qV}qW(hXHow big is your hhQubcdocutils.nodes emphasis qX)qY}qZ(hX*hot*h}q[(h!]h"]h#]h$]h&]uhhQh]q\h2Xhotq]…q^}q_(hUhhYubahUemphasisq`ubh2X­ 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.qa…qb}qc(hX­ 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.hhQubeubahU list_itemqdubhL)qe}qf(hXØ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.h}qg(h!]h"]h#]h$]h&]uhhGh]qhh6)qi}qj(hXØ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.qkhhehhhh:h}ql(h!]h"]h#]h$]h&]uh(K h]qmh2XØ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.qn…qo}qp(hhkhhiubaubahhdubhL)qq}qr(hXíWatch the n_lru_nuked counter with :ref:`reference-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. h}qs(h!]h"]h#]h$]h&]uhhGh]qth6)qu}qv(hXìWatch the n_lru_nuked counter with :ref:`reference-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.hhqhhhh:h}qw(h!]h"]h#]h$]h&]uh(Kh]qx(h2X#Watch the n_lru_nuked counter with qy…qz}q{(hX#Watch the n_lru_nuked counter with hhuubcsphinx.addnodes pending_xref q|)q}}q~(hX:ref:`reference-varnishstat`qhhuhhhU pending_xrefq€h}q(UreftypeXrefUrefwarnq‚ˆU reftargetqƒXreference-varnishstatU refdomainXstdq„h$]h#]U refexplicit‰h!]h"]h&]Urefdocq…Ututorial/sizing_your_cacheq†uh(Kh]q‡hX)qˆ}q‰(hhh}qŠ(h!]h"]q‹(UxrefqŒh„Xstd-refqeh#]h$]h&]uhh}h]qŽh2Xreference-varnishstatq…q}q‘(hUhhˆubahh`ubaubh2X­ 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.q’…q“}q”(hX­ 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.hhuubeubahhdubehU bullet_listq•ubaubh6)q–}q—(hXGBe 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 1k per object. So, if you have lots of small objects in your cache the overhead might be significant.hhhhhh:h}q˜(h!]h"]h#]h$]h&]uh(Kh)hh]q™(h2X±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 qš…q›}qœ(hX±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 hh–ubcdocutils.nodes strong q)qž}qŸ(hX **double**h}q (h!]h"]h#]h$]h&]uhh–h]q¡h2Xdoubleq¢…q£}q¤(hUhhžubahUstrongq¥ubh2XŒ that. Varnish has a overhead of about 1k per object. So, if you have lots of small objects in your cache the overhead might be significant.q¦…q§}q¨(hXŒ that. Varnish has a overhead of about 1k per object. So, if you have lots of small objects in your cache the overhead might be significant.hh–ubeubeubahUU transformerq©NU footnote_refsqª}q«Urefnamesq¬}q­Usymbol_footnotesq®]q¯Uautofootnote_refsq°]q±Usymbol_footnote_refsq²]q³U citationsq´]qµh)hU current_lineq¶NUtransform_messagesq·]q¸Ureporterq¹NUid_startqºKU autofootnotesq»]q¼U citation_refsq½}q¾Uindirect_targetsq¿]qÀUsettingsqÁ(cdocutils.frontend Values qÂoqÃ}qÄ(Ufootnote_backlinksqÅKUrecord_dependenciesqÆNU rfc_base_urlqÇUhttp://tools.ietf.org/html/qÈU tracebackqɈUpep_referencesqÊNUstrip_commentsqËNU toc_backlinksqÌUentryqÍU language_codeqÎUenqÏU datestampqÐNU report_levelqÑKU _destinationqÒNU halt_levelqÓKU strip_classesqÔNh/NUerror_encoding_error_handlerqÕUbackslashreplaceqÖUdebugq×NUembed_stylesheetq؉Uoutput_encoding_error_handlerqÙUstrictqÚU sectnum_xformqÛKUdump_transformsqÜNU docinfo_xformqÝKUwarning_streamqÞNUpep_file_url_templateqßUpep-%04dqàUexit_status_levelqáKUconfigqâNUstrict_visitorqãNUcloak_email_addressesqäˆUtrim_footnote_reference_spaceqå‰UenvqæNUdump_pseudo_xmlqçNUexpose_internalsqèNUsectsubtitle_xformqé‰U source_linkqêNUrfc_referencesqëNUoutput_encodingqìUutf-8qíU source_urlqîNUinput_encodingqïU utf-8-sigqðU_disable_configqñNU id_prefixqòUU tab_widthqóKUerror_encodingqôUUTF-8qõU_sourceqöU>/home/tfheen/varnish/doc/sphinx/tutorial/sizing_your_cache.rstq÷Ugettext_compactqøˆU generatorqùNUdump_internalsqúNU smart_quotesqû‰U pep_base_urlqüUhttp://www.python.org/dev/peps/qýUsyntax_highlightqþUlongqÿUinput_encoding_error_handlerrhÚUauto_id_prefixrUidrUdoctitle_xformr‰Ustrip_elements_with_classesrNU _config_filesr]Ufile_insertion_enabledrKU raw_enabledrKU dump_settingsrNubUsymbol_footnote_startr KUidsr }r hhsUsubstitution_namesr }r hh)h}r(h!]h$]h#]Usourcehh"]h&]uU footnotesr]rUrefidsr}rub.varnish-3.0.5/doc/sphinx/=build/doctrees/tutorial/websockets.doctree0000644000175000017500000000736212247037213022570 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}qXusing websocketsqNsUsubstitution_defsq}qUparse_messagesq ]q Ucurrent_sourceq NU decorationq NUautofootnote_startq KUnameidsq}qhUusing-websocketsqsUchildrenq]qcdocutils.nodes section q)q}q(U rawsourceqUUparentqhUsourceqcdocutils.nodes reprunicode qX7/home/tfheen/varnish/doc/sphinx/tutorial/websockets.rstq…q}qbUtagnameqUsectionqU attributesq}q (Udupnamesq!]Uclassesq"]Ubackrefsq#]Uidsq$]q%haUnamesq&]q'hauUlineq(KUdocumentq)hh]q*(cdocutils.nodes title q+)q,}q-(hXUsing Websocketsq.hhhhhUtitleq/h}q0(h!]h"]h#]h$]h&]uh(Kh)hh]q1cdocutils.nodes Text q2XUsing Websocketsq3…q4}q5(hh.hh,ubaubcdocutils.nodes paragraph q6)q7}q8(hXWWebsockets is a technology for creating a bidirectional stream-based channel over HTTP.q9hhhhhU paragraphq:h}q;(h!]h"]h#]h$]h&]uh(Kh)hh]q}q?(hh9hh7ubaubh6)q@}qA(hX{To run websockets through Varnish you need to pipe it, and copy the Upgrade header. Use the following VCL config to do so::hhhhhh:h}qB(h!]h"]h#]h$]h&]uh(Kh)hh]qCh2XzTo run websockets through Varnish you need to pipe it, and copy the Upgrade header. Use the following VCL config to do so:qD…qE}qF(hXzTo run websockets through Varnish you need to pipe it, and copy the Upgrade header. Use the following VCL config to do so:hh@ubaubcdocutils.nodes literal_block qG)qH}qI(hXÇsub vcl_pipe { if (req.http.upgrade) { set bereq.http.upgrade = req.http.upgrade; } } sub vcl_recv { if (req.http.Upgrade ~ "(?i)websocket") { return (pipe); } }hhhhhU literal_blockqJh}qK(U xml:spaceqLUpreserveqMh$]h#]h!]h"]h&]uh(K h)hh]qNh2XÇsub vcl_pipe { if (req.http.upgrade) { set bereq.http.upgrade = req.http.upgrade; } } sub vcl_recv { if (req.http.Upgrade ~ "(?i)websocket") { return (pipe); } }qO…qP}qQ(hUhhHubaubeubahUU transformerqRNU footnote_refsqS}qTUrefnamesqU}qVUsymbol_footnotesqW]qXUautofootnote_refsqY]qZUsymbol_footnote_refsq[]q\U citationsq]]q^h)hU current_lineq_NUtransform_messagesq`]qaUreporterqbNUid_startqcKU autofootnotesqd]qeU citation_refsqf}qgUindirect_targetsqh]qiUsettingsqj(cdocutils.frontend Values qkoql}qm(Ufootnote_backlinksqnKUrecord_dependenciesqoNU rfc_base_urlqpUhttp://tools.ietf.org/html/qqU tracebackqrˆUpep_referencesqsNUstrip_commentsqtNU toc_backlinksquUentryqvU language_codeqwUenqxU datestampqyNU report_levelqzKU _destinationq{NU halt_levelq|KU strip_classesq}Nh/NUerror_encoding_error_handlerq~UbackslashreplaceqUdebugq€NUembed_stylesheetq‰Uoutput_encoding_error_handlerq‚UstrictqƒU sectnum_xformq„KUdump_transformsq…NU docinfo_xformq†KUwarning_streamq‡NUpep_file_url_templateqˆUpep-%04dq‰Uexit_status_levelqŠKUconfigq‹NUstrict_visitorqŒNUcloak_email_addressesqˆUtrim_footnote_reference_spaceqމUenvqNUdump_pseudo_xmlqNUexpose_internalsq‘NUsectsubtitle_xformq’‰U source_linkq“NUrfc_referencesq”NUoutput_encodingq•Uutf-8q–U source_urlq—NUinput_encodingq˜U utf-8-sigq™U_disable_configqšNU id_prefixq›UU tab_widthqœKUerror_encodingqUUTF-8qžU_sourceqŸU7/home/tfheen/varnish/doc/sphinx/tutorial/websockets.rstq Ugettext_compactq¡ˆU generatorq¢NUdump_internalsq£NU smart_quotesq¤‰U pep_base_urlq¥Uhttp://www.python.org/dev/peps/q¦Usyntax_highlightq§Ulongq¨Uinput_encoding_error_handlerq©hƒUauto_id_prefixqªUidq«Udoctitle_xformq¬‰Ustrip_elements_with_classesq­NU _config_filesq®]q¯Ufile_insertion_enabledq°KU raw_enabledq±KU dump_settingsq²NubUsymbol_footnote_startq³KUidsq´}qµhhsUsubstitution_namesq¶}q·hh)h}q¸(h!]h$]h#]Usourcehh"]h&]uU footnotesq¹]qºUrefidsq»}q¼ub.varnish-3.0.5/doc/sphinx/=build/doctrees/tutorial/compression.doctree0000644000175000017500000003075512247037213022762 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(X compressionqNXdefault behaviourqNXa random outburstqNXclients that don't support gzipq NX gzip and esiq NXtutorial-compressionq ˆuUsubstitution_defsq }q Uparse_messagesq]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hU compressionqhUdefault-behaviourqhUa-random-outburstqh Uclients-that-don-t-support-gzipqh U gzip-and-esiqh Ututorial-compressionquUchildrenq]q(cdocutils.nodes target q)q}q(U rawsourceq X.. _tutorial-compression:Uparentq!hUsourceq"cdocutils.nodes reprunicode q#X8/home/tfheen/varnish/doc/sphinx/tutorial/compression.rstq$…q%}q&bUtagnameq'Utargetq(U attributesq)}q*(Uidsq+]Ubackrefsq,]Udupnamesq-]Uclassesq.]Unamesq/]Urefidq0huUlineq1KUdocumentq2hh]ubcdocutils.nodes section q3)q4}q5(h Uh!hh"h%Uexpect_referenced_by_nameq6}q7h hsh'Usectionq8h)}q9(h-]h.]h,]h+]q:(hheh/]q;(hh euh1Kh2hUexpect_referenced_by_idq<}q=hhsh]q>(cdocutils.nodes title q?)q@}qA(h X CompressionqBh!h4h"h%h'UtitleqCh)}qD(h-]h.]h,]h+]h/]uh1Kh2hh]qEcdocutils.nodes Text qFX CompressionqG…qH}qI(h hBh!h@ubaubcdocutils.nodes paragraph qJ)qK}qL(h XNew in Varnish 3.0 was native support for compression, using gzip encoding. *Before* 3.0, Varnish would never compress objects.h!h4h"h%h'U paragraphqMh)}qN(h-]h.]h,]h+]h/]uh1Kh2hh]qO(hFXLNew in Varnish 3.0 was native support for compression, using gzip encoding. qP…qQ}qR(h XLNew in Varnish 3.0 was native support for compression, using gzip encoding. h!hKubcdocutils.nodes emphasis qS)qT}qU(h X*Before*h)}qV(h-]h.]h,]h+]h/]uh!hKh]qWhFXBeforeqX…qY}qZ(h Uh!hTubah'Uemphasisq[ubhFX+ 3.0, Varnish would never compress objects.q\…q]}q^(h X+ 3.0, Varnish would never compress objects.h!hKubeubhJ)q_}q`(h XiIn Varnish 3.0 compression defaults to "on", meaning that it tries to be smart and do the sensible thing.qah!h4h"h%h'hMh)}qb(h-]h.]h,]h+]h/]uh1K h2hh]qchFXiIn Varnish 3.0 compression defaults to "on", meaning that it tries to be smart and do the sensible thing.qd…qe}qf(h hah!h_ubaubhJ)qg}qh(h XÅ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:`ref-varnishd` for details.h!h4h"h%h'hMh)}qi(h-]h.]h,]h+]h/]uh1K h2hh]qj(hFXIf you don't want Varnish tampering with the encoding you can disable compression all together by setting the parameter http_gzip_support to qk…ql}qm(h XIf you don't want Varnish tampering with the encoding you can disable compression all together by setting the parameter http_gzip_support to h!hgubhS)qn}qo(h X*false*h)}qp(h-]h.]h,]h+]h/]uh!hgh]qqhFXfalseqr…qs}qt(h Uh!hnubah'h[ubhFX. Please see man qu…qv}qw(h X. Please see man h!hgubcsphinx.addnodes pending_xref qx)qy}qz(h X:ref:`ref-varnishd`q{h!hgh"h%h'U pending_xrefq|h)}q}(UreftypeXrefUrefwarnq~ˆU reftargetqX ref-varnishdU refdomainXstdq€h+]h,]U refexplicit‰h-]h.]h/]UrefdocqUtutorial/compressionq‚uh1K h]qƒhS)q„}q…(h h{h)}q†(h-]h.]q‡(Uxrefqˆh€Xstd-refq‰eh,]h+]h/]uh!hyh]qŠhFX ref-varnishdq‹…qŒ}q(h Uh!h„ubah'h[ubaubhFX for details.qŽ…q}q(h X for details.h!hgubeubeubh3)q‘}q’(h Uh!hh"h%h'h8h)}q“(h-]h.]h,]h+]q”hah/]q•hauh1Kh2hh]q–(h?)q—}q˜(h XDefault behaviourq™h!h‘h"h%h'hCh)}qš(h-]h.]h,]h+]h/]uh1Kh2hh]q›hFXDefault behaviourqœ…q}qž(h h™h!h—ubaubhJ)qŸ}q (h X©The default for Varnish is to check if the client supports our compression scheme (gzip) and if it does it will override the Accept-Encoding header and set it to "gzip".q¡h!h‘h"h%h'hMh)}q¢(h-]h.]h,]h+]h/]uh1Kh2hh]q£hFX©The default for Varnish is to check if the client supports our compression scheme (gzip) and if it does it will override the Accept-Encoding header and set it to "gzip".q¤…q¥}q¦(h h¡h!hŸubaubhJ)q§}q¨(h XWhen Varnish then issues a backend request the Accept-Encoding will then only consist of "gzip". If the server responds with gzip'ed content it will be stored in memory in its compressed form. If the backend sends content in clear text it will be stored like that.q©h!h‘h"h%h'hMh)}qª(h-]h.]h,]h+]h/]uh1Kh2hh]q«hFXWhen Varnish then issues a backend request the Accept-Encoding will then only consist of "gzip". If the server responds with gzip'ed content it will be stored in memory in its compressed form. If the backend sends content in clear text it will be stored like that.q¬…q­}q®(h h©h!h§ubaubhJ)q¯}q°(h XuYou can make Varnish compress content before storing it in cache in vcl_fetch by setting do_gzip to true, like this::h!h‘h"h%h'hMh)}q±(h-]h.]h,]h+]h/]uh1Kh2hh]q²hFXtYou can make Varnish compress content before storing it in cache in vcl_fetch by setting do_gzip to true, like this:q³…q´}qµ(h XtYou can make Varnish compress content before storing it in cache in vcl_fetch by setting do_gzip to true, like this:h!h¯ubaubcdocutils.nodes literal_block q¶)q·}q¸(h Xr sub vcl_fetch { if (beresp.http.content-type ~ "text") { set beresp.do_gzip = true; } }h!h‘h"h%h'U literal_blockq¹h)}qº(U xml:spaceq»Upreserveq¼h+]h,]h-]h.]h/]uh1K h2hh]q½hFXr sub vcl_fetch { if (beresp.http.content-type ~ "text") { set beresp.do_gzip = true; } }q¾…q¿}qÀ(h Uh!h·ubaubhJ)qÁ}qÂ(h XPlease make sure that you don't try to compress content that is incompressable, like jpgs, gifs and mp3. You'll only waste CPU cycles. You can also uncompress objects before storing it in memory by setting do_gunzip to *true* but I have no idea why anybody would want to do that.h!h‘h"h%h'hMh)}qÃ(h-]h.]h,]h+]h/]uh1K&h2hh]qÄ(hFXÛPlease make sure that you don't try to compress content that is incompressable, like jpgs, gifs and mp3. You'll only waste CPU cycles. You can also uncompress objects before storing it in memory by setting do_gunzip to qÅ…qÆ}qÇ(h XÛPlease make sure that you don't try to compress content that is incompressable, like jpgs, gifs and mp3. You'll only waste CPU cycles. You can also uncompress objects before storing it in memory by setting do_gunzip to h!hÁubhS)qÈ}qÉ(h X*true*h)}qÊ(h-]h.]h,]h+]h/]uh!hÁh]qËhFXtrueqÌ…qÍ}qÎ(h Uh!hÈubah'h[ubhFX6 but I have no idea why anybody would want to do that.qÏ…qÐ}qÑ(h X6 but I have no idea why anybody would want to do that.h!hÁubeubhJ)qÒ}qÓ(h XÒ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.qÔh!h‘h"h%h'hMh)}qÕ(h-]h.]h,]h+]h/]uh1K,h2hh]qÖhFXÒ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.q×…qØ}qÙ(h hÔh!hÒubaubeubh3)qÚ}qÛ(h Uh!hh"h%h'h8h)}qÜ(h-]h.]h,]h+]qÝhah/]qÞh auh1K2h2hh]qß(h?)qà}qá(h X GZIP and ESIqâh!hÚh"h%h'hCh)}qã(h-]h.]h,]h+]h/]uh1K2h2hh]qähFX GZIP and ESIqå…qæ}qç(h hâh!hàubaubhJ)qè}qé(h XçIf you are using Edge Side Includes 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.qêh!hÚh"h%h'hMh)}që(h-]h.]h,]h+]h/]uh1K4h2hh]qìhFXçIf you are using Edge Side Includes 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.qí…qî}qï(h hêh!hèubaubeubh3)qð}qñ(h Uh!hh"h%h'h8h)}qò(h-]h.]h,]h+]qóhah/]qôh auh1K;h2hh]qõ(h?)qö}q÷(h XClients that don't support gzipqøh!hðh"h%h'hCh)}qù(h-]h.]h,]h+]h/]uh1K;h2hh]qúhFXClients that don't support gzipqû…qü}qý(h høh!höubaubhJ)qþ}qÿ(h XÝIf the client does not support gzip the Accept-Encoding header is left alone and we'll end up serving whatever we get from the backend server. Remember that the Backend might tell Varnish to *Vary* on the Accept-Encoding.h!hðh"h%h'hMh)}r(h-]h.]h,]h+]h/]uh1K=h2hh]r(hFX¿If the client does not support gzip the Accept-Encoding header is left alone and we'll end up serving whatever we get from the backend server. Remember that the Backend might tell Varnish to r…r}r(h X¿If the client does not support gzip the Accept-Encoding header is left alone and we'll end up serving whatever we get from the backend server. Remember that the Backend might tell Varnish to h!hþubhS)r}r(h X*Vary*h)}r(h-]h.]h,]h+]h/]uh!hþh]rhFXVaryr …r }r (h Uh!jubah'h[ubhFX on the Accept-Encoding.r …r }r(h X on the Accept-Encoding.h!hþubeubhJ)r}r(h X¨If the client does not support gzip but we've already got a compressed version of the page in memory Varnish will automatically decompress the page while delivering it.rh!hðh"h%h'hMh)}r(h-]h.]h,]h+]h/]uh1KBh2hh]rhFX¨If the client does not support gzip but we've already got a compressed version of the page in memory Varnish will automatically decompress the page while delivering it.r…r}r(h jh!jubaubeubh3)r}r(h Uh!hh"h%h'h8h)}r(h-]h.]h,]h+]rhah/]rhauh1KHh2hh]r(h?)r}r(h XA random outburstrh!jh"h%h'hCh)}r (h-]h.]h,]h+]h/]uh1KHh2hh]r!hFXA random outburstr"…r#}r$(h jh!jubaubhJ)r%}r&(h XZPoul has written :ref:`phk_gzip` which talks abit more about how the implementation works.h!jh"h%h'hMh)}r'(h-]h.]h,]h+]h/]uh1KJh2hh]r((hFXPoul has written r)…r*}r+(h XPoul has written h!j%ubhx)r,}r-(h X:ref:`phk_gzip`r.h!j%h"h%h'h|h)}r/(UreftypeXrefh~ˆhXphk_gzipU refdomainXstdr0h+]h,]U refexplicit‰h-]h.]h/]hh‚uh1KJh]r1hS)r2}r3(h j.h)}r4(h-]h.]r5(hˆj0Xstd-refr6eh,]h+]h/]uh!j,h]r7hFXphk_gzipr8…r9}r:(h Uh!j2ubah'h[ubaubhFX: which talks abit more about how the implementation works.r;…r<}r=(h X: which talks abit more about how the implementation works.h!j%ubeubeubeh UU transformerr>NU footnote_refsr?}r@UrefnamesrA}rBUsymbol_footnotesrC]rDUautofootnote_refsrE]rFUsymbol_footnote_refsrG]rHU citationsrI]rJh2hU current_linerKNUtransform_messagesrL]rMcdocutils.nodes system_message rN)rO}rP(h Uh)}rQ(h-]UlevelKh+]h,]Usourceh%h.]h/]UlineKUtypeUINFOrRuh]rShJ)rT}rU(h Uh)}rV(h-]h.]h,]h+]h/]uh!jOh]rWhFX:Hyperlink target "tutorial-compression" is not referenced.rX…rY}rZ(h Uh!jTubah'hMubah'Usystem_messager[ubaUreporterr\NUid_startr]KU autofootnotesr^]r_U citation_refsr`}raUindirect_targetsrb]rcUsettingsrd(cdocutils.frontend Values reorf}rg(Ufootnote_backlinksrhKUrecord_dependenciesriNU rfc_base_urlrjUhttp://tools.ietf.org/html/rkU tracebackrlˆUpep_referencesrmNUstrip_commentsrnNU toc_backlinksroUentryrpU language_coderqUenrrU datestamprsNU report_levelrtKU _destinationruNU halt_levelrvKU strip_classesrwNhCNUerror_encoding_error_handlerrxUbackslashreplaceryUdebugrzNUembed_stylesheetr{‰Uoutput_encoding_error_handlerr|Ustrictr}U sectnum_xformr~KUdump_transformsrNU docinfo_xformr€KUwarning_streamrNUpep_file_url_templater‚Upep-%04drƒUexit_status_levelr„KUconfigr…NUstrict_visitorr†NUcloak_email_addressesr‡ˆUtrim_footnote_reference_spacerˆ‰Uenvr‰NUdump_pseudo_xmlrŠNUexpose_internalsr‹NUsectsubtitle_xformrŒ‰U source_linkrNUrfc_referencesrŽNUoutput_encodingrUutf-8rU source_urlr‘NUinput_encodingr’U utf-8-sigr“U_disable_configr”NU id_prefixr•UU tab_widthr–KUerror_encodingr—UUTF-8r˜U_sourcer™U8/home/tfheen/varnish/doc/sphinx/tutorial/compression.rstršUgettext_compactr›ˆU generatorrœNUdump_internalsrNU smart_quotesrž‰U pep_base_urlrŸUhttp://www.python.org/dev/peps/r Usyntax_highlightr¡Ulongr¢Uinput_encoding_error_handlerr£j}Uauto_id_prefixr¤Uidr¥Udoctitle_xformr¦‰Ustrip_elements_with_classesr§NU _config_filesr¨]r©Ufile_insertion_enabledrªKU raw_enabledr«KU dump_settingsr¬NubUsymbol_footnote_startr­KUidsr®}r¯(hhðhh4hh‘hhÚhh4hjuUsubstitution_namesr°}r±h'h2h)}r²(h-]h+]h,]Usourceh%h.]h/]uU footnotesr³]r´Urefidsrµ}r¶h]r·hasub.varnish-3.0.5/doc/sphinx/=build/doctrees/tutorial/vary.doctree0000644000175000017500000002434112247037213021374 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(X tutorial-varyqˆXvary parse errorsqNXvaryqNXpitfall - vary: user-agentq NuUsubstitution_defsq }q Uparse_messagesq ]q Ucurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hU tutorial-varyqhUvary-parse-errorsqhUvaryqh Upitfall-vary-user-agentquUchildrenq]q(cdocutils.nodes target q)q}q(U rawsourceqX.. _tutorial-vary:UparentqhUsourceqcdocutils.nodes reprunicode qX1/home/tfheen/varnish/doc/sphinx/tutorial/vary.rstq …q!}q"bUtagnameq#Utargetq$U attributesq%}q&(Uidsq']Ubackrefsq(]Udupnamesq)]Uclassesq*]Unamesq+]Urefidq,huUlineq-KUdocumentq.hh]ubcdocutils.nodes section q/)q0}q1(hUhhhh!Uexpect_referenced_by_nameq2}q3hhsh#Usectionq4h%}q5(h)]h*]h(]h']q6(hheh+]q7(hheuh-Kh.hUexpect_referenced_by_idq8}q9hhsh]q:(cdocutils.nodes title q;)q<}q=(hXVaryq>hh0hh!h#Utitleq?h%}q@(h)]h*]h(]h']h+]uh-Kh.hh]qAcdocutils.nodes Text qBXVaryqC…qD}qE(hh>hh}r?(hhhh0hh‡hh0uUsubstitution_namesr@}rAh#h.h%}rB(h)]h']h(]Usourceh!h*]h+]uU footnotesrC]rDUrefidsrE}rFh]rGhasub.varnish-3.0.5/doc/sphinx/=build/doctrees/tutorial/troubleshooting.doctree0000644000175000017500000003361312247037213023644 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(Xtroubleshooting varnishqNXwhen varnish won't startqNX varnish gives me guru meditationqNXvarnish doesn't cacheq NXvarnish is crashingq NuUsubstitution_defsq }q Uparse_messagesq ]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hUtroubleshooting-varnishqhUwhen-varnish-won-t-startqhU varnish-gives-me-guru-meditationqh Uvarnish-doesn-t-cacheqh Uvarnish-is-crashingquUchildrenq]qcdocutils.nodes section q)q}q(U rawsourceqUUparentqhUsourceq cdocutils.nodes reprunicode q!X</home/tfheen/varnish/doc/sphinx/tutorial/troubleshooting.rstq"…q#}q$bUtagnameq%Usectionq&U attributesq'}q((Udupnamesq)]Uclassesq*]Ubackrefsq+]Uidsq,]q-haUnamesq.]q/hauUlineq0KUdocumentq1hh]q2(cdocutils.nodes title q3)q4}q5(hXTroubleshooting Varnishq6hhh h#h%Utitleq7h'}q8(h)]h*]h+]h,]h.]uh0Kh1hh]q9cdocutils.nodes Text q:XTroubleshooting Varnishq;…q<}q=(hh6hh4ubaubcdocutils.nodes paragraph q>)q?}q@(hXèSometimes Varnish misbehaves. In order for you to understand whats going on there are a couple of places you can check. varnishlog, /var/log/syslog, /var/log/messages are all places where varnish might leave clues of whats going on.qAhhh h#h%U paragraphqBh'}qC(h)]h*]h+]h,]h.]uh0Kh1hh]qDh:XèSometimes Varnish misbehaves. In order for you to understand whats going on there are a couple of places you can check. varnishlog, /var/log/syslog, /var/log/messages are all places where varnish might leave clues of whats going on.qE…qF}qG(hhAhh?ubaubh)qH}qI(hUhhh h#h%h&h'}qJ(h)]h*]h+]h,]qKhah.]qLhauh0K h1hh]qM(h3)qN}qO(hXWhen Varnish won't startqPhhHh h#h%h7h'}qQ(h)]h*]h+]h,]h.]uh0K h1hh]qRh:XWhen Varnish won't startqS…qT}qU(hhPhhNubaubh>)qV}qW(hXÅSometimes Varnish wont start. There is a plethora of reasons why Varnish wont start on your machine. We've seen everything from wrong permissions on /dev/null to other processes blocking the ports.qXhhHh h#h%hBh'}qY(h)]h*]h+]h,]h.]uh0K h1hh]qZh:XÅSometimes Varnish wont start. There is a plethora of reasons why Varnish wont start on your machine. We've seen everything from wrong permissions on /dev/null to other processes blocking the ports.q[…q\}q](hhXhhVubaubh>)q^}q_(hX7Starting Varnish in debug mode to see what is going on.q`hhHh h#h%hBh'}qa(h)]h*]h+]h,]h.]uh0Kh1hh]qbh:X7Starting Varnish in debug mode to see what is going on.qc…qd}qe(hh`hh^ubaubh>)qf}qg(hXTry to start varnish by::qhhhHh h#h%hBh'}qi(h)]h*]h+]h,]h.]uh0Kh1hh]qjh:XTry to start varnish by:qk…ql}qm(hXTry to start varnish by:hhfubaubcdocutils.nodes literal_block qn)qo}qp(hXc# varnishd -f /usr/local/etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1:2000 -a 0.0.0.0:8080 -dhhHh h#h%U literal_blockqqh'}qr(U xml:spaceqsUpreserveqth,]h+]h)]h*]h.]uh0Kh1hh]quh:Xc# varnishd -f /usr/local/etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1:2000 -a 0.0.0.0:8080 -dqv…qw}qx(hUhhoubaubh>)qy}qz(hXžNotice the -d option. It will give you some more information on what is going on. Let us see how Varnish will react to something else listening on its port.::hhHh h#h%hBh'}q{(h)]h*]h+]h,]h.]uh0Kh1hh]q|h:XNotice the -d option. It will give you some more information on what is going on. Let us see how Varnish will react to something else listening on its port.:q}…q~}q(hXNotice the -d option. It will give you some more information on what is going on. Let us see how Varnish will react to something else listening on its port.:hhyubaubhn)q€}q(hX–# 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.hhHh h#h%hqh'}q‚(hshth,]h+]h)]h*]h.]uh0Kh1hh]qƒh:X–# 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.q„…q…}q†(hUhh€ubaubh>)q‡}qˆ(hXËNow Varnish is running. 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".::hhHh h#h%hBh'}q‰(h)]h*]h+]h,]h.]uh0K'h1hh]qŠh:XÊNow Varnish is running. 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".:q‹…qŒ}q(hXÊNow Varnish is running. 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".:hh‡ubaubhn)qŽ}q(hXBstart bind(): Address already in use 300 22 Could not open socketshhHh h#h%hqh'}q(hshth,]h+]h)]h*]h.]uh0K+h1hh]q‘h:XBstart bind(): Address already in use 300 22 Could not open socketsq’…q“}q”(hUhhŽubaubh>)q•}q–(hX“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.q—hhHh h#h%hBh'}q˜(h)]h*]h+]h,]h.]uh0K0h1hh]q™h:X“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.qš…q›}qœ(hh—hh•ubaubeubh)q}qž(hUhhh h#h%h&h'}qŸ(h)]h*]h+]h,]q hah.]q¡h auh0K6h1hh]q¢(h3)q£}q¤(hXVarnish is crashingq¥hhh h#h%h7h'}q¦(h)]h*]h+]h,]h.]uh0K6h1hh]q§h:XVarnish is crashingq¨…q©}qª(hh¥hh£ubaubh>)q«}q¬(hXÅWhen varnish goes bust the child processes crashes. Usually the mother process will manage this by restarting the child process again. Any errors will be logged in syslog. It might look like this::hhh h#h%hBh'}q­(h)]h*]h+]h,]h.]uh0K8h1hh]q®h:XÄWhen varnish goes bust the child processes crashes. Usually the mother process will manage this by restarting the child process again. Any errors will be logged in syslog. It might look like this:q¯…q°}q±(hXÄWhen varnish goes bust the child processes crashes. Usually the mother process will manage this by restarting the child process again. Any errors will be logged in syslog. It might look like this:hh«ubaubhn)q²}q³(hXZMar 8 13:23:38 smoke varnishd[15670]: Child (15671) not responding to CLI, killing it. Mar 8 13:23:43 smoke varnishd[15670]: last message repeated 2 times Mar 8 13:23:43 smoke varnishd[15670]: Child (15671) died signal=3 Mar 8 13:23:43 smoke varnishd[15670]: Child cleanup complete Mar 8 13:23:43 smoke varnishd[15670]: child (15697) Startedhhh h#h%hqh'}q´(hshth,]h+]h)]h*]h.]uh0K)q¹}qº(hXVSpecifically if you see the "Error in munmap" error on Linux you might want to increase the amount of maps available. Linux is limited to a maximum of 64k maps. Setting vm.max_map_count in sysctl.conf will enable you to increase this limit. You can inspect the number of maps your program is consuming by counting the lines in /proc/$PID/mapsq»hhh h#h%hBh'}q¼(h)]h*]h+]h,]h.]uh0KBh1hh]q½h:XVSpecifically if you see the "Error in munmap" error on Linux you might want to increase the amount of maps available. Linux is limited to a maximum of 64k maps. Setting vm.max_map_count in sysctl.conf will enable you to increase this limit. You can inspect the number of maps your program is consuming by counting the lines in /proc/$PID/mapsq¾…q¿}qÀ(hh»hh¹ubaubh>)qÁ}qÂ(hX}This is a rather odd thing to document here - but hopefully Google will serve you this page if you ever encounter this error.qÃhhh h#h%hBh'}qÄ(h)]h*]h+]h,]h.]uh0KHh1hh]qÅh:X}This is a rather odd thing to document here - but hopefully Google will serve you this page if you ever encounter this error.qÆ…qÇ}qÈ(hhÃhhÁubaubeubh)qÉ}qÊ(hUhhh h#h%h&h'}qË(h)]h*]h+]h,]qÌhah.]qÍhauh0KLh1hh]qÎ(h3)qÏ}qÐ(hX Varnish gives me Guru meditationqÑhhÉh h#h%h7h'}qÒ(h)]h*]h+]h,]h.]uh0KLh1hh]qÓh:X Varnish gives me Guru meditationqÔ…qÕ}qÖ(hhÑhhÏubaubh>)q×}qØ(hXúFirst find the relevant log entries in varnishlog. That will probably give you a clue. Since varnishlog logs so much 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::hhÉh h#h%hBh'}qÙ(h)]h*]h+]h,]h.]uh0KNh1hh]qÚh:XùFirst find the relevant log entries in varnishlog. That will probably give you a clue. Since varnishlog logs so much 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:qÛ…qÜ}qÝ(hXùFirst find the relevant log entries in varnishlog. That will probably give you a clue. Since varnishlog logs so much 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:hh×ubaubhn)qÞ}qß(hX$ varnishlog -c -m TxStatus:503hhÉh h#h%hqh'}qà(hshth,]h+]h)]h*]h.]uh0KSh1hh]qáh:X$ varnishlog -c -m TxStatus:503qâ…qã}qä(hUhhÞubaubh>)qå}qæ(hX¾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 option::hhÉh h#h%hBh'}qç(h)]h*]h+]h,]h.]uh0KUh1hh]qèh:X½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 option:qé…qê}që(hX½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 option:hhåubaubhn)qì}qí(hX"$ varnishlog -d -c -m TxStatus:503hhÉh h#h%hqh'}qî(hshth,]h+]h)]h*]h.]uh0KYh1hh]qïh:X"$ varnishlog -d -c -m TxStatus:503qð…qñ}qò(hUhhìubaubh>)qó}qô(hX}Please see the varnishlog man page for elaborations on further filtering capabilities and explanation of the various options.qõhhÉh h#h%hBh'}qö(h)]h*]h+]h,]h.]uh0K[h1hh]q÷h:X}Please see the varnishlog man page for elaborations on further filtering capabilities and explanation of the various options.qø…qù}qú(hhõhhóubaubeubh)qû}qü(hUhhh h#h%h&h'}qý(h)]h*]h+]h,]qþhah.]qÿh auh0K`h1hh]r(h3)r}r(hXVarnish doesn't cacherhhûh h#h%h7h'}r(h)]h*]h+]h,]h.]uh0K`h1hh]rh:XVarnish doesn't cacher…r}r(hjhjubaubh>)r }r (hX,See :ref:`tutorial-increasing_your_hitrate`.r hhûh h#h%hBh'}r (h)]h*]h+]h,]h.]uh0Kbh1hh]r (h:XSee r…r}r(hXSee hj ubcsphinx.addnodes pending_xref r)r}r(hX':ref:`tutorial-increasing_your_hitrate`rhj h h#h%U pending_xrefrh'}r(UreftypeXrefUrefwarnrˆU reftargetrX tutorial-increasing_your_hitrateU refdomainXstdrh,]h+]U refexplicit‰h)]h*]h.]UrefdocrUtutorial/troubleshootingruh0Kbh]rcdocutils.nodes emphasis r)r}r(hjh'}r (h)]h*]r!(Uxrefr"jXstd-refr#eh+]h,]h.]uhjh]r$h:X tutorial-increasing_your_hitrater%…r&}r'(hUhjubah%Uemphasisr(ubaubh:X.…r)}r*(hX.hj ubeubeubeubahUU transformerr+NU footnote_refsr,}r-Urefnamesr.}r/Usymbol_footnotesr0]r1Uautofootnote_refsr2]r3Usymbol_footnote_refsr4]r5U citationsr6]r7h1hU current_liner8NUtransform_messagesr9]r:Ureporterr;NUid_startr<KU autofootnotesr=]r>U citation_refsr?}r@Uindirect_targetsrA]rBUsettingsrC(cdocutils.frontend Values rDorE}rF(Ufootnote_backlinksrGKUrecord_dependenciesrHNU rfc_base_urlrIUhttp://tools.ietf.org/html/rJU tracebackrKˆUpep_referencesrLNUstrip_commentsrMNU toc_backlinksrNUentryrOU language_coderPUenrQU datestamprRNU report_levelrSKU _destinationrTNU halt_levelrUKU strip_classesrVNh7NUerror_encoding_error_handlerrWUbackslashreplacerXUdebugrYNUembed_stylesheetrZ‰Uoutput_encoding_error_handlerr[Ustrictr\U sectnum_xformr]KUdump_transformsr^NU docinfo_xformr_KUwarning_streamr`NUpep_file_url_templateraUpep-%04drbUexit_status_levelrcKUconfigrdNUstrict_visitorreNUcloak_email_addressesrfˆUtrim_footnote_reference_spacerg‰UenvrhNUdump_pseudo_xmlriNUexpose_internalsrjNUsectsubtitle_xformrk‰U source_linkrlNUrfc_referencesrmNUoutput_encodingrnUutf-8roU source_urlrpNUinput_encodingrqU utf-8-sigrrU_disable_configrsNU id_prefixrtUU tab_widthruKUerror_encodingrvUUTF-8rwU_sourcerxUXBackend serversq?…q@}qA(hh:hh8ubaubcdocutils.nodes paragraph qB)qC}qD(hX…Varnish has a concept of "backend" or "origin" servers. A backend server is the server providing the content Varnish will accelerate.qEhh,hhhU paragraphqFh!}qG(h%]h&]h$]h#]h']uh)Kh*hh]qHh>X…Varnish has a concept of "backend" or "origin" servers. A backend server is the server providing the content Varnish will accelerate.qI…qJ}qK(hhEhhCubaubhB)qL}qM(hX#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.qNhh,hhhhFh!}qO(h%]h&]h$]h#]h']uh)K h*hh]qPh>X#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.qQ…qR}qS(hhNhhLubaubhB)qT}qU(hXJSomewhere in the top there will be a section that looks a bit like this.::qVhh,hhhhFh!}qW(h%]h&]h$]h#]h']uh)Kh*hh]qXh>XISomewhere in the top there will be a section that looks a bit like this.:qY…qZ}q[(hXISomewhere in the top there will be a section that looks a bit like this.:hhTubaubcdocutils.nodes literal_block q\)q]}q^(hXH# backend default { # .host = "127.0.0.1"; # .port = "8080"; # }hh,hhhU literal_blockq_h!}q`(U xml:spaceqaUpreserveqbh#]h$]h%]h&]h']uh)Kh*hh]qch>XH# backend default { # .host = "127.0.0.1"; # .port = "8080"; # }qd…qe}qf(hUhh]ubaubhB)qg}qh(hXhWe comment in this bit of text and change the port setting from 8080 to 80, making the text look like.::hh,hhhhFh!}qi(h%]h&]h$]h#]h']uh)Kh*hh]qjh>XgWe comment in this bit of text and change the port setting from 8080 to 80, making the text look like.:qk…ql}qm(hXgWe comment in this bit of text and change the port setting from 8080 to 80, making the text look like.:hhgubaubh\)qn}qo(hXBbackend default { .host = "127.0.0.1"; .port = "80"; }hh,hhhh_h!}qp(hahbh#]h$]h%]h&]h']uh)Kh*hh]qqh>XBbackend default { .host = "127.0.0.1"; .port = "80"; }qr…qs}qt(hUhhnubaubhB)qu}qv(hX¸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 80 on localhost (127.0.0.1).hh,hhhhFh!}qw(h%]h&]h$]h#]h']uh)Kh*hh]qx(h>XENow, this piece of configuration defines a backend in Varnish called qy…qz}q{(hXENow, this piece of configuration defines a backend in Varnish called hhuubcdocutils.nodes emphasis q|)q}}q~(hX *default*h!}q(h%]h&]h$]h#]h']uhhuh]q€h>Xdefaultq…q‚}qƒ(hUhh}ubahUemphasisq„ubh>Xj. When Varnish needs to get content from this backend it will connect to port 80 on localhost (127.0.0.1).q……q†}q‡(hXj. When Varnish needs to get content from this backend it will connect to port 80 on localhost (127.0.0.1).hhuubeubhB)qˆ}q‰(hX”Varnish can have several backends defined and can you can even join several backends together into clusters of backends for load balancing purposes.qŠhh,hhhhFh!}q‹(h%]h&]h$]h#]h']uh)K"h*hh]qŒh>X”Varnish can have several backends defined and can you can even join several backends together into clusters of backends for load balancing purposes.q…qŽ}q(hhŠhhˆubaubhB)q}q‘(hXˆNow that we have the basic Varnish configuration done, let us start up Varnish on port 8080 so we can do some fundamental testing on it.q’hh,hhhhFh!}q“(h%]h&]h$]h#]h']uh)K&h*hh]q”h>XˆNow that we have the basic Varnish configuration done, let us start up Varnish on port 8080 so we can do some fundamental testing on it.q•…q–}q—(hh’hhubaubeubehUU transformerq˜NU footnote_refsq™}qšUrefnamesq›}qœUsymbol_footnotesq]qžUautofootnote_refsqŸ]q Usymbol_footnote_refsq¡]q¢U citationsq£]q¤h*hU current_lineq¥NUtransform_messagesq¦]q§cdocutils.nodes system_message q¨)q©}qª(hUh!}q«(h%]UlevelKh#]h$]Usourcehh&]h']UlineKUtypeUINFOq¬uh]q­hB)q®}q¯(hUh!}q°(h%]h&]h$]h#]h']uhh©h]q±h>X>Hyperlink target "tutorial-backend-servers" is not referenced.q²…q³}q´(hUhh®ubahhFubahUsystem_messageqµubaUreporterq¶NUid_startq·KU autofootnotesq¸]q¹U citation_refsqº}q»Uindirect_targetsq¼]q½Usettingsq¾(cdocutils.frontend Values q¿oqÀ}qÁ(Ufootnote_backlinksqÂKUrecord_dependenciesqÃNU rfc_base_urlqÄUhttp://tools.ietf.org/html/qÅU tracebackqƈUpep_referencesqÇNUstrip_commentsqÈNU toc_backlinksqÉUentryqÊU language_codeqËUenqÌU datestampqÍNU report_levelqÎKU _destinationqÏNU halt_levelqÐKU strip_classesqÑNh;NUerror_encoding_error_handlerqÒUbackslashreplaceqÓUdebugqÔNUembed_stylesheetqÕ‰Uoutput_encoding_error_handlerqÖUstrictq×U sectnum_xformqØKUdump_transformsqÙNU docinfo_xformqÚKUwarning_streamqÛNUpep_file_url_templateqÜUpep-%04dqÝUexit_status_levelqÞKUconfigqßNUstrict_visitorqàNUcloak_email_addressesqáˆUtrim_footnote_reference_spaceqâ‰UenvqãNUdump_pseudo_xmlqäNUexpose_internalsqåNUsectsubtitle_xformqæ‰U source_linkqçNUrfc_referencesqèNUoutput_encodingqéUutf-8qêU source_urlqëNUinput_encodingqìU utf-8-sigqíU_disable_configqîNU id_prefixqïUU tab_widthqðKUerror_encodingqñUUTF-8qòU_sourceqóU}q?(hXAdvanced topicsq@hh2h h#h%UtitleqAh'}qB(h+]h,]h*]h)]h-]uh/Kh0hh]qCcdocutils.nodes Text qDXAdvanced topicsqE…qF}qG(hh@hh>ubaubcdocutils.nodes paragraph qH)qI}qJ(hXzThis tutorial has covered the basics in Varnish. If you read through it all you should now have the skills to run Varnish.qKhh2h h#h%U paragraphqLh'}qM(h+]h,]h*]h)]h-]uh/Kh0hh]qNhDXzThis tutorial has covered the basics in Varnish. If you read through it all you should now have the skills to run Varnish.qO…qP}qQ(hhKhhIubaubhH)qR}qS(hXKHere is a short overview of topics that we haven't covered in the tutorial.qThh2h h#h%hLh'}qU(h+]h,]h*]h)]h-]uh/K h0hh]qVhDXKHere is a short overview of topics that we haven't covered in the tutorial.qW…qX}qY(hhThhRubaubh1)qZ}q[(hUhh2h h#h%h6h'}q\(h+]h,]h*]h)]q]hah-]q^hauh/K h0hh]q_(h=)q`}qa(hXMore VCLqbhhZh h#h%hAh'}qc(h+]h,]h*]h)]h-]uh/K h0hh]qdhDXMore VCLqe…qf}qg(hhbhh`ubaubhH)qh}qi(hXïVCL is a bit more complex then what we've covered so far. There are a few more subroutines available and there a few actions that we haven't discussed. For a complete(ish) guide to VCL have a look at the VCL man page - ref:`reference-vcl`.hhZh h#h%hLh'}qj(h+]h,]h*]h)]h-]uh/Kh0hh]qk(hDXßVCL is a bit more complex then what we've covered so far. There are a few more subroutines available and there a few actions that we haven't discussed. For a complete(ish) guide to VCL have a look at the VCL man page - ref:ql…qm}qn(hXßVCL is a bit more complex then what we've covered so far. There are a few more subroutines available and there a few actions that we haven't discussed. For a complete(ish) guide to VCL have a look at the VCL man page - ref:hhhubcdocutils.nodes title_reference qo)qp}qq(hX`reference-vcl`h'}qr(h+]h,]h*]h)]h-]uhhhh]qshDX reference-vclqt…qu}qv(hUhhpubah%Utitle_referenceqwubhDX.…qx}qy(hX.hhhubeubeubh1)qz}q{(hUhh2h h#h%h6h'}q|(h+]h,]h*]h)]q}hah-]q~h auh/Kh0hh]q(h=)q€}q(hX!Using In-line C to extend Varnishq‚hhzh h#h%hAh'}qƒ(h+]h,]h*]h)]h-]uh/Kh0hh]q„hDX!Using In-line C to extend Varnishq……q†}q‡(hh‚hh€ubaubhH)qˆ}q‰(hXÓYou can use *in-line 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.hhzh h#h%hLh'}qŠ(h+]h,]h*]h)]h-]uh/Kh0hh]q‹(hDX You can use qŒ…q}qŽ(hX You can use hhˆubcdocutils.nodes emphasis q)q}q‘(hX *in-line C*h'}q’(h+]h,]h*]h)]h-]uhhˆh]q“hDX in-line Cq”…q•}q–(hUhhubah%Uemphasisq—ubhDX¼ 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.q˜…q™}qš(hX¼ 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.hhˆubeubhH)q›}qœ(hXAOne of the first uses I saw of In-line C was logging to syslog.::qhhzh h#h%hLh'}qž(h+]h,]h*]h)]h-]uh/Kh0hh]qŸhDX@One of the first uses I saw of In-line C was logging to syslog.:q …q¡}q¢(hX@One of the first uses I saw of In-line C was logging to syslog.:hh›ubaubcdocutils.nodes literal_block q£)q¤}q¥(hXÐ# 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 }hhzh h#h%U literal_blockq¦h'}q§(U xml:spaceq¨Upreserveq©h)]h*]h+]h,]h-]uh/Kh0hh]qªhDXÐ# 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 }q«…q¬}q­(hUhh¤ubaubeubh1)q®}q¯(hUhh2h h#h%h6h'}q°(h+]h,]h*]h)]q±hah-]q²h auh/K)h0hh]q³(h=)q´}qµ(hXEdge Side Includesq¶hh®h h#h%hAh'}q·(h+]h,]h*]h)]h-]uh/K)h0hh]q¸hDXEdge Side Includesq¹…qº}q»(hh¶hh´ubaubhH)q¼}q½(hXšVarnish can cache create web pages by putting different pages together. These *fragments* can have individual cache policies. If you have a web site with a list showing the 5 most popular articles on your site, this list can probably be cached as a fragment and included in all the other pages. Used properly it can dramatically increase your hit rate and reduce the load on your servers. ESI looks like this::hh®h h#h%hLh'}q¾(h+]h,]h*]h)]h-]uh/K+h0hh]q¿(hDXNVarnish can cache create web pages by putting different pages together. These qÀ…qÁ}qÂ(hXNVarnish can cache create web pages by putting different pages together. These hh¼ubh)qÃ}qÄ(hX *fragments*h'}qÅ(h+]h,]h*]h)]h-]uhh¼h]qÆhDX fragmentsqÇ…qÈ}qÉ(hUhhÃubah%h—ubhDX@ can have individual cache policies. If you have a web site with a list showing the 5 most popular articles on your site, this list can probably be cached as a fragment and included in all the other pages. Used properly it can dramatically increase your hit rate and reduce the load on your servers. ESI looks like this:qÊ…qË}qÌ(hX@ can have individual cache policies. If you have a web site with a list showing the 5 most popular articles on your site, this list can probably be cached as a fragment and included in all the other pages. Used properly it can dramatically increase your hit rate and reduce the load on your servers. ESI looks like this:hh¼ubeubh£)qÍ}qÎ(hXf The time is: at this very moment. hh®h h#h%h¦h'}qÏ(h¨h©h)]h*]h+]h,]h-]uh/K2h0hh]qÐhDXf The time is: at this very moment. qÑ…qÒ}qÓ(hUhhÍubaubhH)qÔ}qÕ(hX<ESI is processed in vcl_fetch by setting *do_esi* to true.::qÖhh®h h#h%hLh'}q×(h+]h,]h*]h)]h-]uh/K9h0hh]qØ(hDX)ESI is processed in vcl_fetch by setting qÙ…qÚ}qÛ(hX)ESI is processed in vcl_fetch by setting hhÔubh)qÜ}qÝ(hX*do_esi*h'}qÞ(h+]h,]h*]h)]h-]uhhÔh]qßhDXdo_esiqà…qá}qâ(hUhhÜubah%h—ubhDX to true.:qã…qä}qå(hX to true.:hhÔubeubh£)qæ}qç(hXusub vcl_fetch { if (req.url == "/test.html") { set beresp.do_esi = true; /* Do ESI processing */ } }hh®h h#h%h¦h'}qè(h¨h©h)]h*]h+]h,]h-]uh/K;h0hh]qéhDXusub vcl_fetch { if (req.url == "/test.html") { set beresp.do_esi = true; /* Do ESI processing */ } }qê…që}qì(hUhhæubaubeubeubehUU transformerqíNU footnote_refsqî}qïUrefnamesqð}qñUsymbol_footnotesqò]qóUautofootnote_refsqô]qõUsymbol_footnote_refsqö]q÷U citationsqø]qùh0hU current_lineqúNUtransform_messagesqû]qücdocutils.nodes system_message qý)qþ}qÿ(hUh'}r(h+]UlevelKh)]h*]Usourceh#h,]h-]UlineKUtypeUINFOruh]rhH)r}r(hUh'}r(h+]h,]h*]h)]h-]uhhþh]rhDX>Hyperlink target "tutorial-advanced-topics" is not referenced.r…r}r (hUhjubah%hLubah%Usystem_messager ubaUreporterr NUid_startr KU autofootnotesr ]rU citation_refsr}rUindirect_targetsr]rUsettingsr(cdocutils.frontend Values ror}r(Ufootnote_backlinksrKUrecord_dependenciesrNU rfc_base_urlrUhttp://tools.ietf.org/html/rU tracebackrˆUpep_referencesrNUstrip_commentsrNU toc_backlinksrUentryrU language_coder Uenr!U datestampr"NU report_levelr#KU _destinationr$NU halt_levelr%KU strip_classesr&NhANUerror_encoding_error_handlerr'Ubackslashreplacer(Udebugr)NUembed_stylesheetr*‰Uoutput_encoding_error_handlerr+Ustrictr,U sectnum_xformr-KUdump_transformsr.NU docinfo_xformr/KUwarning_streamr0NUpep_file_url_templater1Upep-%04dr2Uexit_status_levelr3KUconfigr4NUstrict_visitorr5NUcloak_email_addressesr6ˆUtrim_footnote_reference_spacer7‰Uenvr8NUdump_pseudo_xmlr9NUexpose_internalsr:NUsectsubtitle_xformr;‰U source_linkr<NUrfc_referencesr=NUoutput_encodingr>Uutf-8r?U source_urlr@NUinput_encodingrAU utf-8-sigrBU_disable_configrCNU id_prefixrDUU tab_widthrEKUerror_encodingrFUUTF-8rGU_sourcerHU(cdocutils.nodes title q?)q@}qA(h XMisbehaving serversqBh!h4h"h%h'UtitleqCh)}qD(h-]h.]h,]h+]h/]uh1Kh2hh]qEcdocutils.nodes Text qFXMisbehaving serversqG…qH}qI(h hBh!h@ubaubcdocutils.nodes paragraph qJ)qK}qL(h XdA key feature of Varnish is its ability to shield you from misbehaving web- and application servers.qMh!h4h"h%h'U paragraphqNh)}qO(h-]h.]h,]h+]h/]uh1Kh2hh]qPhFXdA key feature of Varnish is its ability to shield you from misbehaving web- and application servers.qQ…qR}qS(h hMh!hKubaubh3)qT}qU(h Uh!h4h"h%h'h8h)}qV(h-]h.]h,]h+]qWhah/]qXh auh1K h2hh]qY(h?)qZ}q[(h X Grace modeq\h!hTh"h%h'hCh)}q](h-]h.]h,]h+]h/]uh1K h2hh]q^hFX Grace modeq_…q`}qa(h h\h!hZubaubhJ)qb}qc(h Xþ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 back end. In some products this is called request coalescing and Varnish does this automatically.qdh!hTh"h%h'hNh)}qe(h-]h.]h,]h+]h/]uh1Kh2hh]qfhFXþ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 back end. In some products this is called request coalescing and Varnish does this automatically.qg…qh}qi(h hdh!hbubaubhJ)qj}qk(h X©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.qlh!hTh"h%h'hNh)}qm(h-]h.]h,]h+]h/]uh1Kh2hh]qnhFX©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.qo…qp}qq(h hlh!hjubaubhJ)qr}qs(h X©So, in order to serve stale content we must first have some content to serve. So to make Varnish keep all objects for 30 minutes beyond their TTL use the following VCL::h!hTh"h%h'hNh)}qt(h-]h.]h,]h+]h/]uh1Kh2hh]quhFX¨So, in order to serve stale content we must first have some content to serve. So to make Varnish keep all objects for 30 minutes beyond their TTL use the following VCL:qv…qw}qx(h X¨So, in order to serve stale content we must first have some content to serve. So to make Varnish keep all objects for 30 minutes beyond their TTL use the following VCL:h!hrubaubcdocutils.nodes literal_block qy)qz}q{(h X+sub vcl_fetch { set beresp.grace = 30m; }h!hTh"h%h'U literal_blockq|h)}q}(U xml:spaceq~Upreserveqh+]h,]h-]h.]h/]uh1Kh2hh]q€hFX+sub vcl_fetch { set beresp.grace = 30m; }q…q‚}qƒ(h Uh!hzubaubhJ)q„}q…(h XÃVarnish still won't serve the stale objects. In order to enable Varnish to actually serve the stale object we must enable this on the request. Lets us say that we accept serving 15s old object.::h!hTh"h%h'hNh)}q†(h-]h.]h,]h+]h/]uh1K#h2hh]q‡hFXÂVarnish still won't serve the stale objects. In order to enable Varnish to actually serve the stale object we must enable this on the request. Lets us say that we accept serving 15s old object.:qˆ…q‰}qŠ(h XÂVarnish still won't serve the stale objects. In order to enable Varnish to actually serve the stale object we must enable this on the request. Lets us say that we accept serving 15s old object.:h!h„ubaubhy)q‹}qŒ(h X'sub vcl_recv { set req.grace = 15s; }h!hTh"h%h'h|h)}q(h~hh+]h,]h-]h.]h/]uh1K'h2hh]qŽhFX'sub vcl_recv { set req.grace = 15s; }q…q}q‘(h Uh!h‹ubaubhJ)q’}q“(h XYou might wonder why we should keep the objects in the cache for 30 minutes if we are unable to serve them? Well, if you have enabled :ref:`tutorial-advanced_backend_servers-health` you can check if the backend is sick and if it is we can serve the stale content for a bit longer.::h!hTh"h%h'hNh)}q”(h-]h.]h,]h+]h/]uh1K+h2hh]q•(hFX†You might wonder why we should keep the objects in the cache for 30 minutes if we are unable to serve them? Well, if you have enabled q–…q—}q˜(h X†You might wonder why we should keep the objects in the cache for 30 minutes if we are unable to serve them? Well, if you have enabled h!h’ubcsphinx.addnodes pending_xref q™)qš}q›(h X/:ref:`tutorial-advanced_backend_servers-health`qœh!h’h"h%h'U pending_xrefqh)}qž(UreftypeXrefUrefwarnqŸˆU reftargetq X(tutorial-advanced_backend_servers-healthU refdomainXstdq¡h+]h,]U refexplicit‰h-]h.]h/]Urefdocq¢U%tutorial/handling_misbehaving_serversq£uh1K+h]q¤cdocutils.nodes emphasis q¥)q¦}q§(h hœh)}q¨(h-]h.]q©(Uxrefqªh¡Xstd-refq«eh,]h+]h/]uh!hšh]q¬hFX(tutorial-advanced_backend_servers-healthq­…q®}q¯(h Uh!h¦ubah'Uemphasisq°ubaubhFXd you can check if the backend is sick and if it is we can serve the stale content for a bit longer.:q±…q²}q³(h Xd you can check if the backend is sick and if it is we can serve the stale content for a bit longer.:h!h’ubeubhy)q´}qµ(h XVif (! req.backend.healthy) { set req.grace = 5m; } else { set req.grace = 15s; }h!hTh"h%h'h|h)}q¶(h~hh+]h,]h-]h.]h/]uh1K1h2hh]q·hFXVif (! req.backend.healthy) { set req.grace = 5m; } else { set req.grace = 15s; }q¸…q¹}qº(h Uh!h´ubaubcdocutils.nodes definition_list q»)q¼}q½(h Uh!hTh"Nh'Udefinition_listq¾h)}q¿(h-]h.]h,]h+]h/]uh1Nh2hh]qÀcdocutils.nodes definition_list_item qÁ)qÂ}qÃ(h XœSo, to sum up, grace mode solves two problems: * it serves stale content to avoid request pile-up. * it serves stale content if the backend is not healthy. h!h¼h"h%h'Udefinition_list_itemqÄh)}qÅ(h-]h.]h,]h+]h/]uh1K9h]qÆ(cdocutils.nodes term qÇ)qÈ}qÉ(h X.So, to sum up, grace mode solves two problems:qÊh!hÂh"h%h'UtermqËh)}qÌ(h-]h.]h,]h+]h/]uh1K9h]qÍhFX.So, to sum up, grace mode solves two problems:qÎ…qÏ}qÐ(h hÊh!hÈubaubcdocutils.nodes definition qÑ)qÒ}qÓ(h Uh)}qÔ(h-]h.]h,]h+]h/]uh!hÂh]qÕcdocutils.nodes bullet_list qÖ)q×}qØ(h Uh)}qÙ(UbulletqÚX*h+]h,]h-]h.]h/]uh!hÒh]qÛ(cdocutils.nodes list_item qÜ)qÝ}qÞ(h X1it serves stale content to avoid request pile-up.qßh)}qà(h-]h.]h,]h+]h/]uh!h×h]qáhJ)qâ}qã(h hßh!hÝh"h%h'hNh)}qä(h-]h.]h,]h+]h/]uh1K8h]qåhFX1it serves stale content to avoid request pile-up.qæ…qç}qè(h hßh!hâubaubah'U list_itemqéubhÜ)qê}që(h X7it serves stale content if the backend is not healthy. h)}qì(h-]h.]h,]h+]h/]uh!h×h]qíhJ)qî}qï(h X6it serves stale content if the backend is not healthy.qðh!hêh"h%h'hNh)}qñ(h-]h.]h,]h+]h/]uh1K9h]qòhFX6it serves stale content if the backend is not healthy.qó…qô}qõ(h hðh!hîubaubah'héubeh'U bullet_listqöubah'U definitionq÷ubeubaubeubh3)qø}qù(h Uh!h4h"h%h'h8h)}qú(h-]h.]h,]h+]qûhah/]qüh auh1Kh2hh]r (hFX—Sometimes servers get flaky. They start throwing out random errors. You can instruct Varnish to try to handle this in a more-than-graceful way - enter r …r }r (h X—Sometimes servers get flaky. They start throwing out random errors. You can instruct Varnish to try to handle this in a more-than-graceful way - enter h!jubh¥)r }r(h X *Saint mode*h)}r(h-]h.]h,]h+]h/]uh!jh]rhFX Saint moder…r}r(h Uh!j ubah'h°ubhFX¿. Saint mode enables you to discard a certain page from one backend server and either try another server or serve stale content from cache. Lets have a look at how this can be enabled in VCL:r…r}r(h X¿. Saint mode enables you to discard a certain page from one backend server and either try another server or serve stale content from cache. Lets have a look at how this can be enabled in VCL:h!jubeubhy)r}r(h Xsub vcl_fetch { if (beresp.status == 500) { set beresp.saintmode = 10s; return(restart); } set beresp.grace = 5m; }h!høh"h%h'h|h)}r(h~hh+]h,]h-]h.]h/]uh1KEh2hh]rhFXsub vcl_fetch { if (beresp.status == 500) { set beresp.saintmode = 10s; return(restart); } set beresp.grace = 5m; }r…r}r(h Uh!jubaubhJ)r}r(h XDWhen we set beresp.saintmode to 10 seconds Varnish will not ask *that* server for URL for 10 seconds. A blacklist, more or less. Also a restart is performed so if you have other backends capable of serving that content Varnish will try those. When you are out of backends Varnish will serve the content from its stale cache.h!høh"h%h'hNh)}r (h-]h.]h,]h+]h/]uh1KMh2hh]r!(hFX@When we set beresp.saintmode to 10 seconds Varnish will not ask r"…r#}r$(h X@When we set beresp.saintmode to 10 seconds Varnish will not ask h!jubh¥)r%}r&(h X*that*h)}r'(h-]h.]h,]h+]h/]uh!jh]r(hFXthatr)…r*}r+(h Uh!j%ubah'h°ubhFXþ server for URL for 10 seconds. A blacklist, more or less. Also a restart is performed so if you have other backends capable of serving that content Varnish will try those. When you are out of backends Varnish will serve the content from its stale cache.r,…r-}r.(h Xþ server for URL for 10 seconds. A blacklist, more or less. Also a restart is performed so if you have other backends capable of serving that content Varnish will try those. When you are out of backends Varnish will serve the content from its stale cache.h!jubeubhJ)r/}r0(h X This can really be a life saver.r1h!høh"h%h'hNh)}r2(h-]h.]h,]h+]h/]uh1KSh2hh]r3hFX This can really be a life saver.r4…r5}r6(h j1h!j/ubaubeubh3)r7}r8(h Uh!h4h"h%h'h8h)}r9(h-]h.]h,]h+]r:hah/]r;h auh1KVh2hh]r<(h?)r=}r>(h X*Known limitations on grace- and saint moder?h!j7h"h%h'hCh)}r@(h-]h.]h,]h+]h/]uh1KVh2hh]rAhFX*Known limitations on grace- and saint moderB…rC}rD(h j?h!j=ubaubhJ)rE}rF(h XýIf your request fails while it is being fetched you're thrown into vcl_error. vcl_error has access to a rather limited set of data so you can't enable saint mode or grace mode here. This will be addressed in a future release but a work-around available.rGh!j7h"h%h'hNh)}rH(h-]h.]h,]h+]h/]uh1KXh2hh]rIhFXýIf your request fails while it is being fetched you're thrown into vcl_error. vcl_error has access to a rather limited set of data so you can't enable saint mode or grace mode here. This will be addressed in a future release but a work-around available.rJ…rK}rL(h jGh!jEubaubhÖ)rM}rN(h Uh!j7h"h%h'höh)}rO(hÚX*h+]h,]h-]h.]h/]uh1K]h2hh]rP(hÜ)rQ}rR(h X&Declare a backend that is always sick.rSh!jMh"h%h'héh)}rT(h-]h.]h,]h+]h/]uh1Nh2hh]rUhJ)rV}rW(h jSh!jQh"h%h'hNh)}rX(h-]h.]h,]h+]h/]uh1K]h]rYhFX&Declare a backend that is always sick.rZ…r[}r\(h jSh!jVubaubaubhÜ)r]}r^(h XSet a magic marker in vcl_errorr_h!jMh"h%h'héh)}r`(h-]h.]h,]h+]h/]uh1Nh2hh]rahJ)rb}rc(h j_h!j]h"h%h'hNh)}rd(h-]h.]h,]h+]h/]uh1K^h]rehFXSet a magic marker in vcl_errorrf…rg}rh(h j_h!jbubaubaubhÜ)ri}rj(h XRestart the transactionrkh!jMh"h%h'héh)}rl(h-]h.]h,]h+]h/]uh1Nh2hh]rmhJ)rn}ro(h jkh!jih"h%h'hNh)}rp(h-]h.]h,]h+]h/]uh1K_h]rqhFXRestart the transactionrr…rs}rt(h jkh!jnubaubaubhÜ)ru}rv(h XJNote the magic marker in vcl_recv and set the backend to the one mentionedrwh!jMh"h%h'héh)}rx(h-]h.]h,]h+]h/]uh1Nh2hh]ryhJ)rz}r{(h jwh!juh"h%h'hNh)}r|(h-]h.]h,]h+]h/]uh1K`h]r}hFXJNote the magic marker in vcl_recv and set the backend to the one mentionedr~…r}r€(h jwh!jzubaubaubhÜ)r}r‚(h X7Varnish will now serve stale data is any is available h!jMh"h%h'héh)}rƒ(h-]h.]h,]h+]h/]uh1Nh2hh]r„hJ)r…}r†(h X5Varnish will now serve stale data is any is availabler‡h!jh"h%h'hNh)}rˆ(h-]h.]h,]h+]h/]uh1Kah]r‰hFX5Varnish will now serve stale data is any is availablerŠ…r‹}rŒ(h j‡h!j…ubaubaubeubeubh3)r}rŽ(h Uh!h4h"h%h'h8h)}r(h-]h.]h,]h+]rhah/]r‘hauh1Keh2hh]r’(h?)r“}r”(h XGod moder•h!jh"h%h'hCh)}r–(h-]h.]h,]h+]h/]uh1Keh2hh]r—hFXGod moder˜…r™}rš(h j•h!j“ubaubhJ)r›}rœ(h XNot implemented yet. :-)rh!jh"h%h'hNh)}rž(h-]h.]h,]h+]h/]uh1Kfh2hh]rŸhFXNot implemented yet. :-)r …r¡}r¢(h jh!j›ubaubeubeubeh UU transformerr£NU footnote_refsr¤}r¥Urefnamesr¦}r§Usymbol_footnotesr¨]r©Uautofootnote_refsrª]r«Usymbol_footnote_refsr¬]r­U citationsr®]r¯h2hU current_liner°NUtransform_messagesr±]r²cdocutils.nodes system_message r³)r´}rµ(h Uh)}r¶(h-]UlevelKh+]h,]Usourceh%h.]h/]UlineKUtypeUINFOr·uh]r¸hJ)r¹}rº(h Uh)}r»(h-]h.]h,]h+]h/]uh!j´h]r¼hFXKHyperlink target "tutorial-handling-misbehaving-servers" is not referenced.r½…r¾}r¿(h Uh!j¹ubah'hNubah'Usystem_messagerÀubaUreporterrÁNUid_startrÂKU autofootnotesrÃ]rÄU citation_refsrÅ}rÆUindirect_targetsrÇ]rÈUsettingsrÉ(cdocutils.frontend Values rÊorË}rÌ(Ufootnote_backlinksrÍKUrecord_dependenciesrÎNU rfc_base_urlrÏUhttp://tools.ietf.org/html/rÐU tracebackrшUpep_referencesrÒNUstrip_commentsrÓNU toc_backlinksrÔUentryrÕU language_coderÖUenr×U datestamprØNU report_levelrÙKU _destinationrÚNU halt_levelrÛKU strip_classesrÜNhCNUerror_encoding_error_handlerrÝUbackslashreplacerÞUdebugrßNUembed_stylesheetrà‰Uoutput_encoding_error_handlerráUstrictrâU sectnum_xformrãKUdump_transformsräNU docinfo_xformråKUwarning_streamræNUpep_file_url_templaterçUpep-%04drèUexit_status_levelréKUconfigrêNUstrict_visitorrëNUcloak_email_addressesrìˆUtrim_footnote_reference_spacerí‰UenvrîNUdump_pseudo_xmlrïNUexpose_internalsrðNUsectsubtitle_xformrñ‰U source_linkròNUrfc_referencesróNUoutput_encodingrôUutf-8rõU source_urlröNUinput_encodingr÷U utf-8-sigrøU_disable_configrùNU id_prefixrúUU tab_widthrûKUerror_encodingrüUUTF-8rýU_sourcerþUI/home/tfheen/varnish/doc/sphinx/tutorial/handling_misbehaving_servers.rstrÿUgettext_compactrˆU generatorrNUdump_internalsrNU smart_quotesr‰U pep_base_urlrUhttp://www.python.org/dev/peps/rUsyntax_highlightrUlongrUinput_encoding_error_handlerrjâUauto_id_prefixr Uidr Udoctitle_xformr ‰Ustrip_elements_with_classesr NU _config_filesr ]Ufile_insertion_enabledrKU raw_enabledrKU dump_settingsrNubUsymbol_footnote_startrKUidsr}r(hh4hhThj7hh4hjhhøuUsubstitution_namesr}rh'h2h)}r(h-]h+]h,]Usourceh%h.]h/]uU footnotesr]rUrefidsr}rh]rhasub.varnish-3.0.5/doc/sphinx/=build/doctrees/tutorial/esi.doctree0000644000175000017500000002667012247037213021202 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(Xedge side includesqNX'example: esi:remove and qNX tutorial-esiqˆXexample: esi:includeq NuUsubstitution_defsq }q Uparse_messagesq ]q Ucurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hUedge-side-includesqhUexample-esi-remove-and-esiqhU tutorial-esiqh Uexample-esi-includequUchildrenq]q(cdocutils.nodes target q)q}q(U rawsourceqX.. _tutorial-esi:UparentqhUsourceqcdocutils.nodes reprunicode qX0/home/tfheen/varnish/doc/sphinx/tutorial/esi.rstq …q!}q"bUtagnameq#Utargetq$U attributesq%}q&(Uidsq']Ubackrefsq(]Udupnamesq)]Uclassesq*]Unamesq+]Urefidq,huUlineq-KUdocumentq.hh]ubcdocutils.nodes section q/)q0}q1(hUhhhh!Uexpect_referenced_by_nameq2}q3hhsh#Usectionq4h%}q5(h)]h*]h(]h']q6(hheh+]q7(hheuh-Kh.hUexpect_referenced_by_idq8}q9hhsh]q:(cdocutils.nodes title q;)q<}q=(hXEdge Side Includesq>hh0hh!h#Utitleq?h%}q@(h)]h*]h(]h']h+]uh-Kh.hh]qAcdocutils.nodes Text qBXEdge Side IncludesqC…qD}qE(hh>hh h%}qš(h)]h*]h(]h']h+]uhhyh]q›hF)qœ}q(hXqžhh˜hh!h#hIh%}qŸ(h)]h*]h(]h']h+]uh-Kh]q hBXq¡…q¢}q£(hhžhhœubaubah#h‹ubeh#U bullet_listq¤ubaubhF)q¥}q¦(hX]Content substitution based on variables and cookies is not implemented but is on the roadmap.q§hh0hh!h#hIh%}q¨(h)]h*]h(]h']h+]uh-Kh.hh]q©hBX]Content substitution based on variables and cookies is not implemented but is on the roadmap.qª…q«}q¬(hh§hh¥ubaubhF)q­}q®(hX;Varnish will not process ESI instructions in HTML comments.q¯hh0hh!h#hIh%}q°(h)]h*]h(]h']h+]uh-Kh.hh]q±hBX;Varnish will not process ESI instructions in HTML comments.q²…q³}q´(hh¯hh­ubaubh/)qµ}q¶(hUhh0hh!h#h4h%}q·(h)]h*]h(]h']q¸hah+]q¹h auh-Kh.hh]qº(h;)q»}q¼(hXExample: esi:includeq½hhµhh!h#h?h%}q¾(h)]h*]h(]h']h+]uh-Kh.hh]q¿hBXExample: esi:includeqÀ…qÁ}qÂ(hh½hh»ubaubhF)qÃ}qÄ(hXULets see an example how this could be used. This simple cgi script outputs the date::hhµhh!h#hIh%}qÅ(h)]h*]h(]h']h+]uh-Kh.hh]qÆhBXTLets see an example how this could be used. This simple cgi script outputs the date:qÇ…qÈ}qÉ(hXTLets see an example how this could be used. This simple cgi script outputs the date:hhÃubaubcdocutils.nodes literal_block qÊ)qË}qÌ(hXH#!/bin/sh echo 'Content-type: text/html' echo '' date "+%Y-%m-%d %H:%M"hhµhh!h#U literal_blockqÍh%}qÎ(U xml:spaceqÏUpreserveqÐh']h(]h)]h*]h+]uh-K!h.hh]qÑhBXH#!/bin/sh echo 'Content-type: text/html' echo '' date "+%Y-%m-%d %H:%M"qÒ…qÓ}qÔ(hUhhËubaubhF)qÕ}qÖ(hX?Now, lets have an HTML file that has an ESI include statement::q×hhµhh!h#hIh%}qØ(h)]h*]h(]h']h+]uh-K'h.hh]qÙhBX>Now, lets have an HTML file that has an ESI include statement:qÚ…qÛ}qÜ(hX>Now, lets have an HTML file that has an ESI include statement:hhÕubaubhÊ)qÝ}qÞ(hXf The time is: at this very moment. hhµhh!h#hÍh%}qß(hÏhÐh']h(]h)]h*]h+]uh-K)h.hh]qàhBXf The time is: at this very moment. qá…qâ}qã(hUhhÝubaubhF)qä}qå(hXGFor ESI to work you need to activate ESI processing in VCL, like this::qæhhµhh!h#hIh%}qç(h)]h*]h(]h']h+]uh-K0h.hh]qèhBXFFor ESI to work you need to activate ESI processing in VCL, like this:qé…qê}që(hXFFor ESI to work you need to activate ESI processing in VCL, like this:hhäubaubhÊ)qì}qí(hX†sub vcl_fetch { if (req.url == "/test.html") { set beresp.do_esi = true; /* Do ESI processing */ set beresp.ttl = 24 h; /* Sets the TTL on the HTML above */ } elseif (req.url == "/cgi-bin/date.cgi") { set beresp.ttl = 1m; /* Sets a one minute TTL on */ /* the included object */ } }hhµhh!h#hÍh%}qî(hÏhÐh']h(]h)]h*]h+]uh-K2h.hh]qïhBX†sub vcl_fetch { if (req.url == "/test.html") { set beresp.do_esi = true; /* Do ESI processing */ set beresp.ttl = 24 h; /* Sets the TTL on the HTML above */ } elseif (req.url == "/cgi-bin/date.cgi") { set beresp.ttl = 1m; /* Sets a one minute TTL on */ /* the included object */ } }qð…qñ}qò(hUhhìubaubeubh/)qó}qô(hUhh0hh!h#h4h%}qõ(h)]h*]h(]h']qöhah+]q÷hauh-K=h.hh]qø(h;)qù}qú(hX'Example: esi:remove and qûhhóhh!h#h?h%}qü(h)]h*]h(]h']h+]uh-K=h.hh]qýhBX'Example: esi:remove and qþ…qÿ}r(hhûhhùubaubhF)r}r(hXUThe 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, becoming an 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::hhóhh!h#hIh%}r(h)]h*]h(]h']h+]uh-K>h.hh]rhBXTThe 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, becoming an 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:r…r}r(hXTThe 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, becoming an 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:hjubaubhÊ)r}r (hX· The license hhóhh!h#hÍh%}r (hÏhÐh']h(]h)]h*]h+]uh-KIh.hh]r hBX· The license r …r }r(hUhjubaubeubeubehUU transformerrNU footnote_refsr}rUrefnamesr}rUsymbol_footnotesr]rUautofootnote_refsr]rUsymbol_footnote_refsr]rU citationsr]rh.hU current_linerNUtransform_messagesr]rcdocutils.nodes system_message r)r }r!(hUh%}r"(h)]UlevelKh']h(]Usourceh!h*]h+]UlineKUtypeUINFOr#uh]r$hF)r%}r&(hUh%}r'(h)]h*]h(]h']h+]uhj h]r(hBX2Hyperlink target "tutorial-esi" is not referenced.r)…r*}r+(hUhj%ubah#hIubah#Usystem_messager,ubaUreporterr-NUid_startr.KU autofootnotesr/]r0U citation_refsr1}r2Uindirect_targetsr3]r4Usettingsr5(cdocutils.frontend Values r6or7}r8(Ufootnote_backlinksr9KUrecord_dependenciesr:NU rfc_base_urlr;Uhttp://tools.ietf.org/html/r<U tracebackr=ˆUpep_referencesr>NUstrip_commentsr?NU toc_backlinksr@UentryrAU language_coderBUenrCU datestamprDNU report_levelrEKU _destinationrFNU halt_levelrGKU strip_classesrHNh?NUerror_encoding_error_handlerrIUbackslashreplacerJUdebugrKNUembed_stylesheetrL‰Uoutput_encoding_error_handlerrMUstrictrNU sectnum_xformrOKUdump_transformsrPNU docinfo_xformrQKUwarning_streamrRNUpep_file_url_templaterSUpep-%04drTUexit_status_levelrUKUconfigrVNUstrict_visitorrWNUcloak_email_addressesrXˆUtrim_footnote_reference_spacerY‰UenvrZNUdump_pseudo_xmlr[NUexpose_internalsr\NUsectsubtitle_xformr]‰U source_linkr^NUrfc_referencesr_NUoutput_encodingr`Uutf-8raU source_urlrbNUinput_encodingrcU utf-8-sigrdU_disable_configreNU id_prefixrfUU tab_widthrgKUerror_encodingrhUUTF-8riU_sourcerjU0/home/tfheen/varnish/doc/sphinx/tutorial/esi.rstrkUgettext_compactrlˆU generatorrmNUdump_internalsrnNU smart_quotesro‰U pep_base_urlrpUhttp://www.python.org/dev/peps/rqUsyntax_highlightrrUlongrsUinput_encoding_error_handlerrtjNUauto_id_prefixruUidrvUdoctitle_xformrw‰Ustrip_elements_with_classesrxNU _config_filesry]Ufile_insertion_enabledrzKU raw_enabledr{KU dump_settingsr|NubUsymbol_footnote_startr}KUidsr~}r(hhµhh0hh0hhóuUsubstitution_namesr€}rh#h.h%}r‚(h)]h']h(]Usourceh!h*]h+]uU footnotesrƒ]r„Urefidsr…}r†h]r‡hasub.varnish-3.0.5/doc/sphinx/=build/doctrees/tutorial/logging.doctree0000644000175000017500000003024712247037213022043 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(Xtutorial-loggingqˆXlogging in varnishqNuUsubstitution_defsq}q Uparse_messagesq ]q Ucurrent_sourceq NU decorationq NUautofootnote_startqKUnameidsq}q(hUtutorial-loggingqhUlogging-in-varnishquUchildrenq]q(cdocutils.nodes target q)q}q(U rawsourceqX.. _tutorial-logging:UparentqhUsourceqcdocutils.nodes reprunicode qX4/home/tfheen/varnish/doc/sphinx/tutorial/logging.rstq…q}qbUtagnameqUtargetq U attributesq!}q"(Uidsq#]Ubackrefsq$]Udupnamesq%]Uclassesq&]Unamesq']Urefidq(huUlineq)KUdocumentq*hh]ubcdocutils.nodes section q+)q,}q-(hUhhhhUexpect_referenced_by_nameq.}q/hhshUsectionq0h!}q1(h%]h&]h$]h#]q2(hheh']q3(hheuh)Kh*hUexpect_referenced_by_idq4}q5hhsh]q6(cdocutils.nodes title q7)q8}q9(hXLogging in Varnishq:hh,hhhUtitleq;h!}q<(h%]h&]h$]h#]h']uh)Kh*hh]q=cdocutils.nodes Text q>XLogging in Varnishq?…q@}qA(hh:hh8ubaubcdocutils.nodes paragraph qB)qC}qD(hX/One of the really nice features in Varnish is how logging works. Instead of logging to normal log file Varnish logs to a shared memory segment. When the end of the segment is reached we start over, overwriting old data. This is much, much faster then logging to a file and it doesn't require disk space.qEhh,hhhU paragraphqFh!}qG(h%]h&]h$]h#]h']uh)Kh*hh]qHh>X/One of the really nice features in Varnish is how logging works. Instead of logging to normal log file Varnish logs to a shared memory segment. When the end of the segment is reached we start over, overwriting old data. This is much, much faster then logging to a file and it doesn't require disk space.qI…qJ}qK(hhEhhCubaubhB)qL}qM(hXjThe flip side is that if you forget to have a program actually write the logs to disk they will disappear.qNhh,hhhhFh!}qO(h%]h&]h$]h#]h']uh)K h*hh]qPh>XjThe flip side is that if you forget to have a program actually write the logs to disk they will disappear.qQ…qR}qS(hhNhhLubaubhB)qT}qU(hXÙ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 as well, we'll show you these later.qVhh,hhhhFh!}qW(h%]h&]h$]h#]h']uh)Kh*hh]qXh>XÙ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 as well, we'll show you these later.qY…qZ}q[(hhVhhTubaubhB)q\}q](hXQIn the terminal window you started varnish now type *varnishlog* and press enter.hh,hhhhFh!}q^(h%]h&]h$]h#]h']uh)Kh*hh]q_(h>X4In the terminal window you started varnish now type q`…qa}qb(hX4In the terminal window you started varnish now type hh\ubcdocutils.nodes emphasis qc)qd}qe(hX *varnishlog*h!}qf(h%]h&]h$]h#]h']uhh\h]qgh>X varnishlogqh…qi}qj(hUhhdubahUemphasisqkubh>X and press enter.ql…qm}qn(hX and press enter.hh\ubeubhB)qo}qp(hX2You'll see lines like these scrolling slowly by.::qqhh,hhhhFh!}qr(h%]h&]h$]h#]h']uh)Kh*hh]qsh>X1You'll see lines like these scrolling slowly by.:qt…qu}qv(hX1You'll see lines like these scrolling slowly by.:hhoubaubcdocutils.nodes literal_block qw)qx}qy(hXD0 CLI - Rd ping 0 CLI - Wr 200 PONG 1273698726 1.0hh,hhhU literal_blockqzh!}q{(U xml:spaceq|Upreserveq}h#]h$]h%]h&]h']uh)Kh*hh]q~h>XD0 CLI - Rd ping 0 CLI - Wr 200 PONG 1273698726 1.0q…q€}q(hUhhxubaubhB)q‚}qƒ(hXdThese is the Varnish master process checking up on the caching process to see that everything is OK.q„hh,hhhhFh!}q…(h%]h&]h$]h#]h']uh)Kh*hh]q†h>XdThese is the Varnish master process checking up on the caching process to see that everything is OK.q‡…qˆ}q‰(hh„hh‚ubaubhB)qŠ}q‹(hXaNow go to the browser and reload the page displaying your web app. You'll see lines like these.::hh,hhhhFh!}qŒ(h%]h&]h$]h#]h']uh)Kh*hh]qh>X`Now go to the browser and reload the page displaying your web app. You'll see lines like these.:qŽ…q}q(hX`Now go to the browser and reload the page displaying your web app. You'll see lines like these.:hhŠubaubhw)q‘}q’(hXï11 SessionOpen c 127.0.0.1 58912 0.0.0.0:8080 11 ReqStart c 127.0.0.1 58912 595005213 11 RxRequest c GET 11 RxURL c / 11 RxProtocol c HTTP/1.1 11 RxHeader c Host: localhost:8080 11 RxHeader c Connection: keep-alivehh,hhhhzh!}q“(h|h}h#]h$]h%]h&]h']uh)K"h*hh]q”h>Xï11 SessionOpen c 127.0.0.1 58912 0.0.0.0:8080 11 ReqStart c 127.0.0.1 58912 595005213 11 RxRequest c GET 11 RxURL c / 11 RxProtocol c HTTP/1.1 11 RxHeader c Host: localhost:8080 11 RxHeader c Connection: keep-aliveq•…q–}q—(hUhh‘ubaubhB)q˜}q™(hXeThe first column is an arbitrary number, it defines the request. Lines with the same number are part of the same HTTP 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. Tags starting with Rx indicate Varnish is recieving data and Tx indicates sending data.hh,hhhhFh!}qš(h%]h&]h$]h#]h']uh)K*h*hh]q›(h>XœThe first column is an arbitrary number, it defines the request. Lines with the same number are part of the same HTTP transaction. The second column is the qœ…q}qž(hXœThe first column is an arbitrary number, it defines the request. Lines with the same number are part of the same HTTP transaction. The second column is the hh˜ubhc)qŸ}q (hX*tag*h!}q¡(h%]h&]h$]h#]h']uhh˜h]q¢h>Xtagq£…q¤}q¥(hUhhŸubahhkubh>XÄ of the log message. All log entries are tagged with a tag indicating what sort of activity is being logged. Tags starting with Rx indicate Varnish is recieving data and Tx indicates sending data.q¦…q§}q¨(hXÄ of the log message. All log entries are tagged with a tag indicating what sort of activity is being logged. Tags starting with Rx indicate Varnish is recieving data and Tx indicates sending data.hh˜ubeubhB)q©}qª(hX™The third column tell us whether this is is data coming or going to the client (c) or to/from the backend (b). The forth column is the data being logged.q«hh,hhhhFh!}q¬(h%]h&]h$]h#]h']uh)K1h*hh]q­h>X™The third column tell us whether this is is data coming or going to the client (c) or to/from the backend (b). The forth column is the data being logged.q®…q¯}q°(hh«hh©ubaubhB)q±}q²(hXWNow, you can filter quite a bit with varnishlog. The basic option you want to know are:q³hh,hhhhFh!}q´(h%]h&]h$]h#]h']uh)K5h*hh]qµh>XWNow, you can filter quite a bit with varnishlog. The basic option you want to know are:q¶…q·}q¸(hh³hh±ubaubcdocutils.nodes option_list q¹)qº}q»(hUhh,hhhU option_listq¼h!}q½(h%]h&]h$]h#]h']uh)Nh*hh]q¾(cdocutils.nodes option_list_item q¿)qÀ}qÁ(hUhhºhhhUoption_list_itemqÂh!}qÃ(h%]h&]h$]h#]h']uh)Nh*hh]qÄ(cdocutils.nodes option_group qÅ)qÆ}qÇ(hUh!}qÈ(h%]h&]h$]h#]h']uhhÀh]qÉcdocutils.nodes option qÊ)qË}qÌ(hX-bqÍh!}qÎ(h%]h&]h$]h#]h']uhhÆh]qÏcdocutils.nodes option_string qÐ)qÑ}qÒ(hhÍh!}qÓ(h%]h&]h$]h#]h']uhhËh]qÔh>X-bqÕ…qÖ}q×(hUhhÑubahU option_stringqØubahUoptionqÙubahU option_groupqÚubcdocutils.nodes description qÛ)qÜ}qÝ(hXŽ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. h!}qÞ(h%]h&]h$]h#]h']uhhÀh]qßhB)qà}qá(hXOnly show log lines from traffic going between Varnish and the backend servers. This will be useful when we want to optimize cache hit rates.qâhhÜhhhhFh!}qã(h%]h&]h$]h#]h']uh)K9h]qäh>XOnly show log lines from traffic going between Varnish and the backend servers. This will be useful when we want to optimize cache hit rates.qå…qæ}qç(hhâhhàubaubahU descriptionqèubeubh¿)qé}qê(hUhhºhhhhÂh!}që(h%]h&]h$]h#]h']uh)Nh*hh]qì(hÅ)qí}qî(hUh!}qï(h%]h&]h$]h#]h']uhhéh]qðhÊ)qñ}qò(hX-cqóh!}qô(h%]h&]h$]h#]h']uhhíh]qõhÐ)qö}q÷(hhóh!}qø(h%]h&]h$]h#]h']uhhñh]qùh>X-cqú…qû}qü(hUhhöubahhØubahhÙubahhÚubhÛ)qý}qþ(hX(Same as -b but for client side traffic. h!}qÿ(h%]h&]h$]h#]h']uhhéh]rhB)r}r(hX'Same as -b but for client side traffic.rhhýhhhhFh!}r(h%]h&]h$]h#]h']uh)K=h]rh>X'Same as -b but for client side traffic.r…r}r(hjhjubaubahhèubeubeubcdocutils.nodes definition_list r )r }r (hUhh,hhhUdefinition_listr h!}r (h%]h&]h$]h#]h']uh)Nh*hh]rcdocutils.nodes definition_list_item r)r}r(hX‚-m tag:regex Only list transactions where the tag matches a regular expression. If it matches you will get the whole transaction. hj hhhUdefinition_list_itemrh!}r(h%]h&]h$]h#]h']uh)KAh]r(cdocutils.nodes term r)r}r(hX -m tag:regexrhjhhhUtermrh!}r(h%]h&]h$]h#]h']uh)KAh]r(h>X-m r…r}r(hX-m hjubcdocutils.nodes reference r)r }r!(hX tag:regexr"h!}r#(Urefurij"h#]h$]h%]h&]h']uhjh]r$h>X tag:regexr%…r&}r'(hUhj ubahU referencer(ubeubcdocutils.nodes definition r))r*}r+(hUh!}r,(h%]h&]h$]h#]h']uhjh]r-hB)r.}r/(hXtOnly list transactions where the tag matches a regular expression. If it matches you will get the whole transaction.r0hj*hhhhFh!}r1(h%]h&]h$]h#]h']uh)K@h]r2h>XtOnly list transactions where the tag matches a regular expression. If it matches you will get the whole transaction.r3…r4}r5(hj0hj.ubaubahU definitionr6ubeubaubhB)r7}r8(hXVNow that Varnish seem to work OK it's time to put Varnish on port 80 while we tune it.r9hh,hhhhFh!}r:(h%]h&]h$]h#]h']uh)KCh*hh]r;h>XVNow that Varnish seem to work OK it's time to put Varnish on port 80 while we tune it.r<…r=}r>(hj9hj7ubaubeubehUU transformerr?NU footnote_refsr@}rAUrefnamesrB}rCUsymbol_footnotesrD]rEUautofootnote_refsrF]rGUsymbol_footnote_refsrH]rIU citationsrJ]rKh*hU current_linerLNUtransform_messagesrM]rNcdocutils.nodes system_message rO)rP}rQ(hUh!}rR(h%]UlevelKh#]h$]Usourcehh&]h']UlineKUtypeUINFOrSuh]rThB)rU}rV(hUh!}rW(h%]h&]h$]h#]h']uhjPh]rXh>X6Hyperlink target "tutorial-logging" is not referenced.rY…rZ}r[(hUhjUubahhFubahUsystem_messager\ubaUreporterr]NUid_startr^KU autofootnotesr_]r`U citation_refsra}rbUindirect_targetsrc]rdUsettingsre(cdocutils.frontend Values rforg}rh(Ufootnote_backlinksriKUrecord_dependenciesrjNU rfc_base_urlrkUhttp://tools.ietf.org/html/rlU tracebackrmˆUpep_referencesrnNUstrip_commentsroNU toc_backlinksrpUentryrqU language_coderrUenrsU datestamprtNU report_levelruKU _destinationrvNU halt_levelrwKU strip_classesrxNh;NUerror_encoding_error_handlerryUbackslashreplacerzUdebugr{NUembed_stylesheetr|‰Uoutput_encoding_error_handlerr}Ustrictr~U sectnum_xformrKUdump_transformsr€NU docinfo_xformrKUwarning_streamr‚NUpep_file_url_templaterƒUpep-%04dr„Uexit_status_levelr…KUconfigr†NUstrict_visitorr‡NUcloak_email_addressesrˆˆUtrim_footnote_reference_spacer‰‰UenvrŠNUdump_pseudo_xmlr‹NUexpose_internalsrŒNUsectsubtitle_xformr‰U source_linkrŽNUrfc_referencesrNUoutput_encodingrUutf-8r‘U source_urlr’NUinput_encodingr“U utf-8-sigr”U_disable_configr•NU id_prefixr–UU tab_widthr—KUerror_encodingr˜UUTF-8r™U_sourceršU4/home/tfheen/varnish/doc/sphinx/tutorial/logging.rstr›Ugettext_compactrœˆU generatorrNUdump_internalsržNU smart_quotesrŸ‰U pep_base_urlr Uhttp://www.python.org/dev/peps/r¡Usyntax_highlightr¢Ulongr£Uinput_encoding_error_handlerr¤j~Uauto_id_prefixr¥Uidr¦Udoctitle_xformr§‰Ustrip_elements_with_classesr¨NU _config_filesr©]Ufile_insertion_enabledrªKU raw_enabledr«KU dump_settingsr¬NubUsymbol_footnote_startr­KUidsr®}r¯(hh,hh,uUsubstitution_namesr°}r±hh*h!}r²(h%]h#]h$]Usourcehh&]h']uU footnotesr³]r´Urefidsrµ}r¶h]r·hasub.varnish-3.0.5/doc/sphinx/=build/doctrees/tutorial/putting_varnish_on_port_80.doctree0000644000175000017500000001227212247037213025706 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}qXput varnish on port 80qNsUsubstitution_defsq}qUparse_messagesq ]q Ucurrent_sourceq NU decorationq NUautofootnote_startq KUnameidsq}qhUput-varnish-on-port-80qsUchildrenq]qcdocutils.nodes section q)q}q(U rawsourceqUUparentqhUsourceqcdocutils.nodes reprunicode qXG/home/tfheen/varnish/doc/sphinx/tutorial/putting_varnish_on_port_80.rstq…q}qbUtagnameqUsectionqU attributesq}q (Udupnamesq!]Uclassesq"]Ubackrefsq#]Uidsq$]q%haUnamesq&]q'hauUlineq(KUdocumentq)hh]q*(cdocutils.nodes title q+)q,}q-(hXPut Varnish on port 80q.hhhhhUtitleq/h}q0(h!]h"]h#]h$]h&]uh(Kh)hh]q1cdocutils.nodes Text q2XPut Varnish on port 80q3…q4}q5(hh.hh,ubaubcdocutils.nodes paragraph q6)q7}q8(hXÜUntil now we've been running with Varnish on a high port, for testing purposes. You should test your application and if it works OK we can switch, so Varnish will be running on port 80 and your web server on a high port.q9hhhhhU paragraphq:h}q;(h!]h"]h#]h$]h&]uh(Kh)hh]q}q?(hh9hh7ubaubh6)q@}qA(hXFirst we kill off varnishd::qBhhhhhh:h}qC(h!]h"]h#]h$]h&]uh(K h)hh]qDh2XFirst we kill off varnishd:qE…qF}qG(hXFirst we kill off varnishd:hh@ubaubcdocutils.nodes literal_block qH)qI}qJ(hX# pkill varnishdhhhhhU literal_blockqKh}qL(U xml:spaceqMUpreserveqNh$]h#]h!]h"]h&]uh(K h)hh]qOh2X# pkill varnishdqP…qQ}qR(hUhhIubaubh6)qS}qT(hXÈand stop your web server. Edit the configuration for your web server and make it bind to port 8080 instead of 80. Now open the Varnish default.vcl and change the port of the *default* backend to 8080.hhhhhh:h}qU(h!]h"]h#]h$]h&]uh(Kh)hh]qV(h2X®and stop your web server. Edit the configuration for your web server and make it bind to port 8080 instead of 80. Now open the Varnish default.vcl and change the port of the qW…qX}qY(hX®and stop your web server. Edit the configuration for your web server and make it bind to port 8080 instead of 80. Now open the Varnish default.vcl and change the port of the hhSubcdocutils.nodes emphasis qZ)q[}q\(hX *default*h}q](h!]h"]h#]h$]h&]uhhSh]q^h2Xdefaultq_…q`}qa(hUhh[ubahUemphasisqbubh2X backend to 8080.qc…qd}qe(hX backend to 8080.hhSubeubh6)qf}qg(hX1Start up your web server and then start varnish::qhhhhhhh:h}qi(h!]h"]h#]h$]h&]uh(Kh)hh]qjh2X0Start up your web server and then start varnish:qk…ql}qm(hX0Start up your web server and then start varnish:hhfubaubhH)qn}qo(hXO# varnishd -f /usr/local/etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1:2000hhhhhhKh}qp(hMhNh$]h#]h!]h"]h&]uh(Kh)hh]qqh2XO# varnishd -f /usr/local/etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1:2000qr…qs}qt(hUhhnubaubh6)qu}qv(hX¹Note that we've removed the -a option. Now Varnish, as its default setting dictates, will bind to the http port (80). Now everyone accessing your site will be accessing through Varnish.qwhhhhhh:h}qx(h!]h"]h#]h$]h&]uh(Kh)hh]qyh2X¹Note that we've removed the -a option. Now Varnish, as its default setting dictates, will bind to the http port (80). Now everyone accessing your site will be accessing through Varnish.qz…q{}q|(hhwhhuubaubeubahUU transformerq}NU footnote_refsq~}qUrefnamesq€}qUsymbol_footnotesq‚]qƒUautofootnote_refsq„]q…Usymbol_footnote_refsq†]q‡U citationsqˆ]q‰h)hU current_lineqŠNUtransform_messagesq‹]qŒUreporterqNUid_startqŽKU autofootnotesq]qU citation_refsq‘}q’Uindirect_targetsq“]q”Usettingsq•(cdocutils.frontend Values q–oq—}q˜(Ufootnote_backlinksq™KUrecord_dependenciesqšNU rfc_base_urlq›Uhttp://tools.ietf.org/html/qœU tracebackqˆUpep_referencesqžNUstrip_commentsqŸNU toc_backlinksq Uentryq¡U language_codeq¢Uenq£U datestampq¤NU report_levelq¥KU _destinationq¦NU halt_levelq§KU strip_classesq¨Nh/NUerror_encoding_error_handlerq©UbackslashreplaceqªUdebugq«NUembed_stylesheetq¬‰Uoutput_encoding_error_handlerq­Ustrictq®U sectnum_xformq¯KUdump_transformsq°NU docinfo_xformq±KUwarning_streamq²NUpep_file_url_templateq³Upep-%04dq´Uexit_status_levelqµKUconfigq¶NUstrict_visitorq·NUcloak_email_addressesq¸ˆUtrim_footnote_reference_spaceq¹‰UenvqºNUdump_pseudo_xmlq»NUexpose_internalsq¼NUsectsubtitle_xformq½‰U source_linkq¾NUrfc_referencesq¿NUoutput_encodingqÀUutf-8qÁU source_urlqÂNUinput_encodingqÃU utf-8-sigqÄU_disable_configqÅNU id_prefixqÆUU tab_widthqÇKUerror_encodingqÈUUTF-8qÉU_sourceqÊUG/home/tfheen/varnish/doc/sphinx/tutorial/putting_varnish_on_port_80.rstqËUgettext_compactq̈U generatorqÍNUdump_internalsqÎNU smart_quotesqωU pep_base_urlqÐUhttp://www.python.org/dev/peps/qÑUsyntax_highlightqÒUlongqÓUinput_encoding_error_handlerqÔh®Uauto_id_prefixqÕUidqÖUdoctitle_xformq׉Ustrip_elements_with_classesqØNU _config_filesqÙ]Ufile_insertion_enabledqÚKU raw_enabledqÛKU dump_settingsqÜNubUsymbol_footnote_startqÝKUidsqÞ}qßhhsUsubstitution_namesqà}qáhh)h}qâ(h!]h$]h#]Usourcehh"]h&]uU footnotesqã]qäUrefidsqå}qæub.varnish-3.0.5/doc/sphinx/=build/doctrees/tutorial/purging.doctree0000644000175000017500000005111212247037213022062 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(Xpurging and banningqNXforcing a cache missqNXtutorial-purgingqˆXbansq NX http purgesq NuUsubstitution_defsq }q Uparse_messagesq ]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hUpurging-and-banningqhUforcing-a-cache-missqhUtutorial-purgingqh Ubansqh U http-purgesquUchildrenq]q(cdocutils.nodes target q)q}q(U rawsourceqX.. _tutorial-purging:UparentqhUsourceq cdocutils.nodes reprunicode q!X4/home/tfheen/varnish/doc/sphinx/tutorial/purging.rstq"…q#}q$bUtagnameq%Utargetq&U attributesq'}q((Uidsq)]Ubackrefsq*]Udupnamesq+]Uclassesq,]Unamesq-]Urefidq.huUlineq/KUdocumentq0hh]ubcdocutils.nodes section q1)q2}q3(hUhhh h#Uexpect_referenced_by_nameq4}q5hhsh%Usectionq6h'}q7(h+]h,]h*]h)]q8(hheh-]q9(hheuh/Kh0hUexpect_referenced_by_idq:}q;hhsh]q<(cdocutils.nodes title q=)q>}q?(hXPurging and banningq@hh2h h#h%UtitleqAh'}qB(h+]h,]h*]h)]h-]uh/Kh0hh]qCcdocutils.nodes Text qDXPurging and banningqE…qF}qG(hh@hh>ubaubcdocutils.nodes paragraph qH)qI}qJ(hXà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.qKhh2h h#h%U paragraphqLh'}qM(h+]h,]h*]h)]h-]uh/Kh0hh]qNhDXà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.qO…qP}qQ(hhKhhIubaubhH)qR}qS(hXÉThe solution is to notify Varnish when there is fresh content available. This can be done through three mechanisms. HTTP purging, banning and forced cache misses. First, let me explain the HTTP purges.qThh2h h#h%hLh'}qU(h+]h,]h*]h)]h-]uh/K h0hh]qVhDXÉThe solution is to notify Varnish when there is fresh content available. This can be done through three mechanisms. HTTP purging, banning and forced cache misses. First, let me explain the HTTP purges.qW…qX}qY(hhThhRubaubh1)qZ}q[(hUhh2h h#h%h6h'}q\(h+]h,]h*]h)]q]hah-]q^h auh/Kh0hh]q_(h=)q`}qa(hX HTTP PurgesqbhhZh h#h%hAh'}qc(h+]h,]h*]h)]h-]uh/Kh0hh]qdhDX HTTP Purgesqe…qf}qg(hhbhh`ubaubhH)qh}qi(hX«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.hhZh h#h%hLh'}qj(h+]h,]h*]h)]h-]uh/Kh0hh]qk(hDXA ql…qm}qn(hXA hhhubcdocutils.nodes emphasis qo)qp}qq(hX*purge*h'}qr(h+]h,]h*]h)]h-]uhhhh]qshDXpurgeqt…qu}qv(hUhhpubah%UemphasisqwubhDX¢ 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.qx…qy}qz(hX¢ 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.hhhubeubhH)q{}q|(hX#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 supports the same mechanism. In order to support purging in Varnish you need the following VCL in place::hhZh h#h%hLh'}q}(h+]h,]h*]h)]h-]uh/Kh0hh]q~(hDXAAn HTTP purge is similar to an HTTP GET request, except that the q…q€}q(hXAAn HTTP purge is similar to an HTTP GET request, except that the hh{ubho)q‚}qƒ(hX*method*h'}q„(h+]h,]h*]h)]h-]uhh{h]q…hDXmethodq†…q‡}qˆ(hUhh‚ubah%hwubhDXÙ is PURGE. Actually you can call the method whatever you'd like, but most people refer to this as purging. Squid supports the same mechanism. In order to support purging in Varnish you need the following VCL in place:q‰…qŠ}q‹(hXÙ is PURGE. Actually you can call the method whatever you'd like, but most people refer to this as purging. Squid supports the same mechanism. In order to support purging in Varnish you need the following VCL in place:hh{ubeubcdocutils.nodes literal_block qŒ)q}qŽ(hXAacl purge { "localhost"; "192.168.55.0"/24; } sub vcl_recv { # allow PURGE from localhost and 192.168.55... if (req.request == "PURGE") { if (!client.ip ~ purge) { error 405 "Not allowed."; } return (lookup); } } sub vcl_hit { if (req.request == "PURGE") { purge; error 200 "Purged."; } } sub vcl_miss { if (req.request == "PURGE") { purge; error 200 "Purged."; } }hhZh h#h%U literal_blockqh'}q(U xml:spaceq‘Upreserveq’h)]h*]h+]h,]h-]uh/Kh0hh]q“hDXAacl purge { "localhost"; "192.168.55.0"/24; } sub vcl_recv { # allow PURGE from localhost and 192.168.55... if (req.request == "PURGE") { if (!client.ip ~ purge) { error 405 "Not allowed."; } return (lookup); } } sub vcl_hit { if (req.request == "PURGE") { purge; error 200 "Purged."; } } sub vcl_miss { if (req.request == "PURGE") { purge; error 200 "Purged."; } }q”…q•}q–(hUhhubaubhH)q—}q˜(hX¹As you can see we have used to new VCL subroutines, vcl_hit and vcl_miss. When we call lookup Varnish will try to lookup the object in its cache. It will either hit an object or miss it and so the corresponding subroutine is called. In vcl_hit the object that is stored in cache is available and we can set the TTL. The purge in vcl_miss is necessary to purge all variants in the cases where you hit an object, but miss a particular variant.q™hhZh h#h%hLh'}qš(h+]h,]h*]h)]h-]uh/K…r?}r@(hUhj:ubaubhH)rA}rB(hXtTo inspect the current ban list, issue the ban.list command in CLI. This will produce a status of all current bans::hhµh h#h%hLh'}rC(h+]h,]h*]h)]h-]uh/K™h0hh]rDhDXsTo inspect the current ban list, issue the ban.list command in CLI. This will produce a status of all current bans:rE…rF}rG(hXsTo inspect the current ban list, issue the ban.list command in CLI. This will produce a status of all current bans:hjAubaubhŒ)rH}rI(hX{0xb75096d0 1318329475.377475 10 obj.http.x-url ~ test 0xb7509610 1318329470.785875 20G obj.http.x-url ~ testhhµh h#h%hh'}rJ(h‘h’h)]h*]h+]h,]h-]uh/Kœh0hh]rKhDX{0xb75096d0 1318329475.377475 10 obj.http.x-url ~ test 0xb7509610 1318329470.785875 20G obj.http.x-url ~ testrL…rM}rN(hUhjHubaubhH)rO}rP(hXThe 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.rQhhµh h#h%hLh'}rR(h+]h,]h*]h)]h-]uh/KŸh0hh]rShDXThe 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.rT…rU}rV(hjQhjOubaubeubh1)rW}rX(hUhh2h h#h%h6h'}rY(h+]h,]h*]h)]rZhah-]r[hauh/K§h0hh]r\(h=)r]}r^(hXForcing a cache missr_hjWh h#h%hAh'}r`(h+]h,]h*]h)]h-]uh/K§h0hh]rahDXForcing a cache missrb…rc}rd(hj_hj]ubaubhH)re}rf(hXÃ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.rghjWh h#h%hLh'}rh(h+]h,]h*]h)]h-]uh/K©h0hh]rihDXÃ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.rj…rk}rl(hjghjeubaubeubeubehUU transformerrmNU footnote_refsrn}roUrefnamesrp}rqUsymbol_footnotesrr]rsUautofootnote_refsrt]ruUsymbol_footnote_refsrv]rwU citationsrx]ryh0hU current_linerzNUtransform_messagesr{]r|cdocutils.nodes system_message r})r~}r(hUh'}r€(h+]UlevelKh)]h*]Usourceh#h,]h-]UlineKUtypeUINFOruh]r‚hH)rƒ}r„(hUh'}r…(h+]h,]h*]h)]h-]uhj~h]r†hDX6Hyperlink target "tutorial-purging" is not referenced.r‡…rˆ}r‰(hUhjƒubah%hLubah%Usystem_messagerŠubaUreporterr‹NUid_startrŒKU autofootnotesr]rŽU citation_refsr}rUindirect_targetsr‘]r’Usettingsr“(cdocutils.frontend Values r”or•}r–(Ufootnote_backlinksr—KUrecord_dependenciesr˜NU rfc_base_urlr™Uhttp://tools.ietf.org/html/ršU tracebackr›ˆUpep_referencesrœNUstrip_commentsrNU toc_backlinksržUentryrŸU language_coder Uenr¡U datestampr¢NU report_levelr£KU _destinationr¤NU halt_levelr¥KU strip_classesr¦NhANUerror_encoding_error_handlerr§Ubackslashreplacer¨Udebugr©NUembed_stylesheetrª‰Uoutput_encoding_error_handlerr«Ustrictr¬U sectnum_xformr­KUdump_transformsr®NU docinfo_xformr¯KUwarning_streamr°NUpep_file_url_templater±Upep-%04dr²Uexit_status_levelr³KUconfigr´NUstrict_visitorrµNUcloak_email_addressesr¶ˆUtrim_footnote_reference_spacer·‰Uenvr¸NUdump_pseudo_xmlr¹NUexpose_internalsrºNUsectsubtitle_xformr»‰U source_linkr¼NUrfc_referencesr½NUoutput_encodingr¾Uutf-8r¿U source_urlrÀNUinput_encodingrÁU utf-8-sigrÂU_disable_configrÃNU id_prefixrÄUU tab_widthrÅKUerror_encodingrÆUUTF-8rÇU_sourcerÈU4/home/tfheen/varnish/doc/sphinx/tutorial/purging.rstrÉUgettext_compactrʈU generatorrËNUdump_internalsrÌNU smart_quotesr͉U pep_base_urlrÎUhttp://www.python.org/dev/peps/rÏUsyntax_highlightrÐUlongrÑUinput_encoding_error_handlerrÒj¬Uauto_id_prefixrÓUidrÔUdoctitle_xformrÕ‰Ustrip_elements_with_classesrÖNU _config_filesr×]Ufile_insertion_enabledrØKU raw_enabledrÙKU dump_settingsrÚNubUsymbol_footnote_startrÛKUidsrÜ}rÝ(hjWhhZhh2hhµhh2uUsubstitution_namesrÞ}rßh%h0h'}rà(h+]h)]h*]Usourceh#h,]h-]uU footnotesrá]râUrefidsrã}räh]råhasub.varnish-3.0.5/doc/sphinx/=build/doctrees/tutorial/statistics.doctree0000644000175000017500000002341712247037213022610 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(X varnishtopqNX statisticsqNXtutorial-statisticsqˆX varnishhistq NX varnishsizesq NX varnishstatq NuUsubstitution_defsq }q Uparse_messagesq]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hU varnishtopqhU statisticsqhUtutorial-statisticsqh U varnishhistqh U varnishsizesqh U varnishstatquUchildrenq]q(cdocutils.nodes target q)q}q(U rawsourceq X.. _tutorial-statistics:Uparentq!hUsourceq"cdocutils.nodes reprunicode q#X7/home/tfheen/varnish/doc/sphinx/tutorial/statistics.rstq$…q%}q&bUtagnameq'Utargetq(U attributesq)}q*(Uidsq+]Ubackrefsq,]Udupnamesq-]Uclassesq.]Unamesq/]Urefidq0huUlineq1KUdocumentq2hh]ubcdocutils.nodes section q3)q4}q5(h Uh!hh"h%Uexpect_referenced_by_nameq6}q7hhsh'Usectionq8h)}q9(h-]h.]h,]h+]q:(hheh/]q;(hheuh1Kh2hUexpect_referenced_by_idq<}q=hhsh]q>(cdocutils.nodes title q?)q@}qA(h X StatisticsqBh!h4h"h%h'UtitleqCh)}qD(h-]h.]h,]h+]h/]uh1Kh2hh]qEcdocutils.nodes Text qFX StatisticsqG…qH}qI(h hBh!h@ubaubcdocutils.nodes paragraph qJ)qK}qL(h XtNow that your varnish is up and running let's have a look at how it is doing. There are several tools that can help.qMh!h4h"h%h'U paragraphqNh)}qO(h-]h.]h,]h+]h/]uh1Kh2hh]qPhFXtNow that your varnish is up and running let's have a look at how it is doing. There are several tools that can help.qQ…qR}qS(h hMh!hKubaubh3)qT}qU(h Uh!h4h"h%h'h8h)}qV(h-]h.]h,]h+]qWhah/]qXhauh1K h2hh]qY(h?)qZ}q[(h X varnishtopq\h!hTh"h%h'hCh)}q](h-]h.]h,]h+]h/]uh1K h2hh]q^hFX varnishtopq_…q`}qa(h h\h!hZubaubhJ)qb}qc(h XˆThe varnishtop utility reads the shared memory logs and presents a continuously updated list of the most commonly occurring log entries.qdh!hTh"h%h'hNh)}qe(h-]h.]h,]h+]h/]uh1K h2hh]qfhFXˆThe varnishtop utility reads the shared memory logs and presents a continuously updated list of the most commonly occurring log entries.qg…qh}qi(h hdh!hbubaubhJ)qj}qk(h XÅ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.qlh!hTh"h%h'hNh)}qm(h-]h.]h,]h+]h/]uh1Kh2hh]qnhFXÅ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.qo…qp}qq(h hlh!hjubaubhJ)qr}qs(h X``varnishtop -i rxurl`` will show you what URLs are being asked for by the client. ``varnishtop -i txurl`` will show you what your backend is being asked the most. ``varnishtop -i RxHeader -I Accept-Encoding`` will show the most popular Accept-Encoding header the client are sending you.h!hTh"h%h'hNh)}qt(h-]h.]h,]h+]h/]uh1Kh2hh]qu(cdocutils.nodes literal qv)qw}qx(h X``varnishtop -i rxurl``h)}qy(h-]h.]h,]h+]h/]uh!hrh]qzhFXvarnishtop -i rxurlq{…q|}q}(h Uh!hwubah'Uliteralq~ubhFX< will show you what URLs are being asked for by the client. q…q€}q(h X< will show you what URLs are being asked for by the client. h!hrubhv)q‚}qƒ(h X``varnishtop -i txurl``h)}q„(h-]h.]h,]h+]h/]uh!hrh]q…hFXvarnishtop -i txurlq†…q‡}qˆ(h Uh!h‚ubah'h~ubhFX: will show you what your backend is being asked the most. q‰…qŠ}q‹(h X: will show you what your backend is being asked the most. h!hrubhv)qŒ}q(h X-``varnishtop -i RxHeader -I Accept-Encoding``h)}qŽ(h-]h.]h,]h+]h/]uh!hrh]qhFX)varnishtop -i RxHeader -I Accept-Encodingq…q‘}q’(h Uh!hŒubah'h~ubhFXN will show the most popular Accept-Encoding header the client are sending you.q“…q”}q•(h XN will show the most popular Accept-Encoding header the client are sending you.h!hrubeubeubh3)q–}q—(h Uh!h4h"h%h'h8h)}q˜(h-]h.]h,]h+]q™hah/]qšh auh1Kh2hh]q›(h?)qœ}q(h X varnishhistqžh!h–h"h%h'hCh)}qŸ(h-]h.]h,]h+]h/]uh1Kh2hh]q hFX varnishhistq¡…q¢}q£(h hžh!hœubaubhJ)q¤}q¥(h Xƒ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 ("#").h!h–h"h%h'hNh)}q¦(h-]h.]h,]h+]h/]uh1Kh2hh]q§hFXƒ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 ("#").q¨…q©}qª(h Xƒ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 ("#").h!h¤ubaubeubh3)q«}q¬(h Uh!h4h"h%h'h8h)}q­(h-]h.]h,]h+]q®hah/]q¯h auh1K&h2hh]q°(h?)q±}q²(h X varnishsizesq³h!h«h"h%h'hCh)}q´(h-]h.]h,]h+]h/]uh1K&h2hh]qµhFX varnishsizesq¶…q·}q¸(h h³h!h±ubaubhJ)q¹}qº(h XÌVarnishsizes does the same as varnishhist, except it shows the size of the objects and not the time take to complete the request. This gives you a good overview of how big the objects you are serving are.q»h!h«h"h%h'hNh)}q¼(h-]h.]h,]h+]h/]uh1K(h2hh]q½hFXÌVarnishsizes does the same as varnishhist, except it shows the size of the objects and not the time take to complete the request. This gives you a good overview of how big the objects you are serving are.q¾…q¿}qÀ(h h»h!h¹ubaubeubh3)qÁ}qÂ(h Uh!h4h"h%h'h8h)}qÃ(h-]h.]h,]h+]qÄhah/]qÅh auh1K.h2hh]qÆ(h?)qÇ}qÈ(h X varnishstatqÉh!hÁh"h%h'hCh)}qÊ(h-]h.]h,]h+]h/]uh1K.h2hh]qËhFX varnishstatqÌ…qÍ}qÎ(h hÉh!hÇubaubhJ)qÏ}qÐ(h XÖ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.qÑh!hÁh"h%h'hNh)}qÒ(h-]h.]h,]h+]h/]uh1K0h2hh]qÓhFXÖ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.qÔ…qÕ}qÖ(h hÑh!hÏubaubhJ)q×}qØ(h Xæ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.h!hÁh"h%h'hNh)}qÙ(h-]h.]h,]h+]h/]uh1K5h2hh]qÚ(hFXThere are programs that can poll varnishstat regularly and make nice graphs of these counters. One such program is Munin. Munin can be found at qÛ…qÜ}qÝ(h XThere are programs that can poll varnishstat regularly and make nice graphs of these counters. One such program is Munin. Munin can be found at h!h×ubcdocutils.nodes reference qÞ)qß}qà(h Xhttp://munin-monitoring.org/qáh)}qâ(Urefuriháh+]h,]h-]h.]h/]uh!h×h]qãhFXhttp://munin-monitoring.org/qä…qå}qæ(h Uh!hßubah'U referenceqçubhFX: . There is a plugin for munin in the varnish source code.qè…qé}qê(h X: . There is a plugin for munin in the varnish source code.h!h×ubeubeubeubeh UU transformerqëNU footnote_refsqì}qíUrefnamesqî}qïUsymbol_footnotesqð]qñUautofootnote_refsqò]qóUsymbol_footnote_refsqô]qõU citationsqö]q÷h2hU current_lineqøNUtransform_messagesqù]qúcdocutils.nodes system_message qû)qü}qý(h Uh)}qþ(h-]UlevelKh+]h,]Usourceh%h.]h/]UlineKUtypeUINFOqÿuh]rhJ)r}r(h Uh)}r(h-]h.]h,]h+]h/]uh!hüh]rhFX9Hyperlink target "tutorial-statistics" is not referenced.r…r}r(h Uh!jubah'hNubah'Usystem_messagerubaUreporterr NUid_startr KU autofootnotesr ]r U citation_refsr }rUindirect_targetsr]rUsettingsr(cdocutils.frontend Values ror}r(Ufootnote_backlinksrKUrecord_dependenciesrNU rfc_base_urlrUhttp://tools.ietf.org/html/rU tracebackrˆUpep_referencesrNUstrip_commentsrNU toc_backlinksrUentryrU language_coderUenrU datestampr NU report_levelr!KU _destinationr"NU halt_levelr#KU strip_classesr$NhCNUerror_encoding_error_handlerr%Ubackslashreplacer&Udebugr'NUembed_stylesheetr(‰Uoutput_encoding_error_handlerr)Ustrictr*U sectnum_xformr+KUdump_transformsr,NU docinfo_xformr-KUwarning_streamr.NUpep_file_url_templater/Upep-%04dr0Uexit_status_levelr1KUconfigr2NUstrict_visitorr3NUcloak_email_addressesr4ˆUtrim_footnote_reference_spacer5‰Uenvr6NUdump_pseudo_xmlr7NUexpose_internalsr8NUsectsubtitle_xformr9‰U source_linkr:NUrfc_referencesr;NUoutput_encodingr<Uutf-8r=U source_urlr>NUinput_encodingr?U utf-8-sigr@U_disable_configrANU id_prefixrBUU tab_widthrCKUerror_encodingrDUUTF-8rEU_sourcerFU7/home/tfheen/varnish/doc/sphinx/tutorial/statistics.rstrGUgettext_compactrHˆU generatorrINUdump_internalsrJNU smart_quotesrK‰U pep_base_urlrLUhttp://www.python.org/dev/peps/rMUsyntax_highlightrNUlongrOUinput_encoding_error_handlerrPj*Uauto_id_prefixrQUidrRUdoctitle_xformrS‰Ustrip_elements_with_classesrTNU _config_filesrU]Ufile_insertion_enabledrVKU raw_enabledrWKU dump_settingsrXNubUsymbol_footnote_startrYKUidsrZ}r[(hhThh4hh4hh–hh«hhÁuUsubstitution_namesr\}r]h'h2h)}r^(h-]h+]h,]Usourceh%h.]h/]uU footnotesr_]r`Urefidsra}rbh]rchasub.varnish-3.0.5/doc/sphinx/=build/doctrees/tutorial/advanced_backend_servers.doctree0000644000175000017500000004562012247037213025403 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(X health checksqNXadvanced backend configurationqNX(tutorial-advanced_backend_servers-healthqˆX directorsq NX+tutorial-advanced_backend_servers-directorsq ˆuUsubstitution_defsq }q Uparse_messagesq ]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hU health-checksqhUadvanced-backend-configurationqhU(tutorial-advanced-backend-servers-healthqh U directorsqh U+tutorial-advanced-backend-servers-directorsquUchildrenq]q(cdocutils.nodes section q)q}q(U rawsourceqUUparentqhUsourceq cdocutils.nodes reprunicode q!XE/home/tfheen/varnish/doc/sphinx/tutorial/advanced_backend_servers.rstq"…q#}q$bUtagnameq%Usectionq&U attributesq'}q((Udupnamesq)]Uclassesq*]Ubackrefsq+]Uidsq,]q-haUnamesq.]q/hauUlineq0KUdocumentq1hh]q2(cdocutils.nodes title q3)q4}q5(hXAdvanced Backend configurationq6hhh h#h%Utitleq7h'}q8(h)]h*]h+]h,]h.]uh0Kh1hh]q9cdocutils.nodes Text q:XAdvanced Backend configurationq;…q<}q=(hh6hh4ubaubcdocutils.nodes paragraph q>)q?}q@(hX¬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.qAhhh h#h%U paragraphqBh'}qC(h)]h*]h+]h,]h.]uh0Kh1hh]qDh:X¬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.qE…qF}qG(hhAhh?ubaubh>)qH}qI(hXŽ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/.qJhhh h#h%hBh'}qK(h)]h*]h+]h,]h.]uh0Kh1hh]qLh:XŽ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/.qM…qN}qO(hhJhhHubaubh>)qP}qQ(hX^We manage to get the thing up and running on port 8000. Now, lets have a look a default.vcl.::hhh h#h%hBh'}qR(h)]h*]h+]h,]h.]uh0K h1hh]qSh:X]We manage to get the thing up and running on port 8000. Now, lets have a look a default.vcl.:qT…qU}qV(hX]We manage to get the thing up and running on port 8000. Now, lets have a look a default.vcl.:hhPubaubcdocutils.nodes literal_block qW)qX}qY(hX@backend default { .host = "127.0.0.1"; .port = "8080"; }hhh h#h%U literal_blockqZh'}q[(U xml:spaceq\Upreserveq]h,]h+]h)]h*]h.]uh0Kh1hh]q^h:X@backend default { .host = "127.0.0.1"; .port = "8080"; }q_…q`}qa(hUhhXubaubh>)qb}qc(hXWe add a new backend.::qdhhh h#h%hBh'}qe(h)]h*]h+]h,]h.]uh0Kh1hh]qfh:XWe add a new backend.:qg…qh}qi(hXWe add a new backend.:hhbubaubhW)qj}qk(hX=backend java { .host = "127.0.0.1"; .port = "8000"; }hhh h#h%hZh'}ql(h\h]h,]h+]h)]h*]h.]uh0Kh1hh]qmh:X=backend java { .host = "127.0.0.1"; .port = "8000"; }qn…qo}qp(hUhhjubaubh>)qq}qr(hXKNow we need tell where to send the difference URL. Lets look at vcl_recv.::qshhh h#h%hBh'}qt(h)]h*]h+]h,]h.]uh0Kh1hh]quh:XJNow we need tell where to send the difference URL. Lets look at vcl_recv.:qv…qw}qx(hXJNow we need tell where to send the difference URL. Lets look at vcl_recv.:hhqubaubhW)qy}qz(hX…sub vcl_recv { if (req.url ~ "^/java/") { set req.backend = java; } else { set req.backend = default. } }hhh h#h%hZh'}q{(h\h]h,]h+]h)]h*]h.]uh0Kh1hh]q|h:X…sub vcl_recv { if (req.url ~ "^/java/") { set req.backend = java; } else { set req.backend = default. } }q}…q~}q(hUhhyubaubh>)q€}q(hXIt's quite simple, really. Lets stop and think about this for a moment. As you can see you can define how you choose backends based on really arbitrary data. You want to send mobile devices to a different backend? No problem. if (req.User-agent ~ /mobile/) .... should do the trick.q‚hhh h#h%hBh'}qƒ(h)]h*]h+]h,]h.]uh0K%h1hh]q„h:XIt's quite simple, really. Lets stop and think about this for a moment. As you can see you can define how you choose backends based on really arbitrary data. You want to send mobile devices to a different backend? No problem. if (req.User-agent ~ /mobile/) .... should do the trick.q……q†}q‡(hh‚hh€ubaubcdocutils.nodes target qˆ)q‰}qŠ(hX0.. _tutorial-advanced_backend_servers-directors:hhh h#h%Utargetq‹h'}qŒ(h,]h+]h)]h*]h.]Urefidqhuh0K+h1hh]ubeubh)qŽ}q(hUhhh h#Uexpect_referenced_by_nameq}q‘h h‰sh%h&h'}q’(h)]h*]h+]h,]q“(hheh.]q”(h h euh0K.h1hUexpect_referenced_by_idq•}q–hh‰sh]q—(h3)q˜}q™(hX DirectorsqšhhŽh h#h%h7h'}q›(h)]h*]h+]h,]h.]uh0K.h1hh]qœh:X Directorsq…qž}qŸ(hhšhh˜ubaubh>)q }q¡(hXá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.::hhŽh h#h%hBh'}q¢(h)]h*]h+]h,]h.]uh0K0h1hh]q£h:Xà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.:q¤…q¥}q¦(hXà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.:hh ubaubhW)q§}q¨(hX^backend server1 { .host = "192.168.0.10"; } backend server2{ .host = "192.168.0.10"; }hhŽh h#h%hZh'}q©(h\h]h,]h+]h)]h*]h.]uh0K5h1hh]qªh:X^backend server1 { .host = "192.168.0.10"; } backend server2{ .host = "192.168.0.10"; }q«…q¬}q­(hUhh§ubaubh>)q®}q¯(hXNow we create the director.::q°hhŽh h#h%hBh'}q±(h)]h*]h+]h,]h.]uh0Kh1hh]q¹h:Xydirector example_director round-robin { { .backend = server1; } # server2 { .backend = server2; } # foo }qº…q»}q¼(hUhh¶ubaubh>)q½}q¾(hXá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.hhŽh h#h%hBh'}q¿(h)]h*]h+]h,]h.]uh0KJh1hh]qÀ(h:XThis director is a round-robin director. This means the director will distribute the incoming requests on a round-robin basis. There is also a qÁ…qÂ}qÃ(hXThis director is a round-robin director. This means the director will distribute the incoming requests on a round-robin basis. There is also a hh½ubcdocutils.nodes emphasis qÄ)qÅ}qÆ(hX*random*h'}qÇ(h)]h*]h+]h,]h.]uhh½h]qÈh:XrandomqÉ…qÊ}qË(hUhhÅubah%UemphasisqÌubh:XJ director which distributes requests in a, you guessed it, random fashion.qÍ…qÎ}qÏ(hXJ director which distributes requests in a, you guessed it, random fashion.hh½ubeubh>)qÐ}qÑ(hX¢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.qÒhhŽh h#h%hBh'}qÓ(h)]h*]h+]h,]h.]uh0KOh1hh]qÔh:X¢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.qÕ…qÖ}q×(hhÒhhÐubaubhˆ)qØ}qÙ(hX-.. _tutorial-advanced_backend_servers-health:hhŽh h#h%h‹h'}qÚ(h,]h+]h)]h*]h.]hhuh0KSh1hh]ubeubh)qÛ}qÜ(hUhhh h#h}qÝhhØsh%h&h'}qÞ(h)]h*]h+]h,]qß(hheh.]qà(hheuh0KVh1hh•}qáhhØsh]qâ(h3)qã}qä(hX Health checksqåhhÛh h#h%h7h'}qæ(h)]h*]h+]h,]h.]uh0KVh1hh]qçh:X Health checksqè…qé}qê(hhåhhãubaubh>)që}qì(hX]Lets set up a director with two backends and health checks. First lets define the backends.::hhÛh h#h%hBh'}qí(h)]h*]h+]h,]h.]uh0KXh1hh]qîh:X\Lets set up a director with two backends and health checks. First lets define the backends.:qï…qð}qñ(hX\Lets set up a director with two backends and health checks. First lets define the backends.:hhëubaubhW)qò}qó(hXbackend server1 { .host = "server1.example.com"; .probe = { .url = "/"; .interval = 5s; .timeout = 1 s; .window = 5; .threshold = 3; } } backend server2 { .host = "server2.example.com"; .probe = { .url = "/"; .interval = 5s; .timeout = 1 s; .window = 5; .threshold = 3; } }hhÛh h#h%hZh'}qô(h\h]h,]h+]h)]h*]h.]uh0K[h1hh]qõh:Xbackend server1 { .host = "server1.example.com"; .probe = { .url = "/"; .interval = 5s; .timeout = 1 s; .window = 5; .threshold = 3; } } backend server2 { .host = "server2.example.com"; .probe = { .url = "/"; .interval = 5s; .timeout = 1 s; .window = 5; .threshold = 3; } }qö…q÷}qø(hUhhòubaubh>)qù}qú(hXhWhats new here is the probe. Varnish will check the health of each backend with a probe. The options areqûhhÛh h#h%hBh'}qü(h)]h*]h+]h,]h.]uh0Kph1hh]qýh:XhWhats new here is the probe. Varnish will check the health of each backend with a probe. The options areqþ…qÿ}r(hhûhhùubaubcdocutils.nodes definition_list r)r}r(hUhhÛh h#h%Udefinition_listrh'}r(h)]h*]h+]h,]h.]uh0Nh1hh]r(cdocutils.nodes definition_list_item r)r}r (hX%url What URL should varnish request. hjh h#h%Udefinition_list_itemr h'}r (h)]h*]h+]h,]h.]uh0Kth]r (cdocutils.nodes term r )r}r(hXurlrhjh h#h%Utermrh'}r(h)]h*]h+]h,]h.]uh0Kth]rh:Xurlr…r}r(hjhjubaubcdocutils.nodes definition r)r}r(hUh'}r(h)]h*]h+]h,]h.]uhjh]rh>)r}r(hX What URL should varnish request.rhjh h#h%hBh'}r(h)]h*]h+]h,]h.]uh0Kth]r h:X What URL should varnish request.r!…r"}r#(hjhjubaubah%U definitionr$ubeubj)r%}r&(hX"interval How often should we poll hjh h#h%j h'}r'(h)]h*]h+]h,]h.]uh0Kwh1hh]r((j )r)}r*(hXintervalr+hj%h h#h%jh'}r,(h)]h*]h+]h,]h.]uh0Kwh]r-h:Xintervalr.…r/}r0(hj+hj)ubaubj)r1}r2(hUh'}r3(h)]h*]h+]h,]h.]uhj%h]r4h>)r5}r6(hXHow often should we pollr7hj1h h#h%hBh'}r8(h)]h*]h+]h,]h.]uh0Kwh]r9h:XHow often should we pollr:…r;}r<(hj7hj5ubaubah%j$ubeubj)r=}r>(hX)timeout What is the timeout of the probe hjh h#h%j h'}r?(h)]h*]h+]h,]h.]uh0Kzh1hh]r@(j )rA}rB(hXtimeoutrChj=h h#h%jh'}rD(h)]h*]h+]h,]h.]uh0Kzh]rEh:XtimeoutrF…rG}rH(hjChjAubaubj)rI}rJ(hUh'}rK(h)]h*]h+]h,]h.]uhj=h]rLh>)rM}rN(hX What is the timeout of the proberOhjIh h#h%hBh'}rP(h)]h*]h+]h,]h.]uh0Kzh]rQh:X What is the timeout of the proberR…rS}rT(hjOhjMubaubah%j$ubeubj)rU}rV(hXawindow Varnish will maintain a *sliding window* of the results. Here the window has five checks. hjh h#h%j h'}rW(h)]h*]h+]h,]h.]uh0K~h1hh]rX(j )rY}rZ(hXwindowr[hjUh h#h%jh'}r\(h)]h*]h+]h,]h.]uh0K~h]r]h:Xwindowr^…r_}r`(hj[hjYubaubj)ra}rb(hUh'}rc(h)]h*]h+]h,]h.]uhjUh]rdh>)re}rf(hXYVarnish will maintain a *sliding window* of the results. Here the window has five checks.hjah h#h%hBh'}rg(h)]h*]h+]h,]h.]uh0K}h]rh(h:XVarnish will maintain a ri…rj}rk(hXVarnish will maintain a hjeubhÄ)rl}rm(hX*sliding window*h'}rn(h)]h*]h+]h,]h.]uhjeh]roh:Xsliding windowrp…rq}rr(hUhjlubah%hÌubh:X1 of the results. Here the window has five checks.rs…rt}ru(hX1 of the results. Here the window has five checks.hjeubeubah%j$ubeubj)rv}rw(hXbthreshold How many of the .window last polls must be good for the backend to be declared healthy. hjh h#h%j h'}rx(h)]h*]h+]h,]h.]uh0Kh1hh]ry(j )rz}r{(hX thresholdr|hjvh h#h%jh'}r}(h)]h*]h+]h,]h.]uh0Kh]r~h:X thresholdr…r€}r(hj|hjzubaubj)r‚}rƒ(hUh'}r„(h)]h*]h+]h,]h.]uhjvh]r…h>)r†}r‡(hXWHow many of the .window last polls must be good for the backend to be declared healthy.rˆhj‚h h#h%hBh'}r‰(h)]h*]h+]h,]h.]uh0Kh]rŠh:XWHow many of the .window last polls must be good for the backend to be declared healthy.r‹…rŒ}r(hjˆhj†ubaubah%j$ubeubj)rŽ}r(hXqinitial How many of the of the probes a good when Varnish starts - defaults to the same amount as the threshold. hjh h#h%j h'}r(h)]h*]h+]h,]h.]uh0K…h1hh]r‘(j )r’}r“(hXinitialr”hjŽh h#h%jh'}r•(h)]h*]h+]h,]h.]uh0K…h]r–h:Xinitialr—…r˜}r™(hj”hj’ubaubj)rš}r›(hUh'}rœ(h)]h*]h+]h,]h.]uhjŽh]rh>)rž}rŸ(hXhHow many of the of the probes a good when Varnish starts - defaults to the same amount as the threshold.r hjšh h#h%hBh'}r¡(h)]h*]h+]h,]h.]uh0K„h]r¢h:XhHow many of the of the probes a good when Varnish starts - defaults to the same amount as the threshold.r£…r¤}r¥(hj hjžubaubah%j$ubeubeubh>)r¦}r§(hXNow we define the director.::r¨hhÛh h#h%hBh'}r©(h)]h*]h+]h,]h.]uh0K‡h1hh]rªh:XNow we define the director.:r«…r¬}r­(hXNow we define the director.:hj¦ubaubhW)r®}r¯(hX¤director example_director round-robin { { .backend = server1; } # server2 { .backend = server2; } }hhÛh h#h%hZh'}r°(h\h]h,]h+]h)]h*]h.]uh0K‰h1hh]r±h:X¤director example_director round-robin { { .backend = server1; } # server2 { .backend = server2; } }r²…r³}r´(hUhj®ubaubh>)rµ}r¶(hX/You use this director just as you would use any other director or 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:`tutorial-handling_misbehaving_servers` for more information on how to enable this.hhÛh h#h%hBh'}r·(h)]h*]h+]h,]h.]uh0K”h1hh]r¸(h:X×You use this director just as you would use any other director or 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 r¹…rº}r»(hX×You use this director just as you would use any other director or 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 hjµubcsphinx.addnodes pending_xref r¼)r½}r¾(hX,:ref:`tutorial-handling_misbehaving_servers`r¿hjµh h#h%U pending_xrefrÀh'}rÁ(UreftypeXrefUrefwarnrˆU reftargetrÃX%tutorial-handling_misbehaving_serversU refdomainXstdrÄh,]h+]U refexplicit‰h)]h*]h.]UrefdocrÅU!tutorial/advanced_backend_serversrÆuh0K”h]rÇhÄ)rÈ}rÉ(hj¿h'}rÊ(h)]h*]rË(UxrefrÌjÄXstd-refrÍeh+]h,]h.]uhj½h]rÎh:X%tutorial-handling_misbehaving_serversrÏ…rÐ}rÑ(hUhjÈubah%hÌubaubh:X, for more information on how to enable this.rÒ…rÓ}rÔ(hX, for more information on how to enable this.hjµubeubh>)rÕ}rÖ(hXðPlease note that Varnish will keep probes active 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.r×hhÛh h#h%hBh'}rØ(h)]h*]h+]h,]h.]uh0Kšh1hh]rÙh:XðPlease note that Varnish will keep probes active 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.rÚ…rÛ}rÜ(hj×hjÕubaubeubehUU transformerrÝNU footnote_refsrÞ}rßUrefnamesrà}ráUsymbol_footnotesrâ]rãUautofootnote_refsrä]råUsymbol_footnote_refsræ]rçU citationsrè]réh1hU current_linerêNUtransform_messagesrë]rì(cdocutils.nodes system_message rí)rî}rï(hUh'}rð(h)]UlevelKh,]h+]Usourceh#h*]h.]UlineK+UtypeUINFOrñuh]ròh>)ró}rô(hUh'}rõ(h)]h*]h+]h,]h.]uhjîh]röh:XQHyperlink target "tutorial-advanced-backend-servers-directors" is not referenced.r÷…rø}rù(hUhjóubah%hBubah%Usystem_messagerúubjí)rû}rü(hUh'}rý(h)]UlevelKh,]h+]Usourceh#h*]h.]UlineKSUtypejñuh]rþh>)rÿ}r(hUh'}r(h)]h*]h+]h,]h.]uhjûh]rh:XNHyperlink target "tutorial-advanced-backend-servers-health" is not referenced.r…r}r(hUhjÿubah%hBubah%júubeUreporterrNUid_startrKU autofootnotesr]r U citation_refsr }r Uindirect_targetsr ]r Usettingsr(cdocutils.frontend Values ror}r(Ufootnote_backlinksrKUrecord_dependenciesrNU rfc_base_urlrUhttp://tools.ietf.org/html/rU tracebackrˆUpep_referencesrNUstrip_commentsrNU toc_backlinksrUentryrU language_coderUenrU datestamprNU report_levelrKU _destinationrNU halt_levelr KU strip_classesr!Nh7NUerror_encoding_error_handlerr"Ubackslashreplacer#Udebugr$NUembed_stylesheetr%‰Uoutput_encoding_error_handlerr&Ustrictr'U sectnum_xformr(KUdump_transformsr)NU docinfo_xformr*KUwarning_streamr+NUpep_file_url_templater,Upep-%04dr-Uexit_status_levelr.KUconfigr/NUstrict_visitorr0NUcloak_email_addressesr1ˆUtrim_footnote_reference_spacer2‰Uenvr3NUdump_pseudo_xmlr4NUexpose_internalsr5NUsectsubtitle_xformr6‰U source_linkr7NUrfc_referencesr8NUoutput_encodingr9Uutf-8r:U source_urlr;NUinput_encodingr<U utf-8-sigr=U_disable_configr>NU id_prefixr?UU tab_widthr@KUerror_encodingrAUUTF-8rBU_sourcerCUE/home/tfheen/varnish/doc/sphinx/tutorial/advanced_backend_servers.rstrDUgettext_compactrEˆU generatorrFNUdump_internalsrGNU smart_quotesrH‰U pep_base_urlrIUhttp://www.python.org/dev/peps/rJUsyntax_highlightrKUlongrLUinput_encoding_error_handlerrMj'Uauto_id_prefixrNUidrOUdoctitle_xformrP‰Ustrip_elements_with_classesrQNU _config_filesrR]Ufile_insertion_enabledrSKU raw_enabledrTKU dump_settingsrUNubUsymbol_footnote_startrVKUidsrW}rX(hhhhÛhhŽhhŽhhÛuUsubstitution_namesrY}rZh%h1h'}r[(h)]h,]h+]Usourceh#h*]h.]uU footnotesr\]r]Urefidsr^}r_(h]r`hØah]rah‰auub.varnish-3.0.5/doc/sphinx/=build/doctrees/tutorial/increasing_your_hitrate.doctree0000644000175000017500000007642712247037213025347 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(X tutorial-increasing_your_hitrateqˆX:forcing caching for certain requests and certain responsesqNX!overriding the time-to-live (ttl)qNXtool: lwp-requestq NX)ways of increasing your hitrate even moreq NXtool: varnishtopq NX cache-controlq NXnormalizing your namespaceq NXthe role of http headersqNX authorizationqNXtool: varnishlogqNXpragmaqNXtool: live http headersqNXageqNXachieving a high hitrateqNuUsubstitution_defsq}qUparse_messagesq]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hU tutorial-increasing-your-hitrateqhU:forcing-caching-for-certain-requests-and-certain-responsesqhUoverriding-the-time-to-live-ttlq h Utool-lwp-requestq!h U)ways-of-increasing-your-hitrate-even-moreq"h Utool-varnishtopq#h U cache-controlq$h Unormalizing-your-namespaceq%hUthe-role-of-http-headersq&hU authorizationq'hUtool-varnishlogq(hUpragmaq)hUtool-live-http-headersq*hUageq+hUachieving-a-high-hitrateq,uUchildrenq-]q.(cdocutils.nodes target q/)q0}q1(U rawsourceq2X%.. _tutorial-increasing_your_hitrate:Uparentq3hUsourceq4cdocutils.nodes reprunicode q5XD/home/tfheen/varnish/doc/sphinx/tutorial/increasing_your_hitrate.rstq6…q7}q8bUtagnameq9Utargetq:U attributesq;}q<(Uidsq=]Ubackrefsq>]Udupnamesq?]Uclassesq@]UnamesqA]UrefidqBhuUlineqCKUdocumentqDhh-]ubcdocutils.nodes section qE)qF}qG(h2Uh3hh4h7Uexpect_referenced_by_nameqH}qIhh0sh9UsectionqJh;}qK(h?]h@]h>]h=]qL(h,hehA]qM(hheuhCKhDhUexpect_referenced_by_idqN}qOhh0sh-]qP(cdocutils.nodes title qQ)qR}qS(h2XAchieving a high hitrateqTh3hFh4h7h9UtitleqUh;}qV(h?]h@]h>]h=]hA]uhCKhDhh-]qWcdocutils.nodes Text qXXAchieving a high hitrateqY…qZ}q[(h2hTh3hRubaubcdocutils.nodes paragraph q\)q]}q^(h2X0Now that Varnish is up and running, and 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 hit rate in Varnish.q_h3hFh4h7h9U paragraphq`h;}qa(h?]h@]h>]h=]hA]uhCKhDhh-]qbhXX0Now that Varnish is up and running, and 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 hit rate in Varnish.qc…qd}qe(h2h_h3h]ubaubh\)qf}qg(h2Xß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, I'll guide you through a couple of tools that you will find useful.qhh3hFh4h7h9h`h;}qi(h?]h@]h>]h=]hA]uhCK hDhh-]qjhXXß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, I'll guide you through a couple of tools that you will find useful.qk…ql}qm(h2hhh3hfubaubh\)qn}qo(h2XäNote that you need a tool to see what HTTP headers fly between you and the web server. On the Varnish server, the easiest is to use varnishlog and varnishtop but sometimes a client-side tool makes sense. Here are the ones I use.qph3hFh4h7h9h`h;}qq(h?]h@]h>]h=]hA]uhCKhDhh-]qrhXXäNote that you need a tool to see what HTTP headers fly between you and the web server. On the Varnish server, the easiest is to use varnishlog and varnishtop but sometimes a client-side tool makes sense. Here are the ones I use.qs…qt}qu(h2hph3hnubaubhE)qv}qw(h2Uh3hFh4h7h9hJh;}qx(h?]h@]h>]h=]qyh#ahA]qzh auhCKhDhh-]q{(hQ)q|}q}(h2XTool: varnishtopq~h3hvh4h7h9hUh;}q(h?]h@]h>]h=]hA]uhCKhDhh-]q€hXXTool: varnishtopq…q‚}qƒ(h2h~h3h|ubaubh\)q„}q…(h2XÒYou can use varnishtop to identify what URLs are hitting the backend the most. ``varnishtop -i txurl`` is an essential command. You can see some other examples of varnishtop usage in :ref:`tutorial-statistics`.h3hvh4h7h9h`h;}q†(h?]h@]h>]h=]hA]uhCKhDhh-]q‡(hXXOYou can use varnishtop to identify what URLs are hitting the backend the most. qˆ…q‰}qŠ(h2XOYou can use varnishtop to identify what URLs are hitting the backend the most. h3h„ubcdocutils.nodes literal q‹)qŒ}q(h2X``varnishtop -i txurl``h;}qŽ(h?]h@]h>]h=]hA]uh3h„h-]qhXXvarnishtop -i txurlq…q‘}q’(h2Uh3hŒubah9Uliteralq“ubhXXQ is an essential command. You can see some other examples of varnishtop usage in q”…q•}q–(h2XQ is an essential command. You can see some other examples of varnishtop usage in h3h„ubcsphinx.addnodes pending_xref q—)q˜}q™(h2X:ref:`tutorial-statistics`qšh3h„h4h7h9U pending_xrefq›h;}qœ(UreftypeXrefUrefwarnqˆU reftargetqžXtutorial-statisticsU refdomainXstdqŸh=]h>]U refexplicit‰h?]h@]hA]Urefdocq U tutorial/increasing_your_hitrateq¡uhCKh-]q¢cdocutils.nodes emphasis q£)q¤}q¥(h2hšh;}q¦(h?]h@]q§(Uxrefq¨hŸXstd-refq©eh>]h=]hA]uh3h˜h-]qªhXXtutorial-statisticsq«…q¬}q­(h2Uh3h¤ubah9Uemphasisq®ubaubhXX.…q¯}q°(h2X.h3h„ubeubeubhE)q±}q²(h2Uh3hFh4h7h9hJh;}q³(h?]h@]h>]h=]q´h(ahA]qµhauhCKhDhh-]q¶(hQ)q·}q¸(h2XTool: varnishlogq¹h3h±h4h7h9hUh;}qº(h?]h@]h>]h=]hA]uhCKhDhh-]q»hXXTool: varnishlogq¼…q½}q¾(h2h¹h3h·ubaubh\)q¿}qÀ(h2XñWhen you have identified the an URL which is frequently sent to the backend you can use varnishlog to have a look at the request. ``varnishlog -c -m 'RxURL:^/foo/bar`` will show you the requests coming from the client (-c) matching /foo/bar.h3h±h4h7h9h`h;}qÁ(h?]h@]h>]h=]hA]uhCK!hDhh-]qÂ(hXX‚When you have identified the an URL which is frequently sent to the backend you can use varnishlog to have a look at the request. qÃ…qÄ}qÅ(h2X‚When you have identified the an URL which is frequently sent to the backend you can use varnishlog to have a look at the request. h3h¿ubh‹)qÆ}qÇ(h2X%``varnishlog -c -m 'RxURL:^/foo/bar``h;}qÈ(h?]h@]h>]h=]hA]uh3h¿h-]qÉhXX!varnishlog -c -m 'RxURL:^/foo/barqÊ…qË}qÌ(h2Uh3hÆubah9h“ubhXXJ will show you the requests coming from the client (-c) matching /foo/bar.qÍ…qÎ}qÏ(h2XJ will show you the requests coming from the client (-c) matching /foo/bar.h3h¿ubeubh\)qÐ}qÑ(h2XmFor more information on how varnishlog works please see :ref:`tutorial-logging` or man :ref:`ref-varnishlog`.h3h±h4h7h9h`h;}qÒ(h?]h@]h>]h=]hA]uhCK&hDhh-]qÓ(hXX8For more information on how varnishlog works please see qÔ…qÕ}qÖ(h2X8For more information on how varnishlog works please see h3hÐubh—)q×}qØ(h2X:ref:`tutorial-logging`qÙh3hÐh4h7h9h›h;}qÚ(UreftypeXrefhˆhžXtutorial-loggingU refdomainXstdqÛh=]h>]U refexplicit‰h?]h@]hA]h h¡uhCK&h-]qÜh£)qÝ}qÞ(h2hÙh;}qß(h?]h@]qà(h¨hÛXstd-refqáeh>]h=]hA]uh3h×h-]qâhXXtutorial-loggingqã…qä}qå(h2Uh3hÝubah9h®ubaubhXX or man qæ…qç}qè(h2X or man h3hÐubh—)qé}qê(h2X:ref:`ref-varnishlog`qëh3hÐh4h7h9h›h;}qì(UreftypeXrefhˆhžXref-varnishlogU refdomainXstdqíh=]h>]U refexplicit‰h?]h@]hA]h h¡uhCK&h-]qîh£)qï}qð(h2hëh;}qñ(h?]h@]qò(h¨híXstd-refqóeh>]h=]hA]uh3héh-]qôhXXref-varnishlogqõ…qö}q÷(h2Uh3hïubah9h®ubaubhXX.…qø}qù(h2X.h3hÐubeubh\)qú}qû(h2XdFor extended diagnostics headers, see http://www.varnish-cache.org/trac/wiki/VCLExampleHitMissHeaderh3h±h4h7h9h`h;}qü(h?]h@]h>]h=]hA]uhCK)hDhh-]qý(hXX&For extended diagnostics headers, see qþ…qÿ}r(h2X&For extended diagnostics headers, see h3húubcdocutils.nodes reference r)r}r(h2X>http://www.varnish-cache.org/trac/wiki/VCLExampleHitMissHeaderrh;}r(Urefurijh=]h>]h?]h@]hA]uh3húh-]rhXX>http://www.varnish-cache.org/trac/wiki/VCLExampleHitMissHeaderr…r}r (h2Uh3jubah9U referencer ubeubeubhE)r }r (h2Uh3hFh4h7h9hJh;}r (h?]h@]h>]h=]rh!ahA]rh auhCK.hDhh-]r(hQ)r}r(h2XTool: lwp-requestrh3j h4h7h9hUh;}r(h?]h@]h>]h=]hA]uhCK.hDhh-]rhXXTool: lwp-requestr…r}r(h2jh3jubaubh\)r}r(h2XÅlwp-request is part of The World-Wide Web library for Perl. It's a couple of really basic programs that can execute an HTTP request and give you the result. I mostly use two programs, GET and HEAD.rh3j h4h7h9h`h;}r(h?]h@]h>]h=]hA]uhCK0hDhh-]rhXXÅlwp-request is part of The World-Wide Web library for Perl. It's a couple of really basic programs that can execute an HTTP request and give you the result. I mostly use two programs, GET and HEAD.r…r}r (h2jh3jubaubh\)r!}r"(h2XÁ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::h3j h4h7h9h`h;}r#(h?]h@]h>]h=]hA]uhCK4hDhh-]r$hXXÀ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:r%…r&}r'(h2XÀ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:h3j!ubaubcdocutils.nodes literal_block r()r)}r*(h2XÒ$ 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: leonh3j h4h7h9U literal_blockr+h;}r,(U xml:spacer-Upreserver.h=]h>]h?]h@]hA]uhCK8hDhh-]r/hXXÒ$ 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: leonr0…r1}r2(h2Uh3j)ubaubh\)r3}r4(h2X>OK. Let me explain what it does. GET usually sends off HTTP 0.9 requests, which lack the Host header. So I 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.r5h3j h4h7h9h`h;}r6(h?]h@]h>]h=]hA]uhCKIhDhh-]r7hXX>OK. Let me explain what it does. GET usually sends off HTTP 0.9 requests, which lack the Host header. So I 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.r8…r9}r:(h2j5h3j3ubaubh\)r;}r<(h2Xî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.r=h3j h4h7h9h`h;}r>(h?]h@]h>]h=]hA]uhCKOhDhh-]r?hXXî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.r@…rA}rB(h2j=h3j;ubaubh\)rC}rD(h2XFSo, to check whether a site sets cookies for a specific URL, just do::rEh3j h4h7h9h`h;}rF(h?]h@]h>]h=]hA]uhCKThDhh-]rGhXXESo, to check whether a site sets cookies for a specific URL, just do:rH…rI}rJ(h2XESo, to check whether a site sets cookies for a specific URL, just do:h3jCubaubj()rK}rL(h2X/GET -Used http://example.com/ |grep ^Set-Cookieh3j h4h7h9j+h;}rM(j-j.h=]h>]h?]h@]hA]uhCKVhDhh-]rNhXX/GET -Used http://example.com/ |grep ^Set-CookierO…rP}rQ(h2Uh3jKubaubeubhE)rR}rS(h2Uh3hFh4h7h9hJh;}rT(h?]h@]h>]h=]rUh*ahA]rVhauhCKYhDhh-]rW(hQ)rX}rY(h2XTool: Live HTTP HeadersrZh3jRh4h7h9hUh;}r[(h?]h@]h>]h=]hA]uhCKYhDhh-]r\hXXTool: Live HTTP Headersr]…r^}r_(h2jZh3jXubaubh\)r`}ra(h2XéThere is also a plugin for Firefox. *Live HTTP Headers* can show you what headers are being sent and recieved. Live HTTP Headers can be found at https://addons.mozilla.org/en-US/firefox/addon/3829/ or by googling "Live HTTP Headers".h3jRh4h7h9h`h;}rb(h?]h@]h>]h=]hA]uhCK[hDhh-]rc(hXX$There is also a plugin for Firefox. rd…re}rf(h2X$There is also a plugin for Firefox. h3j`ubh£)rg}rh(h2X*Live HTTP Headers*h;}ri(h?]h@]h>]h=]hA]uh3j`h-]rjhXXLive HTTP Headersrk…rl}rm(h2Uh3jgubah9h®ubhXXZ can show you what headers are being sent and recieved. Live HTTP Headers can be found at rn…ro}rp(h2XZ can show you what headers are being sent and recieved. Live HTTP Headers can be found at h3j`ubj)rq}rr(h2X4https://addons.mozilla.org/en-US/firefox/addon/3829/rsh;}rt(Urefurijsh=]h>]h?]h@]hA]uh3j`h-]ruhXX4https://addons.mozilla.org/en-US/firefox/addon/3829/rv…rw}rx(h2Uh3jqubah9j ubhXX$ or by googling "Live HTTP Headers".ry…rz}r{(h2X$ or by googling "Live HTTP Headers".h3j`ubeubeubhE)r|}r}(h2Uh3hFh4h7h9hJh;}r~(h?]h@]h>]h=]rh&ahA]r€hauhCKbhDhh-]r(hQ)r‚}rƒ(h2XThe role of HTTP Headersr„h3j|h4h7h9hUh;}r…(h?]h@]h>]h=]hA]uhCKbhDhh-]r†hXXThe role of HTTP Headersr‡…rˆ}r‰(h2j„h3j‚ubaubh\)rŠ}r‹(h2XÛ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.rŒh3j|h4h7h9h`h;}r(h?]h@]h>]h=]hA]uhCKdhDhh-]rŽhXXÛ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.r…r}r‘(h2jŒh3jŠubaubh\)r’}r“(h2X§Please note that when considering these headers Varnish actually considers itself *part of* the actual webserver. The rationale being that both are under your control.h3j|h4h7h9h`h;}r”(h?]h@]h>]h=]hA]uhCKihDhh-]r•(hXXRPlease note that when considering these headers Varnish actually considers itself r–…r—}r˜(h2XRPlease note that when considering these headers Varnish actually considers itself h3j’ubh£)r™}rš(h2X *part of*h;}r›(h?]h@]h>]h=]hA]uh3j’h-]rœhXXpart ofr…rž}rŸ(h2Uh3j™ubah9h®ubhXXL the actual webserver. The rationale being that both are under your control.r …r¡}r¢(h2XL the actual webserver. The rationale being that both are under your control.h3j’ubeubh\)r£}r¤(h2X›The term *surrogate origin cache* is not really well defined by the IETF so RFC 2616 so the various ways Varnish works might differ from your expectations.h3j|h4h7h9h`h;}r¥(h?]h@]h>]h=]hA]uhCKmhDhh-]r¦(hXX The term r§…r¨}r©(h2X The term h3j£ubh£)rª}r«(h2X*surrogate origin cache*h;}r¬(h?]h@]h>]h=]hA]uh3j£h-]r­hXXsurrogate origin cacher®…r¯}r°(h2Uh3jªubah9h®ubhXXz is not really well defined by the IETF so RFC 2616 so the various ways Varnish works might differ from your expectations.r±…r²}r³(h2Xz is not really well defined by the IETF so RFC 2616 so the various ways Varnish works might differ from your expectations.h3j£ubeubh\)r´}rµ(h2XBLet's take a look at the important headers you should be aware of:r¶h3j|h4h7h9h`h;}r·(h?]h@]h>]h=]hA]uhCKqhDhh-]r¸hXXBLet's take a look at the important headers you should be aware of:r¹…rº}r»(h2j¶h3j´ubaubeubhE)r¼}r½(h2Uh3hFh4h7h9hJh;}r¾(h?]h@]h>]h=]r¿h$ahA]rÀh auhCKthDhh-]rÁ(hQ)rÂ}rÃ(h2X Cache-ControlrÄh3j¼h4h7h9hUh;}rÅ(h?]h@]h>]h=]hA]uhCKthDhh-]rÆhXX Cache-ControlrÇ…rÈ}rÉ(h2jÄh3jÂubaubh\)rÊ}rË(h2X™The Cache-Control instructs caches how to handle the content. Varnish cares about the *max-age* parameter and uses it to calculate the TTL for an object.h3j¼h4h7h9h`h;}rÌ(h?]h@]h>]h=]hA]uhCKvhDhh-]rÍ(hXXVThe Cache-Control instructs caches how to handle the content. Varnish cares about the rÎ…rÏ}rÐ(h2XVThe Cache-Control instructs caches how to handle the content. Varnish cares about the h3jÊubh£)rÑ}rÒ(h2X *max-age*h;}rÓ(h?]h@]h>]h=]hA]uh3jÊh-]rÔhXXmax-agerÕ…rÖ}r×(h2Uh3jÑubah9h®ubhXX: parameter and uses it to calculate the TTL for an object.rØ…rÙ}rÚ(h2X: parameter and uses it to calculate the TTL for an object.h3jÊubeubh\)rÛ}rÜ(h2X["Cache-Control: nocache" is ignored but if you need this you can easily add support for it.rÝh3j¼h4h7h9h`h;}rÞ(h?]h@]h>]h=]hA]uhCKzhDhh-]rßhXX["Cache-Control: nocache" is ignored but if you need this you can easily add support for it.rà…rá}râ(h2jÝh3jÛubaubh\)rã}rä(h2XŠ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::h3j¼h4h7h9h`h;}rå(h?]h@]h>]h=]hA]uhCK}hDhh-]ræhXX‰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:rç…rè}ré(h2X‰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:h3jãubaubj()rê}rë(h2Xc$ GET -Used http://www.varnish-software.com/|grep ^Cache-Control Cache-Control: public, max-age=600h3j¼h4h7h9j+h;}rì(j-j.h=]h>]h?]h@]hA]uhCKhDhh-]ríhXXc$ GET -Used http://www.varnish-software.com/|grep ^Cache-Control Cache-Control: public, max-age=600rî…rï}rð(h2Uh3jêubaubeubhE)rñ}rò(h2Uh3hFh4h7h9hJh;}ró(h?]h@]h>]h=]rôh+ahA]rõhauhCK…hDhh-]rö(hQ)r÷}rø(h2XAgerùh3jñh4h7h9hUh;}rú(h?]h@]h>]h=]hA]uhCK…hDhh-]rûhXXAgerü…rý}rþ(h2jùh3j÷ubaubh\)rÿ}r(h2X‰Varnish adds an Age header to indicate how long the object has been kept inside Varnish. You can grep out Age from varnishlog like this::h3jñh4h7h9h`h;}r(h?]h@]h>]h=]hA]uhCK‡hDhh-]rhXXˆVarnish adds an Age header to indicate how long the object has been kept inside Varnish. You can grep out Age from varnishlog like this:r…r}r(h2XˆVarnish adds an Age header to indicate how long the object has been kept inside Varnish. You can grep out Age from varnishlog like this:h3jÿubaubj()r}r(h2Xvarnishlog -i TxHeader -I ^Ageh3jñh4h7h9j+h;}r(j-j.h=]h>]h?]h@]hA]uhCKŠhDhh-]r hXXvarnishlog -i TxHeader -I ^Ager …r }r (h2Uh3jubaubeubhE)r }r(h2Uh3hFh4h7h9hJh;}r(h?]h@]h>]h=]rh)ahA]rhauhCKhDhh-]r(hQ)r}r(h2XPragmarh3j h4h7h9hUh;}r(h?]h@]h>]h=]hA]uhCKhDhh-]rhXXPragmar…r}r(h2jh3jubaubh\)r}r(h2X‚An HTTP 1.0 server might send "Pragma: nocache". Varnish ignores this header. You could easily add support for this header in VCL.rh3j h4h7h9h`h;}r(h?]h@]h>]h=]hA]uhCKhDhh-]rhXX‚An HTTP 1.0 server might send "Pragma: nocache". Varnish ignores this header. You could easily add support for this header in VCL.r …r!}r"(h2jh3jubaubh\)r#}r$(h2XIn vcl_fetch::r%h3j h4h7h9h`h;}r&(h?]h@]h>]h=]hA]uhCK’hDhh-]r'hXX In vcl_fetch:r(…r)}r*(h2X In vcl_fetch:h3j#ubaubj()r+}r,(h2X@if (beresp.http.Pragma ~ "nocache") { return(hit_for_pass); }h3j h4h7h9j+h;}r-(j-j.h=]h>]h?]h@]hA]uhCK”hDhh-]r.hXX@if (beresp.http.Pragma ~ "nocache") { return(hit_for_pass); }r/…r0}r1(h2Uh3j+ubaubeubhE)r2}r3(h2Uh3hFh4h7h9hJh;}r4(h?]h@]h>]h=]r5h'ahA]r6hauhCK™hDhh-]r7(hQ)r8}r9(h2X Authorizationr:h3j2h4h7h9hUh;}r;(h?]h@]h>]h=]hA]uhCK™hDhh-]r<hXX Authorizationr=…r>}r?(h2j:h3j8ubaubh\)r@}rA(h2XxIf Varnish sees an Authorization header it will pass the request. If this is not what you want you can unset the header.rBh3j2h4h7h9h`h;}rC(h?]h@]h>]h=]hA]uhCK›hDhh-]rDhXXxIf Varnish sees an Authorization header it will pass the request. If this is not what you want you can unset the header.rE…rF}rG(h2jBh3j@ubaubeubhE)rH}rI(h2Uh3hFh4h7h9hJh;}rJ(h?]h@]h>]h=]rKh ahA]rLhauhCKŸhDhh-]rM(hQ)rN}rO(h2X!Overriding the time-to-live (ttl)rPh3jHh4h7h9hUh;}rQ(h?]h@]h>]h=]hA]uhCKŸhDhh-]rRhXX!Overriding the time-to-live (ttl)rS…rT}rU(h2jPh3jNubaubh\)rV}rW(h2X Sometimes your backend will misbehave. It might, depending on your setup, be easier to override the ttl in Varnish than to fix your somewhat cumbersome backend.rXh3jHh4h7h9h`h;}rY(h?]h@]h>]h=]hA]uhCK¡hDhh-]rZhXX Sometimes your backend will misbehave. It might, depending on your setup, be easier to override the ttl in Varnish than to fix your somewhat cumbersome backend.r[…r\}r](h2jXh3jVubaubh\)r^}r_(h2XdYou need VCL to identify the objects you want and then you set the beresp.ttl to whatever you want::h3jHh4h7h9h`h;}r`(h?]h@]h>]h=]hA]uhCK¥hDhh-]rahXXcYou need VCL to identify the objects you want and then you set the beresp.ttl to whatever you want:rb…rc}rd(h2XcYou need VCL to identify the objects you want and then you set the beresp.ttl to whatever you want:h3j^ubaubj()re}rf(h2X`sub vcl_fetch { if (req.url ~ "^/legacy_broken_cms/") { set beresp.ttl = 5d; } }h3jHh4h7h9j+h;}rg(j-j.h=]h>]h?]h@]hA]uhCK¨hDhh-]rhhXX`sub vcl_fetch { if (req.url ~ "^/legacy_broken_cms/") { set beresp.ttl = 5d; } }ri…rj}rk(h2Uh3jeubaubh\)rl}rm(h2XMThe example will set the TTL to 5 days for the old legacy stuff on your site.rnh3jHh4h7h9h`h;}ro(h?]h@]h>]h=]hA]uhCK®hDhh-]rphXXMThe example will set the TTL to 5 days for the old legacy stuff on your site.rq…rr}rs(h2jnh3jlubaubeubhE)rt}ru(h2Uh3hFh4h7h9hJh;}rv(h?]h@]h>]h=]rwhahA]rxhauhCK²hDhh-]ry(hQ)rz}r{(h2X:Forcing caching for certain requests and certain responsesr|h3jth4h7h9hUh;}r}(h?]h@]h>]h=]hA]uhCK²hDhh-]r~hXX:Forcing caching for certain requests and certain responsesr…r€}r(h2j|h3jzubaubh\)r‚}rƒ(h2X8Since you still 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.r„h3jth4h7h9h`h;}r…(h?]h@]h>]h=]hA]uhCK´hDhh-]r†hXX8Since you still 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.r‡…rˆ}r‰(h2j„h3j‚ubaubeubhE)rŠ}r‹(h2Uh3hFh4h7h9hJh;}rŒ(h?]h@]h>]h=]rh%ahA]rŽh auhCK¼hDhh-]r(hQ)r}r‘(h2XNormalizing your namespacer’h3jŠh4h7h9hUh;}r“(h?]h@]h>]h=]hA]uhCK¼hDhh-]r”hXXNormalizing your namespacer•…r–}r—(h2j’h3jubaubh\)r˜}r™(h2XSome 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 different, 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::h3jŠh4h7h9h`h;}rš(h?]h@]h>]h=]hA]uhCK¾hDhh-]r›(hXX/Some sites are accessed via lots of hostnames. rœ…r}rž(h2X/Some sites are accessed via lots of hostnames. h3j˜ubj)rŸ}r (h2X http://www.varnish-software.com/r¡h;}r¢(Urefurij¡h=]h>]h?]h@]hA]uh3j˜h-]r£hXX http://www.varnish-software.com/r¤…r¥}r¦(h2Uh3jŸubah9j ubhXX, r§…r¨}r©(h2X, h3j˜ubj)rª}r«(h2Xhttp://varnish-software.com/r¬h;}r­(Urefurij¬h=]h>]h?]h@]hA]uh3j˜h-]r®hXXhttp://varnish-software.com/r¯…r°}r±(h2Uh3jªubah9j ubhXX and r²…r³}r´(h2X and h3j˜ubj)rµ}r¶(h2Xhttp://varnishsoftware.com/r·h;}r¸(Urefurij·h=]h>]h?]h@]hA]uh3j˜h-]r¹hXXhttp://varnishsoftware.com/rº…r»}r¼(h2Uh3jµubah9j ubhXX all point at the same site. Since Varnish doesn't know they are different, 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:r½…r¾}r¿(h2X all point at the same site. Since Varnish doesn't know they are different, 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:h3j˜ubeubj()rÀ}rÁ(h2Xjif (req.http.host ~ "(?i)^(www.)?varnish-?software.com") { set req.http.host = "varnish-software.com"; }h3jŠh4h7h9j+h;}rÂ(j-j.h=]h>]h?]h@]hA]uhCKÆhDhh-]rÃhXXjif (req.http.host ~ "(?i)^(www.)?varnish-?software.com") { set req.http.host = "varnish-software.com"; }rÄ…rÅ}rÆ(h2Uh3jÀubaubeubhE)rÇ}rÈ(h2Uh3hFh4h7h9hJh;}rÉ(h?]h@]h>]h=]rÊh"ahA]rËh auhCKÌhDhh-]rÌ(hQ)rÍ}rÎ(h2X)Ways of increasing your hitrate even morerÏh3jÇh4h7h9hUh;}rÐ(h?]h@]h>]h=]hA]uhCKÌhDhh-]rÑhXX)Ways of increasing your hitrate even morerÒ…rÓ}rÔ(h2jÏh3jÍubaubh\)rÕ}rÖ(h2XsThe following chapters should give your ways of further increasing your hitrate, especially the chapter on Cookies.r×h3jÇh4h7h9h`h;}rØ(h?]h@]h>]h=]hA]uhCKÎhDhh-]rÙhXXsThe following chapters should give your ways of further increasing your hitrate, especially the chapter on Cookies.rÚ…rÛ}rÜ(h2j×h3jÕubaubcdocutils.nodes block_quote rÝ)rÞ}rß(h2Uh3jÇh4Nh9U block_quoteràh;}rá(h?]h@]h>]h=]hA]uhCNhDhh-]râcdocutils.nodes bullet_list rã)rä}rå(h2Uh;}ræ(UbulletrçX*h=]h>]h?]h@]hA]uh3jÞh-]rè(cdocutils.nodes list_item ré)rê}rë(h2X:ref:`tutorial-cookies`rìh;}rí(h?]h@]h>]h=]hA]uh3jäh-]rîh\)rï}rð(h2jìh3jêh4h7h9h`h;}rñ(h?]h@]h>]h=]hA]uhCKÑh-]ròh—)ró}rô(h2jìh3jïh4h7h9h›h;}rõ(UreftypeXrefhˆhžXtutorial-cookiesU refdomainXstdröh=]h>]U refexplicit‰h?]h@]hA]h h¡uhCKÑh-]r÷h£)rø}rù(h2jìh;}rú(h?]h@]rû(h¨jöXstd-refrüeh>]h=]hA]uh3jóh-]rýhXXtutorial-cookiesrþ…rÿ}r(h2Uh3jøubah9h®ubaubaubah9U list_itemrubjé)r}r(h2X:ref:`tutorial-vary`rh;}r(h?]h@]h>]h=]hA]uh3jäh-]rh\)r}r(h2jh3jh4h7h9h`h;}r (h?]h@]h>]h=]hA]uhCKÒh-]r h—)r }r (h2jh3jh4h7h9h›h;}r (UreftypeXrefhˆhžX tutorial-varyU refdomainXstdrh=]h>]U refexplicit‰h?]h@]hA]h h¡uhCKÒh-]rh£)r}r(h2jh;}r(h?]h@]r(h¨jXstd-refreh>]h=]hA]uh3j h-]rhXX tutorial-varyr…r}r(h2Uh3jubah9h®ubaubaubah9jubjé)r}r(h2X:ref:`tutorial-purging`rh;}r(h?]h@]h>]h=]hA]uh3jäh-]rh\)r}r(h2jh3jh4h7h9h`h;}r (h?]h@]h>]h=]hA]uhCKÓh-]r!h—)r"}r#(h2jh3jh4h7h9h›h;}r$(UreftypeXrefhˆhžXtutorial-purgingU refdomainXstdr%h=]h>]U refexplicit‰h?]h@]hA]h h¡uhCKÓh-]r&h£)r'}r((h2jh;}r)(h?]h@]r*(h¨j%Xstd-refr+eh>]h=]hA]uh3j"h-]r,hXXtutorial-purgingr-…r.}r/(h2Uh3j'ubah9h®ubaubaubah9jubjé)r0}r1(h2X:ref:`tutorial-esi` h;}r2(h?]h@]h>]h=]hA]uh3jäh-]r3h\)r4}r5(h2X:ref:`tutorial-esi`r6h3j0h4h7h9h`h;}r7(h?]h@]h>]h=]hA]uhCKÔh-]r8h—)r9}r:(h2j6h3j4h4h7h9h›h;}r;(UreftypeXrefhˆhžX tutorial-esiU refdomainXstdr<h=]h>]U refexplicit‰h?]h@]hA]h h¡uhCKÔh-]r=h£)r>}r?(h2j6h;}r@(h?]h@]rA(h¨j<Xstd-refrBeh>]h=]hA]uh3j9h-]rChXX tutorial-esirD…rE}rF(h2Uh3j>ubah9h®ubaubaubah9jubeh9U bullet_listrGubaubeubeubeh2UU transformerrHNU footnote_refsrI}rJUrefnamesrK}rLUsymbol_footnotesrM]rNUautofootnote_refsrO]rPUsymbol_footnote_refsrQ]rRU citationsrS]rThDhU current_linerUNUtransform_messagesrV]rWcdocutils.nodes system_message rX)rY}rZ(h2Uh;}r[(h?]UlevelKh=]h>]Usourceh7h@]hA]UlineKUtypeUINFOr\uh-]r]h\)r^}r_(h2Uh;}r`(h?]h@]h>]h=]hA]uh3jYh-]rahXXFHyperlink target "tutorial-increasing-your-hitrate" is not referenced.rb…rc}rd(h2Uh3j^ubah9h`ubah9Usystem_messagereubaUreporterrfNUid_startrgKU autofootnotesrh]riU citation_refsrj}rkUindirect_targetsrl]rmUsettingsrn(cdocutils.frontend Values roorp}rq(Ufootnote_backlinksrrKUrecord_dependenciesrsNU rfc_base_urlrtUhttp://tools.ietf.org/html/ruU tracebackrvˆUpep_referencesrwNUstrip_commentsrxNU toc_backlinksryUentryrzU language_coder{Uenr|U datestampr}NU report_levelr~KU _destinationrNU halt_levelr€KU strip_classesrNhUNUerror_encoding_error_handlerr‚UbackslashreplacerƒUdebugr„NUembed_stylesheetr…‰Uoutput_encoding_error_handlerr†Ustrictr‡U sectnum_xformrˆKUdump_transformsr‰NU docinfo_xformrŠKUwarning_streamr‹NUpep_file_url_templaterŒUpep-%04drUexit_status_levelrŽKUconfigrNUstrict_visitorrNUcloak_email_addressesr‘ˆUtrim_footnote_reference_spacer’‰Uenvr“NUdump_pseudo_xmlr”NUexpose_internalsr•NUsectsubtitle_xformr–‰U source_linkr—NUrfc_referencesr˜NUoutput_encodingr™Uutf-8ršU source_urlr›NUinput_encodingrœU utf-8-sigrU_disable_configržNU id_prefixrŸUU tab_widthr KUerror_encodingr¡UUTF-8r¢U_sourcer£UD/home/tfheen/varnish/doc/sphinx/tutorial/increasing_your_hitrate.rstr¤Ugettext_compactr¥ˆU generatorr¦NUdump_internalsr§NU smart_quotesr¨‰U pep_base_urlr©Uhttp://www.python.org/dev/peps/rªUsyntax_highlightr«Ulongr¬Uinput_encoding_error_handlerr­j‡Uauto_id_prefixr®Uidr¯Udoctitle_xformr°‰Ustrip_elements_with_classesr±NU _config_filesr²]r³Ufile_insertion_enabledr´KU raw_enabledrµKU dump_settingsr¶NubUsymbol_footnote_startr·KUidsr¸}r¹(h,hFh&j|hjth#hvh(h±h+jñhhFh"jÇh%jŠh!j h)j h$j¼h*jRh jHh'j2uUsubstitution_namesrº}r»h9hDh;}r¼(h?]h=]h>]Usourceh7h@]hA]uU footnotesr½]r¾Urefidsr¿}rÀh]rÁh0asub.varnish-3.0.5/doc/sphinx/=build/doctrees/tutorial/cookies.doctree0000644000175000017500000003043212247037213022045 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(Xcookies from the clientqNXcookies coming from the backendqNXcookiesqNXtutorial-cookiesq ˆuUsubstitution_defsq }q Uparse_messagesq ]q Ucurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hUcookies-from-the-clientqhUcookies-coming-from-the-backendqhUcookiesqh Ututorial-cookiesquUchildrenq]q(cdocutils.nodes target q)q}q(U rawsourceqX.. _tutorial-cookies:UparentqhUsourceqcdocutils.nodes reprunicode qX4/home/tfheen/varnish/doc/sphinx/tutorial/cookies.rstq …q!}q"bUtagnameq#Utargetq$U attributesq%}q&(Uidsq']Ubackrefsq(]Udupnamesq)]Uclassesq*]Unamesq+]Urefidq,huUlineq-KUdocumentq.hh]ubcdocutils.nodes section q/)q0}q1(hUhhhh!Uexpect_referenced_by_nameq2}q3h hsh#Usectionq4h%}q5(h)]h*]h(]h']q6(hheh+]q7(hh euh-Kh.hUexpect_referenced_by_idq8}q9hhsh]q:(cdocutils.nodes title q;)q<}q=(hXCookiesq>hh0hh!h#Utitleq?h%}q@(h)]h*]h(]h']h+]uh-Kh.hh]qAcdocutils.nodes Text qBXCookiesqC…qD}qE(hh>hhUUTF-8r?U_sourcer@U4/home/tfheen/varnish/doc/sphinx/tutorial/cookies.rstrAUgettext_compactrBˆU generatorrCNUdump_internalsrDNU smart_quotesrE‰U pep_base_urlrFUhttp://www.python.org/dev/peps/rGUsyntax_highlightrHUlongrIUinput_encoding_error_handlerrJj$Uauto_id_prefixrKUidrLUdoctitle_xformrM‰Ustrip_elements_with_classesrNNU _config_filesrO]rPUfile_insertion_enabledrQKU raw_enabledrRKU dump_settingsrSNubUsymbol_footnote_startrTKUidsrU}rV(hh0hhXhh0hh·uUsubstitution_namesrW}rXh#h.h%}rY(h)]h']h(]Usourceh!h*]h+]uU footnotesrZ]r[Urefidsr\}r]h]r^hasub.varnish-3.0.5/doc/sphinx/=build/doctrees/installation/0000755000175000017500000000000012247037213017756 500000000000000varnish-3.0.5/doc/sphinx/=build/doctrees/installation/index.doctree0000644000175000017500000000777012247037213022367 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(Xvarnish installationqNX install-indexqˆuUsubstitution_defsq}q Uparse_messagesq ]q Ucurrent_sourceq NU decorationq NUautofootnote_startqKUnameidsq}q(hUvarnish-installationqhU install-indexquUchildrenq]q(cdocutils.nodes target q)q}q(U rawsourceqX.. _install-index:UparentqhUsourceqcdocutils.nodes reprunicode qX6/home/tfheen/varnish/doc/sphinx/installation/index.rstq…q}qbUtagnameqUtargetq U attributesq!}q"(Uidsq#]Ubackrefsq$]Udupnamesq%]Uclassesq&]Unamesq']Urefidq(huUlineq)KUdocumentq*hh]ubcdocutils.nodes section q+)q,}q-(hUhhhhUexpect_referenced_by_nameq.}q/hhshUsectionq0h!}q1(h%]h&]h$]h#]q2(hheh']q3(hheuh)Kh*hUexpect_referenced_by_idq4}q5hhsh]q6(cdocutils.nodes title q7)q8}q9(hXVarnish Installationq:hh,hhhUtitleq;h!}q<(h%]h&]h$]h#]h']uh)Kh*hh]q=cdocutils.nodes Text q>XVarnish Installationq?…q@}qA(hh:hh8ubaubcdocutils.nodes paragraph qB)qC}qD(hXÒThis document explains how to get Varnish onto your system, where to get help, how report bugs etc. In other words, it is a manual about pretty much everything else than actually using Varnish to move traffic.qEhh,hhhU paragraphqFh!}qG(h%]h&]h$]h#]h']uh)Kh*hh]qHh>XÒThis document explains how to get Varnish onto your system, where to get help, how report bugs etc. In other words, it is a manual about pretty much everything else than actually using Varnish to move traffic.qI…qJ}qK(hhEhhCubaubcdocutils.nodes compound qL)qM}qN(hUhh,hhhUcompoundqOh!}qP(h%]h&]qQUtoctree-wrapperqRah$]h#]h']uh)Kh*hh]qScsphinx.addnodes toctree qT)qU}qV(hUhhMhhhUtoctreeqWh!}qX(UnumberedqYKhUinstallation/indexqZU titlesonlyq[‰Uglobq\‰h#]h$]h%]h&]h']Uentriesq]]q^(NXinstallation/prerequisitesq_†q`NXinstallation/installqa†qbNXinstallation/helpqc†qdNXinstallation/bugsqe†qfNXinstallation/upgradeqg†qheUhiddenqi‰U includefilesqj]qk(h_hahchehgeUmaxdepthqlJÿÿÿÿuh)K h]ubaubeubehUU transformerqmNU footnote_refsqn}qoUrefnamesqp}qqUsymbol_footnotesqr]qsUautofootnote_refsqt]quUsymbol_footnote_refsqv]qwU citationsqx]qyh*hU current_lineqzNUtransform_messagesq{]q|cdocutils.nodes system_message q})q~}q(hUh!}q€(h%]UlevelKh#]h$]Usourcehh&]h']UlineKUtypeUINFOquh]q‚hB)qƒ}q„(hUh!}q…(h%]h&]h$]h#]h']uhh~h]q†h>X3Hyperlink target "install-index" is not referenced.q‡…qˆ}q‰(hUhhƒubahhFubahUsystem_messageqŠubaUreporterq‹NUid_startqŒKU autofootnotesq]qŽU citation_refsq}qUindirect_targetsq‘]q’Usettingsq“(cdocutils.frontend Values q”oq•}q–(Ufootnote_backlinksq—KUrecord_dependenciesq˜NU rfc_base_urlq™Uhttp://tools.ietf.org/html/qšU tracebackq›ˆUpep_referencesqœNUstrip_commentsqNU toc_backlinksqžUentryqŸU language_codeq Uenq¡U datestampq¢NU report_levelq£KU _destinationq¤NU halt_levelq¥KU strip_classesq¦Nh;NUerror_encoding_error_handlerq§Ubackslashreplaceq¨Udebugq©NUembed_stylesheetqª‰Uoutput_encoding_error_handlerq«Ustrictq¬U sectnum_xformq­KUdump_transformsq®NU docinfo_xformq¯KUwarning_streamq°NUpep_file_url_templateq±Upep-%04dq²Uexit_status_levelq³KUconfigq´NUstrict_visitorqµNUcloak_email_addressesq¶ˆUtrim_footnote_reference_spaceq·‰Uenvq¸NUdump_pseudo_xmlq¹NUexpose_internalsqºNUsectsubtitle_xformq»‰U source_linkq¼NUrfc_referencesq½NUoutput_encodingq¾Uutf-8q¿U source_urlqÀNUinput_encodingqÁU utf-8-sigqÂU_disable_configqÃNU id_prefixqÄUU tab_widthqÅKUerror_encodingqÆUUTF-8qÇU_sourceqÈU6/home/tfheen/varnish/doc/sphinx/installation/index.rstqÉUgettext_compactqʈU generatorqËNUdump_internalsqÌNU smart_quotesq͉U pep_base_urlqÎUhttp://www.python.org/dev/peps/qÏUsyntax_highlightqÐUlongqÑUinput_encoding_error_handlerqÒh¬Uauto_id_prefixqÓUidqÔUdoctitle_xformqÕ‰Ustrip_elements_with_classesqÖNU _config_filesq×]Ufile_insertion_enabledqØKU raw_enabledqÙKU dump_settingsqÚNubUsymbol_footnote_startqÛKUidsqÜ}qÝ(hh,hh,uUsubstitution_namesqÞ}qßhh*h!}qà(h%]h#]h$]Usourcehh&]h']uU footnotesqá]qâUrefidsqã}qäh]qåhasub.varnish-3.0.5/doc/sphinx/=build/doctrees/installation/bugs.doctree0000644000175000017500000005755212247037213022223 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(Xvarnish goes on vacationqNXvarnish crashesqNXreporting bugsqNXvarnish does something wrongq NuUsubstitution_defsq }q Uparse_messagesq ]q Ucurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hUvarnish-goes-on-vacationqhUvarnish-crashesqhUreporting-bugsqh Uvarnish-does-something-wrongquUchildrenq]qcdocutils.nodes section q)q}q(U rawsourceqUUparentqhUsourceqcdocutils.nodes reprunicode qX5/home/tfheen/varnish/doc/sphinx/installation/bugs.rstq …q!}q"bUtagnameq#Usectionq$U attributesq%}q&(Udupnamesq']Uclassesq(]Ubackrefsq)]Uidsq*]q+haUnamesq,]q-hauUlineq.KUdocumentq/hh]q0(cdocutils.nodes title q1)q2}q3(hXReporting bugsq4hhhh!h#Utitleq5h%}q6(h']h(]h)]h*]h,]uh.Kh/hh]q7cdocutils.nodes Text q8XReporting bugsq9…q:}q;(hh4hh2ubaubcdocutils.nodes paragraph q<)q=}q>(hX—Varnish can be a tricky beast to debug, having potentially thousands of threads crowding into a few data structures makes for *interesting* core dumps.hhhh!h#U paragraphq?h%}q@(h']h(]h)]h*]h,]uh.Kh/hh]qA(h8X~Varnish can be a tricky beast to debug, having potentially thousands of threads crowding into a few data structures makes for qB…qC}qD(hX~Varnish can be a tricky beast to debug, having potentially thousands of threads crowding into a few data structures makes for hh=ubcdocutils.nodes emphasis qE)qF}qG(hX *interesting*h%}qH(h']h(]h)]h*]h,]uhh=h]qIh8X interestingqJ…qK}qL(hUhhFubah#UemphasisqMubh8X core dumps.qN…qO}qP(hX core dumps.hh=ubeubh<)qQ}qR(hX‰Actually, let me rephrase that without irony: You tire of the "no, not thread 438 either, lets look at 439 then..." routine really fast.qShhhh!h#h?h%}qT(h']h(]h)]h*]h,]uh.K h/hh]qUh8X‰Actually, let me rephrase that without irony: You tire of the "no, not thread 438 either, lets look at 439 then..." routine really fast.qV…qW}qX(hhShhQubaubh<)qY}qZ(hX‡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.q[hhhh!h#h?h%}q\(h']h(]h)]h*]h,]uh.K h/hh]q]h8X‡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.q^…q_}q`(hh[hhYubaubh<)qa}qb(hXcThe 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.hhhh!h#h?h%}qc(h']h(]h)]h*]h,]uh.Kh/hh]qd(h8X2The most valuable information you can give us, is qe…qf}qg(hX2The most valuable information you can give us, is hhaubcdocutils.nodes strong qh)qi}qj(hX **always**h%}qk(h']h(]h)]h*]h,]uhhah]qlh8Xalwaysqm…qn}qo(hUhhiubah#Ustrongqpubh8X' 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.qq…qr}qs(hX' 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.hhaubeubh<)qt}qu(hXxRoughly we have three clases of bugs with Varnish, and the information we need to debug them depends on the kind of bug.qvhhhh!h#h?h%}qw(h']h(]h)]h*]h,]uh.Kh/hh]qxh8XxRoughly we have three clases of bugs with Varnish, and the information we need to debug them depends on the kind of bug.qy…qz}q{(hhvhhtubaubh)q|}q}(hUhhhh!h#h$h%}q~(h']h(]h)]h*]qhah,]q€hauh.Kh/hh]q(h1)q‚}qƒ(hXVarnish crashesq„hh|hh!h#h5h%}q…(h']h(]h)]h*]h,]uh.Kh/hh]q†h8XVarnish crashesq‡…qˆ}q‰(hh„hh‚ubaubh<)qŠ}q‹(hXPlain and simple: **boom**qŒhh|hh!h#h?h%}q(h']h(]h)]h*]h,]uh.Kh/hh]qŽ(h8XPlain and simple: q…q}q‘(hXPlain and simple: hhŠubhh)q’}q“(hX**boom**h%}q”(h']h(]h)]h*]h,]uhhŠh]q•h8Xboomq–…q—}q˜(hUhh’ubah#hpubeubh<)q™}qš(hX™Varnish is split over two processes, the manager and the child. The child does all the work, and the manager hangs around to resurect it, if it crashes.q›hh|hh!h#h?h%}qœ(h']h(]h)]h*]h,]uh.Kh/hh]qh8X™Varnish is split over two processes, the manager and the child. The child does all the work, and the manager hangs around to resurect it, if it crashes.qž…qŸ}q (hh›hh™ubaubh<)q¡}q¢(hXü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.)hh|hh!h#h?h%}q£(h']h(]h)]h*]h,]uh.K"h/hh]q¤(h8XÆ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 q¥…q¦}q§(hXÆ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 hh¡ubhE)q¨}q©(hX*still*h%}qª(h']h(]h)]h*]h,]uhh¡h]q«h8Xstillq¬…q­}q®(hUhh¨ubah#hMubh8X/ provide better service than their CMS system.)q¯…q°}q±(hX/ provide better service than their CMS system.)hh¡ubeubh<)q²}q³(hXcWhen it crashes, if at all possible, Varnish will spew out a crash dump that looks something like::hh|hh!h#h?h%}q´(h']h(]h)]h*]h,]uh.K'h/hh]qµh8XbWhen it crashes, if at all possible, Varnish will spew out a crash dump that looks something like:q¶…q·}q¸(hXbWhen it crashes, if at all possible, Varnish will spew out a crash dump that looks something like:hh²ubaubcdocutils.nodes literal_block q¹)qº}q»(hXEChild (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 [...]hh|hh!h#U literal_blockq¼h%}q½(U xml:spaceq¾Upreserveq¿h*]h)]h']h(]h,]uh.K*h/hh]qÀh8XEChild (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 [...]qÁ…qÂ}qÃ(hUhhºubaubh<)qÄ}qÅ(hXˆ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.qÆhh|hh!h#h?h%}qÇ(h']h(]h)]h*]h,]uh.K=h/hh]qÈh8Xˆ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.qÉ…qÊ}qË(hhÆhhÄubaubh<)qÌ}qÍ(hXZThere will be a lot more information than this, and before sending it all to us, you should obscure any sensitive/secret data/cookies/passwords/ip# etc. Please make sure to keep context when you do so, ie: do not change all the IP# to "X.X.X.X", but change each IP# to something unique, otherwise we are likely to be more confused than informed.qÎhh|hh!h#h?h%}qÏ(h']h(]h)]h*]h,]uh.KAh/hh]qÐh8XZThere will be a lot more information than this, and before sending it all to us, you should obscure any sensitive/secret data/cookies/passwords/ip# etc. Please make sure to keep context when you do so, ie: do not change all the IP# to "X.X.X.X", but change each IP# to something unique, otherwise we are likely to be more confused than informed.qÑ…qÒ}qÓ(hhÎhhÌubaubh<)qÔ}qÕ(hXQThe most important line is the "Panic Message", which comes in two general forms:qÖhh|hh!h#h?h%}q×(h']h(]h)]h*]h,]uh.KHh/hh]qØh8XQThe most important line is the "Panic Message", which comes in two general forms:qÙ…qÚ}qÛ(hhÖhhÔubaubcdocutils.nodes definition_list qÜ)qÝ}qÞ(hUhh|hh!h#Udefinition_listqßh%}qà(h']h(]h)]h*]h,]uh.Nh/hh]qá(cdocutils.nodes definition_list_item qâ)qã}qä(hX="Missing errorhandling code in ..." This is a place where we can conceive ending up, and have not (yet) written the padded-box error handling code for. The most likely cause here, is that you need a larger workspace for HTTP headers and Cookies. (XXX: which params to tweak) Please try that before reporting a bug. hhÝhh!h#Udefinition_list_itemqåh%}qæ(h']h(]h)]h*]h,]uh.KRh]qç(cdocutils.nodes term qè)qé}qê(hX#"Missing errorhandling code in ..."qëhhãhh!h#Utermqìh%}qí(h']h(]h)]h*]h,]uh.KRh]qîh8X#"Missing errorhandling code in ..."qï…qð}qñ(hhëhhéubaubcdocutils.nodes definition qò)qó}qô(hUh%}qõ(h']h(]h)]h*]h,]uhhãh]qö(h<)q÷}qø(hXsThis is a place where we can conceive ending up, and have not (yet) written the padded-box error handling code for.qùhhóhh!h#h?h%}qú(h']h(]h)]h*]h,]uh.KLh]qûh8XsThis is a place where we can conceive ending up, and have not (yet) written the padded-box error handling code for.qü…qý}qþ(hhùhh÷ubaubh<)qÿ}r(hXzThe most likely cause here, is that you need a larger workspace for HTTP headers and Cookies. (XXX: which params to tweak)rhhóhh!h#h?h%}r(h']h(]h)]h*]h,]uh.KOh]rh8XzThe most likely cause here, is that you need a larger workspace for HTTP headers and Cookies. (XXX: which params to tweak)r…r}r(hjhhÿubaubh<)r}r(hX'Please try that before reporting a bug.r hhóhh!h#h?h%}r (h']h(]h)]h*]h,]uh.KRh]r h8X'Please try that before reporting a bug.r …r }r(hj hjubaubeh#U definitionrubeubhâ)r}r(hX¶"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. hhÝhh!h#håh%}r(h']h(]h)]h*]h,]uh.KWh/hh]r(hè)r}r(hX"Assert error in ..."rhjhh!h#hìh%}r(h']h(]h)]h*]h,]uh.KWh]rh8X"Assert error in ..."r…r}r(hjhjubaubhò)r}r(hUh%}r(h']h(]h)]h*]h,]uhjh]rh<)r }r!(hXŸ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.r"hjhh!h#h?h%}r#(h']h(]h)]h*]h,]uh.KUh]r$h8XŸ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.r%…r&}r'(hj"hj ubaubah#jubeubeubh<)r(}r)(hX„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:r*hh|hh!h#h?h%}r+(h']h(]h)]h*]h,]uh.KYh/hh]r,h8X„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:r-…r.}r/(hj*hj(ubaubcdocutils.nodes block_quote r0)r1}r2(hUhh|hh!h#U block_quoter3h%}r4(h']h(]h)]h*]h,]uh.Nh/hh]r5h<)r6}r7(hX=``varnishd -d |& tee /tmp/_catch_bug``r8hj1hh!h#h?h%}r9(h']h(]h)]h*]h,]uh.K\h]r:cdocutils.nodes literal r;)r<}r=(hj8h%}r>(h']h(]h)]h*]h,]uhj6h]r?h8X9varnishd -d |& tee /tmp/_catch_bugr@…rA}rB(hUhj<ubah#UliteralrCubaubaubh<)rD}rE(hX7That will get you the entire panic message into a file.rFhh|hh!h#h?h%}rG(h']h(]h)]h*]h,]uh.K^h/hh]rHh8X7That will get you the entire panic message into a file.rI…rJ}rK(hjFhjDubaubh<)rL}rM(hXe(Remember to type ``start`` to launch the worker process, that is not automatic when ``-d`` is used.)hh|hh!h#h?h%}rN(h']h(]h)]h*]h,]uh.K`h/hh]rO(h8X(Remember to type rP…rQ}rR(hX(Remember to type hjLubj;)rS}rT(hX ``start``h%}rU(h']h(]h)]h*]h,]uhjLh]rVh8XstartrW…rX}rY(hUhjSubah#jCubh8X: to launch the worker process, that is not automatic when rZ…r[}r\(hX: to launch the worker process, that is not automatic when hjLubj;)r]}r^(hX``-d``h%}r_(h']h(]h)]h*]h,]uhjLh]r`h8X-dra…rb}rc(hUhj]ubah#jCubh8X is used.)rd…re}rf(hX is used.)hjLubeubeubh)rg}rh(hUhhhh!h#h$h%}ri(h']h(]h)]h*]rjhah,]rkhauh.Kdh/hh]rl(h1)rm}rn(hXVarnish goes on vacationrohjghh!h#h5h%}rp(h']h(]h)]h*]h,]uh.Kdh/hh]rqh8XVarnish goes on vacationrr…rs}rt(hjohjmubaubh<)ru}rv(hXÛ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.rwhjghh!h#h?h%}rx(h']h(]h)]h*]h,]uh.Kfh/hh]ryh8XÛ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.rz…r{}r|(hjwhjuubaubh<)r}}r~(hX~What we need here is all the information can you squeeze out of your operating system **before** you kill the Varnish process.hjghh!h#h?h%}r(h']h(]h)]h*]h,]uh.Kkh/hh]r€(h8XVWhat we need here is all the information can you squeeze out of your operating system r…r‚}rƒ(hXVWhat we need here is all the information can you squeeze out of your operating system hj}ubhh)r„}r…(hX **before**h%}r†(h']h(]h)]h*]h,]uhj}h]r‡h8Xbeforerˆ…r‰}rŠ(hUhj„ubah#hpubh8X you kill the Varnish process.r‹…rŒ}r(hX you kill the Varnish process.hj}ubeubh<)rŽ}r(hX¤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.rhjghh!h#h?h%}r‘(h']h(]h)]h*]h,]uh.Knh/hh]r’h8X¤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.r“…r”}r•(hjhjŽubaubh<)r–}r—(hX[Commands like ``top -H`` or ``ps -Haxlw`` or ``ps -efH`` should be able to figure that out.hjghh!h#h?h%}r˜(h']h(]h)]h*]h,]uh.Krh/hh]r™(h8XCommands like rš…r›}rœ(hXCommands like hj–ubj;)r}rž(hX ``top -H``h%}rŸ(h']h(]h)]h*]h,]uhj–h]r h8Xtop -Hr¡…r¢}r£(hUhjubah#jCubh8X or r¤…r¥}r¦(hX or hj–ubj;)r§}r¨(hX ``ps -Haxlw``h%}r©(h']h(]h)]h*]h,]uhj–h]rªh8X ps -Haxlwr«…r¬}r­(hUhj§ubah#jCubh8X or r®…r¯}r°(hX or hj–ubj;)r±}r²(hX ``ps -efH``h%}r³(h']h(]h)]h*]h,]uhj–h]r´h8Xps -efHrµ…r¶}r·(hUhj±ubah#jCubh8X# should be able to figure that out.r¸…r¹}rº(hX# should be able to figure that out.hj–ubeubh<)r»}r¼(hX!If one or more threads are spinning, use ``strace`` or ``ktrace`` or ``truss`` (or whatever else your OS provides) to get a trace of which system calls the varnish process issues. Be aware that this may generate a lot of very repetitive data, usually one second worth is more than enough.hjghh!h#h?h%}r½(h']h(]h)]h*]h,]uh.Kuh/hh]r¾(h8X)If one or more threads are spinning, use r¿…rÀ}rÁ(hX)If one or more threads are spinning, use hj»ubj;)rÂ}rÃ(hX ``strace``h%}rÄ(h']h(]h)]h*]h,]uhj»h]rÅh8XstracerÆ…rÇ}rÈ(hUhjÂubah#jCubh8X or rÉ…rÊ}rË(hX or hj»ubj;)rÌ}rÍ(hX ``ktrace``h%}rÎ(h']h(]h)]h*]h,]uhj»h]rÏh8XktracerÐ…rÑ}rÒ(hUhjÌubah#jCubh8X or rÓ…rÔ}rÕ(hX or hj»ubj;)rÖ}r×(hX ``truss``h%}rØ(h']h(]h)]h*]h,]uhj»h]rÙh8XtrussrÚ…rÛ}rÜ(hUhjÖubah#jCubh8XÓ (or whatever else your OS provides) to get a trace of which system calls the varnish process issues. Be aware that this may generate a lot of very repetitive data, usually one second worth is more than enough.rÝ…rÞ}rß(hXÓ (or whatever else your OS provides) to get a trace of which system calls the varnish process issues. Be aware that this may generate a lot of very repetitive data, usually one second worth is more than enough.hj»ubeubh<)rà}rá(hXƒAlso, run ``varnishlog`` for a second, and collect the output for us, and if ``varnishstat`` shows any activity, capture that also.hjghh!h#h?h%}râ(h']h(]h)]h*]h,]uh.Kzh/hh]rã(h8X Also, run rä…rå}ræ(hX Also, run hjàubj;)rç}rè(hX``varnishlog``h%}ré(h']h(]h)]h*]h,]uhjàh]rêh8X varnishlogrë…rì}rí(hUhjçubah#jCubh8X5 for a second, and collect the output for us, and if rî…rï}rð(hX5 for a second, and collect the output for us, and if hjàubj;)rñ}rò(hX``varnishstat``h%}ró(h']h(]h)]h*]h,]uhjàh]rôh8X varnishstatrõ…rö}r÷(hUhjñubah#jCubh8X' shows any activity, capture that also.rø…rù}rú(hX' shows any activity, capture that also.hjàubeubh<)rû}rü(hX0When 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.hjghh!h#h?h%}rý(h']h(]h)]h*]h,]uh.K}h/hh]rþ(h8X*When you have done this, kill the Varnish rÿ…r}r(hX*When you have done this, kill the Varnish hjûubhE)r}r(hX*child*h%}r(h']h(]h)]h*]h,]uhjûh]rh8Xchildr…r}r(hUhjubah#hMubh8X process, and let the r …r }r (hX process, and let the hjûubhE)r }r (hX*master*h%}r(h']h(]h)]h*]h,]uhjûh]rh8Xmasterr…r}r(hUhj ubah#hMubh8Xá 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.r…r}r(hXá 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.hjûubeubeubh)r}r(hUhhhh!h#h$h%}r(h']h(]h)]h*]rhah,]rh auh.K…h/hh]r(h1)r}r(hXVarnish does something wrongrhjhh!h#h5h%}r(h']h(]h)]h*]h,]uh.K…h/hh]r h8XVarnish does something wrongr!…r"}r#(hjhjubaubh<)r$}r%(hX®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.hjhh!h#h?h%}r&(h']h(]h)]h*]h,]uh.K‡h/hh]r'(h8XaThese are the easy bugs: usually all we need from you is the relevant transactions recorded with r(…r)}r*(hXaThese are the easy bugs: usually all we need from you is the relevant transactions recorded with hj$ubj;)r+}r,(hX``varnishlog``h%}r-(h']h(]h)]h*]h,]uhj$h]r.h8X varnishlogr/…r0}r1(hUhj+ubah#jCubh8X? and your explanation of what is wrong about what Varnish does.r2…r3}r4(hX? and your explanation of what is wrong about what Varnish does.hj$ubeubh<)r5}r6(hXúBe aware, that often Varnish does exactly what you asked it to, rather than what you intended it to do, so it sounds like a bug that would have tripped up everybody else, take a moment to read though your VCL and see if it really does what you think.r7hjhh!h#h?h%}r8(h']h(]h)]h*]h,]uh.K‹h/hh]r9h8XúBe aware, that often Varnish does exactly what you asked it to, rather than what you intended it to do, so it sounds like a bug that would have tripped up everybody else, take a moment to read though your VCL and see if it really does what you think.r:…r;}r<(hj7hj5ubaubh<)r=}r>(hXŸYou can also try setting the ``vcl_trace`` parameter, that will generate log records with like and char number for each statement executed in your VCL program.hjhh!h#h?h%}r?(h']h(]h)]h*]h,]uh.Kh/hh]r@(h8XYou can also try setting the rA…rB}rC(hXYou can also try setting the hj=ubj;)rD}rE(hX ``vcl_trace``h%}rF(h']h(]h)]h*]h,]uhj=h]rGh8X vcl_tracerH…rI}rJ(hUhjDubah#jCubh8Xu parameter, that will generate log records with like and char number for each statement executed in your VCL program.rK…rL}rM(hXu parameter, that will generate log records with like and char number for each statement executed in your VCL program.hj=ubeubeubeubahUU transformerrNNU footnote_refsrO}rPUrefnamesrQ}rRUsymbol_footnotesrS]rTUautofootnote_refsrU]rVUsymbol_footnote_refsrW]rXU citationsrY]rZh/hU current_liner[NUtransform_messagesr\]r]Ureporterr^NUid_startr_KU autofootnotesr`]raU citation_refsrb}rcUindirect_targetsrd]reUsettingsrf(cdocutils.frontend Values rgorh}ri(Ufootnote_backlinksrjKUrecord_dependenciesrkNU rfc_base_urlrlUhttp://tools.ietf.org/html/rmU tracebackrnˆUpep_referencesroNUstrip_commentsrpNU toc_backlinksrqUentryrrU language_codersUenrtU datestampruNU report_levelrvKU _destinationrwNU halt_levelrxKU strip_classesryNh5NUerror_encoding_error_handlerrzUbackslashreplacer{Udebugr|NUembed_stylesheetr}‰Uoutput_encoding_error_handlerr~UstrictrU sectnum_xformr€KUdump_transformsrNU docinfo_xformr‚KUwarning_streamrƒNUpep_file_url_templater„Upep-%04dr…Uexit_status_levelr†KUconfigr‡NUstrict_visitorrˆNUcloak_email_addressesr‰ˆUtrim_footnote_reference_spacerЉUenvr‹NUdump_pseudo_xmlrŒNUexpose_internalsrNUsectsubtitle_xformrމU source_linkrNUrfc_referencesrNUoutput_encodingr‘Uutf-8r’U source_urlr“NUinput_encodingr”U utf-8-sigr•U_disable_configr–NU id_prefixr—UU tab_widthr˜KUerror_encodingr™UUTF-8ršU_sourcer›U5/home/tfheen/varnish/doc/sphinx/installation/bugs.rstrœUgettext_compactrˆU generatorržNUdump_internalsrŸNU smart_quotesr ‰U pep_base_urlr¡Uhttp://www.python.org/dev/peps/r¢Usyntax_highlightr£Ulongr¤Uinput_encoding_error_handlerr¥jUauto_id_prefixr¦Uidr§Udoctitle_xformr¨‰Ustrip_elements_with_classesr©NU _config_filesrª]r«Ufile_insertion_enabledr¬KU raw_enabledr­KU dump_settingsr®NubUsymbol_footnote_startr¯KUidsr°}r±(hh|hhhjhjguUsubstitution_namesr²}r³h#h/h%}r´(h']h*]h)]Usourceh!h(]h,]uU footnotesrµ]r¶Urefidsr·}r¸ub.varnish-3.0.5/doc/sphinx/=build/doctrees/installation/help.doctree0000644000175000017500000004011212247037213022173 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(Xgetting hold of usqNXmailmanqˆXcommercial supportqNXpastebinq ˆX"shopping-list" wiki pageq ˆX mailing listsq NXtrouble ticketsq NX irc channelq NuUsubstitution_defsq}qUparse_messagesq]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hUgetting-hold-of-usqhUmailmanqhUcommercial-supportqh Upastebinqh Ushopping-list-wiki-pageqh U mailing-listsqh Utrouble-ticketsqh U irc-channelquUchildrenq]q cdocutils.nodes section q!)q"}q#(U rawsourceq$UUparentq%hUsourceq&cdocutils.nodes reprunicode q'X5/home/tfheen/varnish/doc/sphinx/installation/help.rstq(…q)}q*bUtagnameq+Usectionq,U attributesq-}q.(Udupnamesq/]Uclassesq0]Ubackrefsq1]Uidsq2]q3haUnamesq4]q5hauUlineq6KUdocumentq7hh]q8(cdocutils.nodes title q9)q:}q;(h$XGetting hold of usq(h/]h0]h1]h2]h4]uh6Kh7hh]q?cdocutils.nodes Text q@XGetting hold of usqA…qB}qC(h$hh7hh]r(h@XThe r…r}r(h$XThe h%j ubh)r}r(h$X``varnish-dev``h-}r(h/]h0]h1]h2]h4]uh%j h]rh@X varnish-devr…r}r(h$Uh%jubah+h‡ubh@X¿ 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.r…r}r(h$X¿ 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.h%j ubeubeubh!)r}r(h$Uh%h"h&h)h+h,h-}r(h/]h0]h1]h2]rhah4]r h auh6KDh7hh]r!(h9)r"}r#(h$XTrouble Ticketsr$h%jh&h)h+h=h-}r%(h/]h0]h1]h2]h4]uh6KDh7hh]r&h@XTrouble Ticketsr'…r(}r)(h$j$h%j"ubaubhD)r*}r+(h$X}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.r,h%jh&h)h+hHh-}r-(h/]h0]h1]h2]h4]uh6KFh7hh]r.h@X}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.r/…r0}r1(h$j,h%j*ubaubhD)r2}r3(h$XÉThe reason for this policy, is to avoid the bugs being drowned in a pile of sensible suggestions for future enhancements and call for help from people who forget to check back if they get it and so on.r4h%jh&h)h+hHh-}r5(h/]h0]h1]h2]h4]uh6KIh7hh]r6h@XÉThe reason for this policy, is to avoid the bugs being drowned in a pile of sensible suggestions for future enhancements and call for help from people who forget to check back if they get it and so on.r7…r8}r9(h$j4h%j2ubaubhD)r:}r;(h$XgWe track suggestions and ideas in our `"Shopping-List" wiki page`_, and user support via email and IRC.h%jh&h)h+hHh-}r<(h/]h0]h1]h2]h4]uh6KMh7hh]r=(h@X&We track suggestions and ideas in our r>…r?}r@(h$X&We track suggestions and ideas in our h%j:ubh—)rA}rB(h$X`"Shopping-List" wiki page`_hšKh%j:h+h›h-}rC(UnameX"Shopping-List" wiki pagehžX1http://varnish-cache.org/wiki/PostTwoShoppingListrDh2]h1]h/]h0]h4]uh]rEh@X"Shopping-List" wiki pagerF…rG}rH(h$Uh%jAubaubh@X%, and user support via email and IRC.rI…rJ}rK(h$X%, and user support via email and IRC.h%j:ubeubeubh!)rL}rM(h$Uh%h"h&h)h+h,h-}rN(h/]h0]h1]h2]rOhah4]rPhauh6KQh7hh]rQ(h9)rR}rS(h$XCommercial SupportrTh%jLh&h)h+h=h-}rU(h/]h0]h1]h2]h4]uh6KQh7hh]rVh@XCommercial SupportrW…rX}rY(h$jTh%jRubaubhD)rZ}r[(h$X¬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.h%jLh&h)h+hHh-}r\(h/]h0]h1]h2]h4]uh6KSh7hh]r](h@Xœ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 r^…r_}r`(h$Xœ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 h%jZubh—)ra}rb(h$Xphk@FreeBSD.orgh-}rc(UrefuriXmailto:phk@FreeBSD.orgh2]h1]h/]h0]h4]uh%jZh]rdh@Xphk@FreeBSD.orgre…rf}rg(h$Uh%jaubah+h›ubh@X.…rh}ri(h$X.h%jZubeubht)rj}rk(h$Uh%jLh&h)h+hwh-}rl(h/]h0]h1]h2]h4]uh6Nh7hh]rmhD)rn}ro(h$X+Varnish Software sales@varnish-software.comh%jjh&h)h+hHh-}rp(h/]h0]h1]h2]h4]uh6KWh]rq(h@XVarnish Software rr…rs}rt(h$XVarnish Software h%jnubh—)ru}rv(h$Xsales@varnish-software.comh-}rw(UrefuriX!mailto:sales@varnish-software.comh2]h1]h/]h0]h4]uh%jnh]rxh@Xsales@varnish-software.comry…rz}r{(h$Uh%juubah+h›ubeubaubcdocutils.nodes target r|)r}}r~(h$X<.. _Mailman: http://lists.varnish-cache.org/mailman/listinfoU referencedrKh%jLh&h)h+Utargetr€h-}r(hžhÚh2]r‚hah1]h/]h0]h4]rƒhauh6K[h7hh]ubj|)r„}r…(h$X%.. _pastebin: http://gist.github.com/jKh%jLh&h)h+j€h-}r†(hžhŸh2]r‡hah1]h/]h0]h4]rˆh auh6K\h7hh]ubj|)r‰}rŠ(h$XP.. _"Shopping-List" wiki page: http://varnish-cache.org/wiki/PostTwoShoppingListjKh%jLh&h)h+j€h-}r‹(hžjDh2]rŒhah1]h/]h0]h4]rh auh6K]h7hh]ubeubeubah$UU transformerrŽNU footnote_refsr}rUrefnamesr‘}r’(h]r“h˜aX"shopping-list" wiki page]r”jAaXmailman]r•h×auUsymbol_footnotesr–]r—Uautofootnote_refsr˜]r™Usymbol_footnote_refsrš]r›U citationsrœ]rh7hU current_lineržNUtransform_messagesrŸ]r Ureporterr¡NUid_startr¢KU autofootnotesr£]r¤U citation_refsr¥}r¦Uindirect_targetsr§]r¨Usettingsr©(cdocutils.frontend Values rªor«}r¬(Ufootnote_backlinksr­KUrecord_dependenciesr®NU rfc_base_urlr¯Uhttp://tools.ietf.org/html/r°U tracebackr±ˆUpep_referencesr²NUstrip_commentsr³NU toc_backlinksr´UentryrµU language_coder¶Uenr·U datestampr¸NU report_levelr¹KU _destinationrºNU halt_levelr»KU strip_classesr¼Nh=NUerror_encoding_error_handlerr½Ubackslashreplacer¾Udebugr¿NUembed_stylesheetrÀ‰Uoutput_encoding_error_handlerrÁUstrictrÂU sectnum_xformrÃKUdump_transformsrÄNU docinfo_xformrÅKUwarning_streamrÆNUpep_file_url_templaterÇUpep-%04drÈUexit_status_levelrÉKUconfigrÊNUstrict_visitorrËNUcloak_email_addressesr̈Utrim_footnote_reference_spacer͉UenvrÎNUdump_pseudo_xmlrÏNUexpose_internalsrÐNUsectsubtitle_xformrщU source_linkrÒNUrfc_referencesrÓNUoutput_encodingrÔUutf-8rÕU source_urlrÖNUinput_encodingr×U utf-8-sigrØU_disable_configrÙNU id_prefixrÚUU tab_widthrÛKUerror_encodingrÜUUTF-8rÝU_sourcerÞU5/home/tfheen/varnish/doc/sphinx/installation/help.rstrßUgettext_compactràˆU generatorráNUdump_internalsrâNU smart_quotesrã‰U pep_base_urlräUhttp://www.python.org/dev/peps/råUsyntax_highlightræUlongrçUinput_encoding_error_handlerrèjÂUauto_id_prefixréUidrêUdoctitle_xformrë‰Ustrip_elements_with_classesrìNU _config_filesrí]Ufile_insertion_enabledrîKU raw_enabledrïKU dump_settingsrðNubUsymbol_footnote_startrñKUidsrò}ró(hh^hjLhj}hj‰hj„hhÁhh"hjuUsubstitution_namesrô}rõh+h7h-}rö(h/]h2]h1]Usourceh)h0]h4]uU footnotesr÷]røUrefidsrù}rúub.varnish-3.0.5/doc/sphinx/=build/doctrees/installation/upgrade.doctree0000644000175000017500000010544012247037213022700 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(Xchanged parameter namesqNXchanges to vclqNX/returns are now done with the return() functionqNX)pass in vcl_fetch renamed to hit_for_passq NXdeleted parametersq NXstring concatenation operatorq NXno more %-escapes in stringsq NX!upgrading from varnish 2.1 to 3.0q NX+beresp.cacheable and obj.cacheable are goneqNXnew parametersqNXchanges to behaviourqNXpurges are now called bansqNXchanged default valuesqNXlog moved to the std vmodqNX"esi is replaced with beresp.do_esiqNX%req.hash is replaced with hash_data()qNXchanges to runtime parametersqNuUsubstitution_defsq}qUparse_messagesq]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hUchanged-parameter-namesq hUchanges-to-vclq!hU-returns-are-now-done-with-the-return-functionq"h U)pass-in-vcl-fetch-renamed-to-hit-for-passq#h Udeleted-parametersq$h Ustring-concatenation-operatorq%h Uno-more-escapes-in-stringsq&h U!upgrading-from-varnish-2-1-to-3-0q'hU+beresp-cacheable-and-obj-cacheable-are-goneq(hUnew-parametersq)hUchanges-to-behaviourq*hUpurges-are-now-called-bansq+hUchanged-default-valuesq,hUlog-moved-to-the-std-vmodq-hU"esi-is-replaced-with-beresp-do-esiq.hU#req-hash-is-replaced-with-hash-dataq/hUchanges-to-runtime-parametersq0uUchildrenq1]q2cdocutils.nodes section q3)q4}q5(U rawsourceq6UUparentq7hUsourceq8cdocutils.nodes reprunicode q9X8/home/tfheen/varnish/doc/sphinx/installation/upgrade.rstq:…q;}qU attributesq?}q@(UdupnamesqA]UclassesqB]UbackrefsqC]UidsqD]qEh'aUnamesqF]qGh auUlineqHKUdocumentqIhh1]qJ(cdocutils.nodes title qK)qL}qM(h6X!Upgrading from Varnish 2.1 to 3.0qNh7h4h8h;h=UtitleqOh?}qP(hA]hB]hC]hD]hF]uhHKhIhh1]qQcdocutils.nodes Text qRX!Upgrading from Varnish 2.1 to 3.0qS…qT}qU(h6hNh7hLubaubcdocutils.nodes paragraph qV)qW}qX(h6XbThis is a compilation of items you need to pay attention to when upgrading from Varnish 2.1 to 3.0qYh7h4h8h;h=U paragraphqZh?}q[(hA]hB]hC]hD]hF]uhHKhIhh1]q\hRXbThis is a compilation of items you need to pay attention to when upgrading from Varnish 2.1 to 3.0q]…q^}q_(h6hYh7hWubaubh3)q`}qa(h6Uh7h4h8h;h=h>h?}qb(hA]hB]hC]hD]qch!ahF]qdhauhHKhIhh1]qe(hK)qf}qg(h6XChanges to VCLqhh7h`h8h;h=hOh?}qi(hA]hB]hC]hD]hF]uhHKhIhh1]qjhRXChanges to VCLqk…ql}qm(h6hhh7hfubaubhV)qn}qo(h6XZIn most cases you need to update your VCL since there has been some changes to the syntax.qph7h`h8h;h=hZh?}qq(hA]hB]hC]hD]hF]uhHK hIhh1]qrhRXZIn most cases you need to update your VCL since there has been some changes to the syntax.qs…qt}qu(h6hph7hnubaubh3)qv}qw(h6Uh7h`h8h;h=h>h?}qx(hA]hB]hC]hD]qyh%ahF]qzh auhHK hIhh1]q{(hK)q|}q}(h6Xstring concatenation operatorq~h7hvh8h;h=hOh?}q(hA]hB]hC]hD]hF]uhHK hIhh1]q€hRXstring concatenation operatorq…q‚}qƒ(h6h~h7h|ubaubhV)q„}q…(h6XaString concatenation did not have an operator previously, but this has now been changed to ``+``.q†h7hvh8h;h=hZh?}q‡(hA]hB]hC]hD]hF]uhHKhIhh1]qˆ(hRX[String concatenation did not have an operator previously, but this has now been changed to q‰…qŠ}q‹(h6X[String concatenation did not have an operator previously, but this has now been changed to h7h„ubcdocutils.nodes literal qŒ)q}qŽ(h6X``+``h?}q(hA]hB]hC]hD]hF]uh7h„h1]qhRX+…q‘}q’(h6Uh7hubah=Uliteralq“ubhRX.…q”}q•(h6X.h7h„ubeubeubh3)q–}q—(h6Uh7h`h8h;h=h>h?}q˜(hA]hB]hC]hD]q™h&ahF]qšh auhHKhIhh1]q›(hK)qœ}q(h6Xno more %-escapes in stringsqžh7h–h8h;h=hOh?}qŸ(hA]hB]hC]hD]hF]uhHKhIhh1]q hRXno more %-escapes in stringsq¡…q¢}q£(h6hžh7hœubaubhV)q¤}q¥(h6XuTo simplify strings, the %-encoding has been removed. If you need non-printable characters, you need to use inline C.q¦h7h–h8h;h=hZh?}q§(hA]hB]hC]hD]hF]uhHKhIhh1]q¨hRXuTo simplify strings, the %-encoding has been removed. If you need non-printable characters, you need to use inline C.q©…qª}q«(h6h¦h7h¤ubaubeubh3)q¬}q­(h6Uh7h`h8h;h=h>h?}q®(hA]hB]hC]hD]q¯h-ahF]q°hauhHKhIhh1]q±(hK)q²}q³(h6X``log`` moved to the std vmodq´h7h¬h8h;h=hOh?}qµ(hA]hB]hC]hD]hF]uhHKhIhh1]q¶(hŒ)q·}q¸(h6X``log``q¹h?}qº(hA]hB]hC]hD]hF]uh7h²h1]q»hRXlogq¼…q½}q¾(h6Uh7h·ubah=h“ubhRX moved to the std vmodq¿…qÀ}qÁ(h6X moved to the std vmodqÂh7h²ubeubhV)qÃ}qÄ(h6X#``log`` has moved to the std vmod::qÅh7h¬h8h;h=hZh?}qÆ(hA]hB]hC]hD]hF]uhHKhIhh1]qÇ(hŒ)qÈ}qÉ(h6X``log``h?}qÊ(hA]hB]hC]hD]hF]uh7hÃh1]qËhRXlogqÌ…qÍ}qÎ(h6Uh7hÈubah=h“ubhRX has moved to the std vmod:qÏ…qÐ}qÑ(h6X has moved to the std vmod:h7hÃubeubcdocutils.nodes literal_block qÒ)qÓ}qÔ(h6Xlog "log something";h7h¬h8h;h=U literal_blockqÕh?}qÖ(U xml:spaceq×UpreserveqØhD]hC]hA]hB]hF]uhHKhIhh1]qÙhRXlog "log something";qÚ…qÛ}qÜ(h6Uh7hÓubaubhV)qÝ}qÞ(h6X becomes::qßh7h¬h8h;h=hZh?}qà(hA]hB]hC]hD]hF]uhHKhIhh1]qáhRXbecomes:qâ…qã}qä(h6Xbecomes:h7hÝubaubhÒ)qå}qæ(h6X%import std; std.log("log something");h7h¬h8h;h=hÕh?}qç(h×hØhD]hC]hA]hB]hF]uhHKhIhh1]qèhRX%import std; std.log("log something");qé…qê}që(h6Uh7håubaubhV)qì}qí(h6X!You only need to import std once.qîh7h¬h8h;h=hZh?}qï(hA]hB]hC]hD]hF]uhHK hIhh1]qðhRX!You only need to import std once.qñ…qò}qó(h6hîh7hìubaubeubh3)qô}qõ(h6Uh7h`h8h;h=h>h?}qö(hA]hB]hC]hD]q÷h+ahF]qøhauhHK#hIhh1]qù(hK)qú}qû(h6Xpurges are now called bansqüh7hôh8h;h=hOh?}qý(hA]hB]hC]hD]hF]uhHK#hIhh1]qþhRXpurges are now called bansqÿ…r}r(h6hüh7húubaubhV)r}r(h6Xx``purge()`` and ``purge_url()`` are now respectively ``ban()`` and ``ban_url()``, so you should replace all occurences::rh7hôh8h;h=hZh?}r(hA]hB]hC]hD]hF]uhHK%hIhh1]r(hŒ)r}r(h6X ``purge()``h?}r (hA]hB]hC]hD]hF]uh7jh1]r hRXpurge()r …r }r (h6Uh7jubah=h“ubhRX and r…r}r(h6X and h7jubhŒ)r}r(h6X``purge_url()``h?}r(hA]hB]hC]hD]hF]uh7jh1]rhRX purge_url()r…r}r(h6Uh7jubah=h“ubhRX are now respectively r…r}r(h6X are now respectively h7jubhŒ)r}r(h6X ``ban()``h?}r(hA]hB]hC]hD]hF]uh7jh1]rhRXban()r…r }r!(h6Uh7jubah=h“ubhRX and r"…r#}r$(h6X and h7jubhŒ)r%}r&(h6X ``ban_url()``h?}r'(hA]hB]hC]hD]hF]uh7jh1]r(hRX ban_url()r)…r*}r+(h6Uh7j%ubah=h“ubhRX', so you should replace all occurences:r,…r-}r.(h6X', so you should replace all occurences:h7jubeubhÒ)r/}r0(h6Xpurge("req.url = " req.url);h7hôh8h;h=hÕh?}r1(h×hØhD]hC]hA]hB]hF]uhHK'hIhh1]r2hRXpurge("req.url = " req.url);r3…r4}r5(h6Uh7j/ubaubhV)r6}r7(h6X becomes::r8h7hôh8h;h=hZh?}r9(hA]hB]hC]hD]hF]uhHK)hIhh1]r:hRXbecomes:r;…r<}r=(h6Xbecomes:h7j6ubaubhÒ)r>}r?(h6Xban("req.url = " + req.url);h7hôh8h;h=hÕh?}r@(h×hØhD]hC]hA]hB]hF]uhHK+hIhh1]rAhRXban("req.url = " + req.url);rB…rC}rD(h6Uh7j>ubaubhV)rE}rF(h6X¨``purge`` does not take any arguments anymore, but can be used in vcl_hit or vcl_miss to purge the item from the cache, where you would reduce ttl to 0 in Varnish 2.1::rGh7hôh8h;h=hZh?}rH(hA]hB]hC]hD]hF]uhHK-hIhh1]rI(hŒ)rJ}rK(h6X ``purge``h?}rL(hA]hB]hC]hD]hF]uh7jEh1]rMhRXpurgerN…rO}rP(h6Uh7jJubah=h“ubhRXž does not take any arguments anymore, but can be used in vcl_hit or vcl_miss to purge the item from the cache, where you would reduce ttl to 0 in Varnish 2.1:rQ…rR}rS(h6Xž does not take any arguments anymore, but can be used in vcl_hit or vcl_miss to purge the item from the cache, where you would reduce ttl to 0 in Varnish 2.1:h7jEubeubhÒ)rT}rU(h6Xbsub vcl_hit { if (req.request == "PURGE") { set obj.ttl = 0s; error 200 "Purged."; } }h7hôh8h;h=hÕh?}rV(h×hØhD]hC]hA]hB]hF]uhHK/hIhh1]rWhRXbsub vcl_hit { if (req.request == "PURGE") { set obj.ttl = 0s; error 200 "Purged."; } }rX…rY}rZ(h6Uh7jTubaubhV)r[}r\(h6X becomes::r]h7hôh8h;h=hZh?}r^(hA]hB]hC]hD]hF]uhHK6hIhh1]r_hRXbecomes:r`…ra}rb(h6Xbecomes:h7j[ubaubhÒ)rc}rd(h6XWsub vcl_hit { if (req.request == "PURGE") { purge; error 200 "Purged."; } }h7hôh8h;h=hÕh?}re(h×hØhD]hC]hA]hB]hF]uhHK8hIhh1]rfhRXWsub vcl_hit { if (req.request == "PURGE") { purge; error 200 "Purged."; } }rg…rh}ri(h6Uh7jcubaubeubh3)rj}rk(h6Uh7h`h8h;h=h>h?}rl(hA]hB]hC]hD]rmh(ahF]rnhauhHK@hIhh1]ro(hK)rp}rq(h6X3``beresp.cacheable`` and ``obj.cacheable`` are gonerrh7jjh8h;h=hOh?}rs(hA]hB]hC]hD]hF]uhHK@hIhh1]rt(hŒ)ru}rv(h6X``beresp.cacheable``rwh?}rx(hA]hB]hC]hD]hF]uh7jph1]ryhRXberesp.cacheablerz…r{}r|(h6Uh7juubah=h“ubhRX and r}…r~}r(h6X and r€h7jpubhŒ)r}r‚(h6X``obj.cacheable``rƒh?}r„(hA]hB]hC]hD]hF]uh7jph1]r…hRX obj.cacheabler†…r‡}rˆ(h6Uh7jubah=h“ubhRX are goner‰…rŠ}r‹(h6X are gonerŒh7jpubeubhV)r}rŽ(h6XŽ``beresp.cacheable`` is gone, and can be replaced with ``beresp.ttl > 0s``. Similarly ``obj.cacheable`` can be replaced with ``obj.ttl > 0s``.rh7jjh8h;h=hZh?}r(hA]hB]hC]hD]hF]uhHKBhIhh1]r‘(hŒ)r’}r“(h6X``beresp.cacheable``h?}r”(hA]hB]hC]hD]hF]uh7jh1]r•hRXberesp.cacheabler–…r—}r˜(h6Uh7j’ubah=h“ubhRX# is gone, and can be replaced with r™…rš}r›(h6X# is gone, and can be replaced with h7jubhŒ)rœ}r(h6X``beresp.ttl > 0s``h?}rž(hA]hB]hC]hD]hF]uh7jh1]rŸhRXberesp.ttl > 0sr …r¡}r¢(h6Uh7jœubah=h“ubhRX . Similarly r£…r¤}r¥(h6X . Similarly h7jubhŒ)r¦}r§(h6X``obj.cacheable``h?}r¨(hA]hB]hC]hD]hF]uh7jh1]r©hRX obj.cacheablerª…r«}r¬(h6Uh7j¦ubah=h“ubhRX can be replaced with r­…r®}r¯(h6X can be replaced with h7jubhŒ)r°}r±(h6X``obj.ttl > 0s``h?}r²(hA]hB]hC]hD]hF]uh7jh1]r³hRX obj.ttl > 0sr´…rµ}r¶(h6Uh7j°ubah=h“ubhRX.…r·}r¸(h6X.h7jubeubeubh3)r¹}rº(h6Uh7h`h8h;h=h>h?}r»(hA]hB]hC]hD]r¼h"ahF]r½hauhHKEhIhh1]r¾(hK)r¿}rÀ(h6X3returns are now done with the ``return()`` functionrÁh7j¹h8h;h=hOh?}rÂ(hA]hB]hC]hD]hF]uhHKEhIhh1]rÃ(hRXreturns are now done with the rÄ…rÅ}rÆ(h6Xreturns are now done with the rÇh7j¿ubhŒ)rÈ}rÉ(h6X ``return()``rÊh?}rË(hA]hB]hC]hD]hF]uh7j¿h1]rÌhRXreturn()rÍ…rÎ}rÏ(h6Uh7jÈubah=h“ubhRX functionrÐ…rÑ}rÒ(h6X functionrÓh7j¿ubeubhV)rÔ}rÕ(h6X–``pass``, ``pipe``, ``lookup``, ``deliver``, ``fetch``, ``hash``, ``pipe`` and ``restart`` are no longer keywords, but arguments to ``return()``, so::rÖh7j¹h8h;h=hZh?}r×(hA]hB]hC]hD]hF]uhHKGhIhh1]rØ(hŒ)rÙ}rÚ(h6X``pass``h?}rÛ(hA]hB]hC]hD]hF]uh7jÔh1]rÜhRXpassrÝ…rÞ}rß(h6Uh7jÙubah=h“ubhRX, rà…rá}râ(h6X, h7jÔubhŒ)rã}rä(h6X``pipe``h?}rå(hA]hB]hC]hD]hF]uh7jÔh1]ræhRXpiperç…rè}ré(h6Uh7jãubah=h“ubhRX, rê…rë}rì(h6X, h7jÔubhŒ)rí}rî(h6X ``lookup``h?}rï(hA]hB]hC]hD]hF]uh7jÔh1]rðhRXlookuprñ…rò}ró(h6Uh7jíubah=h“ubhRX, rô…rõ}rö(h6X, h7jÔubhŒ)r÷}rø(h6X ``deliver``h?}rù(hA]hB]hC]hD]hF]uh7jÔh1]rúhRXdeliverrû…rü}rý(h6Uh7j÷ubah=h“ubhRX, rþ…rÿ}r(h6X, h7jÔubhŒ)r}r(h6X ``fetch``h?}r(hA]hB]hC]hD]hF]uh7jÔh1]rhRXfetchr…r}r(h6Uh7jubah=h“ubhRX, r…r }r (h6X, h7jÔubhŒ)r }r (h6X``hash``h?}r (hA]hB]hC]hD]hF]uh7jÔh1]rhRXhashr…r}r(h6Uh7j ubah=h“ubhRX, r…r}r(h6X, h7jÔubhŒ)r}r(h6X``pipe``h?}r(hA]hB]hC]hD]hF]uh7jÔh1]rhRXpiper…r}r(h6Uh7jubah=h“ubhRX and r…r}r(h6X and h7jÔubhŒ)r}r (h6X ``restart``h?}r!(hA]hB]hC]hD]hF]uh7jÔh1]r"hRXrestartr#…r$}r%(h6Uh7jubah=h“ubhRX* are no longer keywords, but arguments to r&…r'}r((h6X* are no longer keywords, but arguments to h7jÔubhŒ)r)}r*(h6X ``return()``h?}r+(hA]hB]hC]hD]hF]uh7jÔh1]r,hRXreturn()r-…r.}r/(h6Uh7j)ubah=h“ubhRX, so:r0…r1}r2(h6X, so:h7jÔubeubhÒ)r3}r4(h6Xsub vcl_pass { pass; }h7j¹h8h;h=hÕh?}r5(h×hØhD]hC]hA]hB]hF]uhHKIhIhh1]r6hRXsub vcl_pass { pass; }r7…r8}r9(h6Uh7j3ubaubhV)r:}r;(h6X becomes::r<h7j¹h8h;h=hZh?}r=(hA]hB]hC]hD]hF]uhHKMhIhh1]r>hRXbecomes:r?…r@}rA(h6Xbecomes:h7j:ubaubhÒ)rB}rC(h6X sub vcl_pass { return(pass); }h7j¹h8h;h=hÕh?}rD(h×hØhD]hC]hA]hB]hF]uhHKOhIhh1]rEhRX sub vcl_pass { return(pass); }rF…rG}rH(h6Uh7jBubaubeubh3)rI}rJ(h6Uh7h`h8h;h=h>h?}rK(hA]hB]hC]hD]rLh/ahF]rMhauhHKUhIhh1]rN(hK)rO}rP(h6X-``req.hash`` is replaced with ``hash_data()``rQh7jIh8h;h=hOh?}rR(hA]hB]hC]hD]hF]uhHKUhIhh1]rS(hŒ)rT}rU(h6X ``req.hash``rVh?}rW(hA]hB]hC]hD]hF]uh7jOh1]rXhRXreq.hashrY…rZ}r[(h6Uh7jTubah=h“ubhRX is replaced with r\…r]}r^(h6X is replaced with r_h7jOubhŒ)r`}ra(h6X``hash_data()``rbh?}rc(hA]hB]hC]hD]hF]uh7jOh1]rdhRX hash_data()re…rf}rg(h6Uh7j`ubah=h“ubeubhV)rh}ri(h6X2You no longer append to the hash with ``+=``, so::rjh7jIh8h;h=hZh?}rk(hA]hB]hC]hD]hF]uhHKWhIhh1]rl(hRX&You no longer append to the hash with rm…rn}ro(h6X&You no longer append to the hash with h7jhubhŒ)rp}rq(h6X``+=``h?}rr(hA]hB]hC]hD]hF]uh7jhh1]rshRX+=rt…ru}rv(h6Uh7jpubah=h“ubhRX, so:rw…rx}ry(h6X, so:h7jhubeubhÒ)rz}r{(h6Xset req.hash += req.url;h7jIh8h;h=hÕh?}r|(h×hØhD]hC]hA]hB]hF]uhHKYhIhh1]r}hRXset req.hash += req.url;r~…r}r€(h6Uh7jzubaubhV)r}r‚(h6X becomes::rƒh7jIh8h;h=hZh?}r„(hA]hB]hC]hD]hF]uhHK[hIhh1]r…hRXbecomes:r†…r‡}rˆ(h6Xbecomes:h7jubaubhÒ)r‰}rŠ(h6Xhash_data(req.url);h7jIh8h;h=hÕh?}r‹(h×hØhD]hC]hA]hB]hF]uhHK]hIhh1]rŒhRXhash_data(req.url);r…rŽ}r(h6Uh7j‰ubaubeubh3)r}r‘(h6Uh7h`h8h;h=h>h?}r’(hA]hB]hC]hD]r“h.ahF]r”hauhHK`hIhh1]r•(hK)r–}r—(h6X*``esi`` is replaced with ``beresp.do_esi``r˜h7jh8h;h=hOh?}r™(hA]hB]hC]hD]hF]uhHK`hIhh1]rš(hŒ)r›}rœ(h6X``esi``rh?}rž(hA]hB]hC]hD]hF]uh7j–h1]rŸhRXesir …r¡}r¢(h6Uh7j›ubah=h“ubhRX is replaced with r£…r¤}r¥(h6X is replaced with r¦h7j–ubhŒ)r§}r¨(h6X``beresp.do_esi``r©h?}rª(hA]hB]hC]hD]hF]uh7j–h1]r«hRX beresp.do_esir¬…r­}r®(h6Uh7j§ubah=h“ubeubhV)r¯}r°(h6X+You no longer enable ESI with ``esi``, so::r±h7jh8h;h=hZh?}r²(hA]hB]hC]hD]hF]uhHKbhIhh1]r³(hRXYou no longer enable ESI with r´…rµ}r¶(h6XYou no longer enable ESI with h7j¯ubhŒ)r·}r¸(h6X``esi``h?}r¹(hA]hB]hC]hD]hF]uh7j¯h1]rºhRXesir»…r¼}r½(h6Uh7j·ubah=h“ubhRX, so:r¾…r¿}rÀ(h6X, so:h7j¯ubeubhÒ)rÁ}rÂ(h6Xesi;h7jh8h;h=hÕh?}rÃ(h×hØhD]hC]hA]hB]hF]uhHKdhIhh1]rÄhRXesi;rÅ…rÆ}rÇ(h6Uh7jÁubaubhV)rÈ}rÉ(h6Xin ``vcl_fetch`` becomes::rÊh7jh8h;h=hZh?}rË(hA]hB]hC]hD]hF]uhHKfhIhh1]rÌ(hRXin rÍ…rÎ}rÏ(h6Xin h7jÈubhŒ)rÐ}rÑ(h6X ``vcl_fetch``h?}rÒ(hA]hB]hC]hD]hF]uh7jÈh1]rÓhRX vcl_fetchrÔ…rÕ}rÖ(h6Uh7jÐubah=h“ubhRX becomes:r×…rØ}rÙ(h6X becomes:h7jÈubeubhÒ)rÚ}rÛ(h6Xset beresp.do_esi = true;h7jh8h;h=hÕh?}rÜ(h×hØhD]hC]hA]hB]hF]uhHKhhIhh1]rÝhRXset beresp.do_esi = true;rÞ…rß}rà(h6Uh7jÚubaubeubh3)rá}râ(h6Uh7h`h8h;h=h>h?}rã(hA]hB]hC]hD]räh#ahF]råh auhHKkhIhh1]ræ(hK)rç}rè(h6X5``pass`` in ``vcl_fetch`` renamed to ``hit_for_pass``réh7jáh8h;h=hOh?}rê(hA]hB]hC]hD]hF]uhHKkhIhh1]rë(hŒ)rì}rí(h6X``pass``rîh?}rï(hA]hB]hC]hD]hF]uh7jçh1]rðhRXpassrñ…rò}ró(h6Uh7jìubah=h“ubhRX in rô…rõ}rö(h6X in r÷h7jçubhŒ)rø}rù(h6X ``vcl_fetch``rúh?}rû(hA]hB]hC]hD]hF]uh7jçh1]rühRX vcl_fetchrý…rþ}rÿ(h6Uh7jøubah=h“ubhRX renamed to r…r}r(h6X renamed to rh7jçubhŒ)r}r(h6X``hit_for_pass``rh?}r(hA]hB]hC]hD]hF]uh7jçh1]rhRX hit_for_passr …r }r (h6Uh7jubah=h“ubeubhV)r }r (h6XÖThe difference in behaviour of ``pass`` in ``vcl_recv`` and ``vcl_fetch`` confused people, so to make it clearer that they are different, you must now do ``return(hit_for_pass)`` when doing a pass in ``vcl_fetch``.h7jáh8h;h=hZh?}r(hA]hB]hC]hD]hF]uhHKmhIhh1]r(hRXThe difference in behaviour of r…r}r(h6XThe difference in behaviour of h7j ubhŒ)r}r(h6X``pass``h?}r(hA]hB]hC]hD]hF]uh7j h1]rhRXpassr…r}r(h6Uh7jubah=h“ubhRX in r…r}r(h6X in h7j ubhŒ)r}r(h6X ``vcl_recv``h?}r(hA]hB]hC]hD]hF]uh7j h1]r hRXvcl_recvr!…r"}r#(h6Uh7jubah=h“ubhRX and r$…r%}r&(h6X and h7j ubhŒ)r'}r((h6X ``vcl_fetch``h?}r)(hA]hB]hC]hD]hF]uh7j h1]r*hRX vcl_fetchr+…r,}r-(h6Uh7j'ubah=h“ubhRXQ confused people, so to make it clearer that they are different, you must now do r.…r/}r0(h6XQ confused people, so to make it clearer that they are different, you must now do h7j ubhŒ)r1}r2(h6X``return(hit_for_pass)``h?}r3(hA]hB]hC]hD]hF]uh7j h1]r4hRXreturn(hit_for_pass)r5…r6}r7(h6Uh7j1ubah=h“ubhRX when doing a pass in r8…r9}r:(h6X when doing a pass in h7j ubhŒ)r;}r<(h6X ``vcl_fetch``h?}r=(hA]hB]hC]hD]hF]uh7j h1]r>hRX vcl_fetchr?…r@}rA(h6Uh7j;ubah=h“ubhRX.…rB}rC(h6X.h7j ubeubeubeubh3)rD}rE(h6Uh7h4h8h;h=h>h?}rF(hA]hB]hC]hD]rGh0ahF]rHhauhHKshIhh1]rI(hK)rJ}rK(h6XChanges to runtime parametersrLh7jDh8h;h=hOh?}rM(hA]hB]hC]hD]hF]uhHKshIhh1]rNhRXChanges to runtime parametersrO…rP}rQ(h6jLh7jJubaubh3)rR}rS(h6Uh7jDh8h;h=h>h?}rT(hA]hB]hC]hD]rUh$ahF]rVh auhHKvhIhh1]rW(hK)rX}rY(h6XDeleted parametersrZh7jRh8h;h=hOh?}r[(hA]hB]hC]hD]hF]uhHKvhIhh1]r\hRXDeleted parametersr]…r^}r_(h6jZh7jXubaubhV)r`}ra(h6X5``cache_vbe_conns`` and ``err_ttl`` has been removed.rbh7jRh8h;h=hZh?}rc(hA]hB]hC]hD]hF]uhHKxhIhh1]rd(hŒ)re}rf(h6X``cache_vbe_conns``h?}rg(hA]hB]hC]hD]hF]uh7j`h1]rhhRXcache_vbe_connsri…rj}rk(h6Uh7jeubah=h“ubhRX and rl…rm}rn(h6X and h7j`ubhŒ)ro}rp(h6X ``err_ttl``h?}rq(hA]hB]hC]hD]hF]uh7j`h1]rrhRXerr_ttlrs…rt}ru(h6Uh7joubah=h“ubhRX has been removed.rv…rw}rx(h6X has been removed.h7j`ubeubeubh3)ry}rz(h6Uh7jDh8h;h=h>h?}r{(hA]hB]hC]hD]r|h)ahF]r}hauhHK{hIhh1]r~(hK)r}r€(h6XNew parametersrh7jyh8h;h=hOh?}r‚(hA]hB]hC]hD]hF]uhHK{hIhh1]rƒhRXNew parametersr„…r…}r†(h6jh7jubaubhV)r‡}rˆ(h6XIThe following parameters have been added, see man varnishd for reference:r‰h7jyh8h;h=hZh?}rŠ(hA]hB]hC]hD]hF]uhHK}hIhh1]r‹hRXIThe following parameters have been added, see man varnishd for reference:rŒ…r}rŽ(h6j‰h7j‡ubaubcdocutils.nodes bullet_list r)r}r‘(h6Uh7jyh8h;h=U bullet_listr’h?}r“(Ubulletr”X*hD]hC]hA]hB]hF]uhHKhIhh1]r•(cdocutils.nodes list_item r–)r—}r˜(h6X``default_keep``r™h7jh8h;h=U list_itemršh?}r›(hA]hB]hC]hD]hF]uhHNhIhh1]rœhV)r}rž(h6j™h7j—h8h;h=hZh?}rŸ(hA]hB]hC]hD]hF]uhHKh1]r hŒ)r¡}r¢(h6j™h?}r£(hA]hB]hC]hD]hF]uh7jh1]r¤hRX default_keepr¥…r¦}r§(h6Uh7j¡ubah=h“ubaubaubj–)r¨}r©(h6X``expiry_sleep``rªh7jh8h;h=jšh?}r«(hA]hB]hC]hD]hF]uhHNhIhh1]r¬hV)r­}r®(h6jªh7j¨h8h;h=hZh?}r¯(hA]hB]hC]hD]hF]uhHK€h1]r°hŒ)r±}r²(h6jªh?}r³(hA]hB]hC]hD]hF]uh7j­h1]r´hRX expiry_sleeprµ…r¶}r·(h6Uh7j±ubah=h“ubaubaubj–)r¸}r¹(h6X``fetch_maxchunksize``rºh7jh8h;h=jšh?}r»(hA]hB]hC]hD]hF]uhHNhIhh1]r¼hV)r½}r¾(h6jºh7j¸h8h;h=hZh?}r¿(hA]hB]hC]hD]hF]uhHKh1]rÀhŒ)rÁ}rÂ(h6jºh?}rÃ(hA]hB]hC]hD]hF]uh7j½h1]rÄhRXfetch_maxchunksizerÅ…rÆ}rÇ(h6Uh7jÁubah=h“ubaubaubj–)rÈ}rÉ(h6X``gzip_level``rÊh7jh8h;h=jšh?}rË(hA]hB]hC]hD]hF]uhHNhIhh1]rÌhV)rÍ}rÎ(h6jÊh7jÈh8h;h=hZh?}rÏ(hA]hB]hC]hD]hF]uhHK‚h1]rÐhŒ)rÑ}rÒ(h6jÊh?}rÓ(hA]hB]hC]hD]hF]uh7jÍh1]rÔhRX gzip_levelrÕ…rÖ}r×(h6Uh7jÑubah=h“ubaubaubj–)rØ}rÙ(h6X``gzip_memlevel``rÚh7jh8h;h=jšh?}rÛ(hA]hB]hC]hD]hF]uhHNhIhh1]rÜhV)rÝ}rÞ(h6jÚh7jØh8h;h=hZh?}rß(hA]hB]hC]hD]hF]uhHKƒh1]ràhŒ)rá}râ(h6jÚh?}rã(hA]hB]hC]hD]hF]uh7jÝh1]rähRX gzip_memlevelrå…ræ}rç(h6Uh7jáubah=h“ubaubaubj–)rè}ré(h6X``gzip_stack_buffer``rêh7jh8h;h=jšh?}rë(hA]hB]hC]hD]hF]uhHNhIhh1]rìhV)rí}rî(h6jêh7jèh8h;h=hZh?}rï(hA]hB]hC]hD]hF]uhHK„h1]rðhŒ)rñ}rò(h6jêh?}ró(hA]hB]hC]hD]hF]uh7jíh1]rôhRXgzip_stack_bufferrõ…rö}r÷(h6Uh7jñubah=h“ubaubaubj–)rø}rù(h6X``gzip_tmp_space``rúh7jh8h;h=jšh?}rû(hA]hB]hC]hD]hF]uhHNhIhh1]rühV)rý}rþ(h6júh7jøh8h;h=hZh?}rÿ(hA]hB]hC]hD]hF]uhHK…h1]rhŒ)r}r(h6júh?}r(hA]hB]hC]hD]hF]uh7jýh1]rhRXgzip_tmp_spacer…r}r(h6Uh7jubah=h“ubaubaubj–)r}r (h6X``gzip_window``r h7jh8h;h=jšh?}r (hA]hB]hC]hD]hF]uhHNhIhh1]r hV)r }r(h6j h7jh8h;h=hZh?}r(hA]hB]hC]hD]hF]uhHK†h1]rhŒ)r}r(h6j h?}r(hA]hB]hC]hD]hF]uh7j h1]rhRX gzip_windowr…r}r(h6Uh7jubah=h“ubaubaubj–)r}r(h6X``http_gzip_support``rh7jh8h;h=jšh?}r(hA]hB]hC]hD]hF]uhHNhIhh1]rhV)r}r(h6jh7jh8h;h=hZh?}r(hA]hB]hC]hD]hF]uhHK‡h1]r hŒ)r!}r"(h6jh?}r#(hA]hB]hC]hD]hF]uh7jh1]r$hRXhttp_gzip_supportr%…r&}r'(h6Uh7j!ubah=h“ubaubaubj–)r(}r)(h6X``http_req_hdr_len``r*h7jh8h;h=jšh?}r+(hA]hB]hC]hD]hF]uhHNhIhh1]r,hV)r-}r.(h6j*h7j(h8h;h=hZh?}r/(hA]hB]hC]hD]hF]uhHKˆh1]r0hŒ)r1}r2(h6j*h?}r3(hA]hB]hC]hD]hF]uh7j-h1]r4hRXhttp_req_hdr_lenr5…r6}r7(h6Uh7j1ubah=h“ubaubaubj–)r8}r9(h6X``http_req_size``r:h7jh8h;h=jšh?}r;(hA]hB]hC]hD]hF]uhHNhIhh1]r<hV)r=}r>(h6j:h7j8h8h;h=hZh?}r?(hA]hB]hC]hD]hF]uhHK‰h1]r@hŒ)rA}rB(h6j:h?}rC(hA]hB]hC]hD]hF]uh7j=h1]rDhRX http_req_sizerE…rF}rG(h6Uh7jAubah=h“ubaubaubj–)rH}rI(h6X``http_resp_hdr_len``rJh7jh8h;h=jšh?}rK(hA]hB]hC]hD]hF]uhHNhIhh1]rLhV)rM}rN(h6jJh7jHh8h;h=hZh?}rO(hA]hB]hC]hD]hF]uhHKŠh1]rPhŒ)rQ}rR(h6jJh?}rS(hA]hB]hC]hD]hF]uh7jMh1]rThRXhttp_resp_hdr_lenrU…rV}rW(h6Uh7jQubah=h“ubaubaubj–)rX}rY(h6X``http_resp_size``rZh7jh8h;h=jšh?}r[(hA]hB]hC]hD]hF]uhHNhIhh1]r\hV)r]}r^(h6jZh7jXh8h;h=hZh?}r_(hA]hB]hC]hD]hF]uhHK‹h1]r`hŒ)ra}rb(h6jZh?}rc(hA]hB]hC]hD]hF]uh7j]h1]rdhRXhttp_resp_sizere…rf}rg(h6Uh7jaubah=h“ubaubaubj–)rh}ri(h6X``shortlived``rjh7jh8h;h=jšh?}rk(hA]hB]hC]hD]hF]uhHNhIhh1]rlhV)rm}rn(h6jjh7jhh8h;h=hZh?}ro(hA]hB]hC]hD]hF]uhHKŒh1]rphŒ)rq}rr(h6jjh?}rs(hA]hB]hC]hD]hF]uh7jmh1]rthRX shortlivedru…rv}rw(h6Uh7jqubah=h“ubaubaubj–)rx}ry(h6X``thread_pool_workspace``rzh7jh8h;h=jšh?}r{(hA]hB]hC]hD]hF]uhHNhIhh1]r|hV)r}}r~(h6jzh7jxh8h;h=hZh?}r(hA]hB]hC]hD]hF]uhHKh1]r€hŒ)r}r‚(h6jzh?}rƒ(hA]hB]hC]hD]hF]uh7j}h1]r„hRXthread_pool_workspacer……r†}r‡(h6Uh7jubah=h“ubaubaubj–)rˆ}r‰(h6X``vcc_err_unref``rŠh7jh8h;h=jšh?}r‹(hA]hB]hC]hD]hF]uhHNhIhh1]rŒhV)r}rŽ(h6jŠh7jˆh8h;h=hZh?}r(hA]hB]hC]hD]hF]uhHKŽh1]rhŒ)r‘}r’(h6jŠh?}r“(hA]hB]hC]hD]hF]uh7jh1]r”hRX vcc_err_unrefr•…r–}r—(h6Uh7j‘ubah=h“ubaubaubj–)r˜}r™(h6X ``vcl_dir``ršh7jh8h;h=jšh?}r›(hA]hB]hC]hD]hF]uhHNhIhh1]rœhV)r}rž(h6jšh7j˜h8h;h=hZh?}rŸ(hA]hB]hC]hD]hF]uhHKh1]r hŒ)r¡}r¢(h6jšh?}r£(hA]hB]hC]hD]hF]uh7jh1]r¤hRXvcl_dirr¥…r¦}r§(h6Uh7j¡ubah=h“ubaubaubj–)r¨}r©(h6X ``vmod_dir`` h7jh8h;h=jšh?}rª(hA]hB]hC]hD]hF]uhHNhIhh1]r«hV)r¬}r­(h6X ``vmod_dir``r®h7j¨h8h;h=hZh?}r¯(hA]hB]hC]hD]hF]uhHKh1]r°hŒ)r±}r²(h6j®h?}r³(hA]hB]hC]hD]hF]uh7j¬h1]r´hRXvmod_dirrµ…r¶}r·(h6Uh7j±ubah=h“ubaubaubeubeubh3)r¸}r¹(h6Uh7jDh8h;h=h>h?}rº(hA]hB]hC]hD]r»h,ahF]r¼hauhHK“hIhh1]r½(hK)r¾}r¿(h6XChanged default valuesrÀh7j¸h8h;h=hOh?}rÁ(hA]hB]hC]hD]hF]uhHK“hIhh1]rÂhRXChanged default valuesrÃ…rÄ}rÅ(h6jÀh7j¾ubaubhV)rÆ}rÇ(h6X+The following parameters have new defaults:rÈh7j¸h8h;h=hZh?}rÉ(hA]hB]hC]hD]hF]uhHK•hIhh1]rÊhRX+The following parameters have new defaults:rË…rÌ}rÍ(h6jÈh7jÆubaubj)rÎ}rÏ(h6Uh7j¸h8h;h=j’h?}rÐ(j”X*hD]hC]hA]hB]hF]uhHK—hIhh1]rÑ(j–)rÒ}rÓ(h6XX``ban_lurker_sleep`` changed from 0 to 0.01 seconds, enabling the ban lurker by default.rÔh7jÎh8h;h=jšh?}rÕ(hA]hB]hC]hD]hF]uhHNhIhh1]rÖhV)r×}rØ(h6jÔh7jÒh8h;h=hZh?}rÙ(hA]hB]hC]hD]hF]uhHK—h1]rÚ(hŒ)rÛ}rÜ(h6X``ban_lurker_sleep``h?}rÝ(hA]hB]hC]hD]hF]uh7j×h1]rÞhRXban_lurker_sleeprß…rà}rá(h6Uh7jÛubah=h“ubhRXD changed from 0 to 0.01 seconds, enabling the ban lurker by default.râ…rã}rä(h6XD changed from 0 to 0.01 seconds, enabling the ban lurker by default.h7j×ubeubaubj–)rå}ræ(h6X4``connect_timeout`` changed from 0.4 to 0.7 seconds.rçh7jÎh8h;h=jšh?}rè(hA]hB]hC]hD]hF]uhHNhIhh1]réhV)rê}rë(h6jçh7jåh8h;h=hZh?}rì(hA]hB]hC]hD]hF]uhHK˜h1]rí(hŒ)rî}rï(h6X``connect_timeout``h?}rð(hA]hB]hC]hD]hF]uh7jêh1]rñhRXconnect_timeoutrò…ró}rô(h6Uh7jîubah=h“ubhRX! changed from 0.4 to 0.7 seconds.rõ…rö}r÷(h6X! changed from 0.4 to 0.7 seconds.h7jêubeubaubj–)rø}rù(h6X*``log_hashstring`` changed from off to on.rúh7jÎh8h;h=jšh?}rû(hA]hB]hC]hD]hF]uhHNhIhh1]rühV)rý}rþ(h6júh7jøh8h;h=hZh?}rÿ(hA]hB]hC]hD]hF]uhHK™h1]r(hŒ)r}r(h6X``log_hashstring``h?}r(hA]hB]hC]hD]hF]uh7jýh1]rhRXlog_hashstringr…r}r(h6Uh7jubah=h“ubhRX changed from off to on.r…r }r (h6X changed from off to on.h7jýubeubaubj–)r }r (h6X0``send_timeout`` changed from 600 to 60 seconds.r h7jÎh8h;h=jšh?}r(hA]hB]hC]hD]hF]uhHNhIhh1]rhV)r}r(h6j h7j h8h;h=hZh?}r(hA]hB]hC]hD]hF]uhHKšh1]r(hŒ)r}r(h6X``send_timeout``h?}r(hA]hB]hC]hD]hF]uh7jh1]rhRX send_timeoutr…r}r(h6Uh7jubah=h“ubhRX changed from 600 to 60 seconds.r…r}r(h6X changed from 600 to 60 seconds.h7jubeubaubj–)r}r(h6X3``thread_pool_add_delay`` changed from 20 to 2 ms. h7jÎh8h;h=jšh?}r (hA]hB]hC]hD]hF]uhHNhIhh1]r!hV)r"}r#(h6X2``thread_pool_add_delay`` changed from 20 to 2 ms.h7jh8h;h=hZh?}r$(hA]hB]hC]hD]hF]uhHK›h1]r%(hŒ)r&}r'(h6X``thread_pool_add_delay``h?}r((hA]hB]hC]hD]hF]uh7j"h1]r)hRXthread_pool_add_delayr*…r+}r,(h6Uh7j&ubah=h“ubhRX changed from 20 to 2 ms.r-…r.}r/(h6X changed from 20 to 2 ms.h7j"ubeubaubeubeubh3)r0}r1(h6Uh7jDh8h;h=h>h?}r2(hA]hB]hC]hD]r3h ahF]r4hauhHKžhIhh1]r5(hK)r6}r7(h6XChanged parameter namesr8h7j0h8h;h=hOh?}r9(hA]hB]hC]hD]hF]uhHKžhIhh1]r:hRXChanged parameter namesr;…r<}r=(h6j8h7j6ubaubhV)r>}r?(h6X(The following parameters have new names:r@h7j0h8h;h=hZh?}rA(hA]hB]hC]hD]hF]uhHK hIhh1]rBhRX(The following parameters have new names:rC…rD}rE(h6j@h7j>ubaubj)rF}rG(h6Uh7j0h8h;h=j’h?}rH(j”X*hD]hC]hA]hB]hF]uhHK¢hIhh1]rI(j–)rJ}rK(h6X6``http_headers`` has been renamed to ``http_max_hdr``.rLh7jFh8h;h=jšh?}rM(hA]hB]hC]hD]hF]uhHNhIhh1]rNhV)rO}rP(h6jLh7jJh8h;h=hZh?}rQ(hA]hB]hC]hD]hF]uhHK¢h1]rR(hŒ)rS}rT(h6X``http_headers``h?}rU(hA]hB]hC]hD]hF]uh7jOh1]rVhRX http_headersrW…rX}rY(h6Uh7jSubah=h“ubhRX has been renamed to rZ…r[}r\(h6X has been renamed to h7jOubhŒ)r]}r^(h6X``http_max_hdr``h?}r_(hA]hB]hC]hD]hF]uh7jOh1]r`hRX http_max_hdrra…rb}rc(h6Uh7j]ubah=h“ubhRX.…rd}re(h6X.h7jOubeubaubj–)rf}rg(h6X;``max_esi_includes`` has been renamed to ``max_esi_depth``.rhh7jFh8h;h=jšh?}ri(hA]hB]hC]hD]hF]uhHNhIhh1]rjhV)rk}rl(h6jhh7jfh8h;h=hZh?}rm(hA]hB]hC]hD]hF]uhHK£h1]rn(hŒ)ro}rp(h6X``max_esi_includes``h?}rq(hA]hB]hC]hD]hF]uh7jkh1]rrhRXmax_esi_includesrs…rt}ru(h6Uh7joubah=h“ubhRX has been renamed to rv…rw}rx(h6X has been renamed to h7jkubhŒ)ry}rz(h6X``max_esi_depth``h?}r{(hA]hB]hC]hD]hF]uh7jkh1]r|hRX max_esi_depthr}…r~}r(h6Uh7jyubah=h“ubhRX.…r€}r(h6X.h7jkubeubaubj–)r‚}rƒ(h6X3``overflow_max`` has been renamed to ``queue_max``.r„h7jFh8h;h=jšh?}r…(hA]hB]hC]hD]hF]uhHNhIhh1]r†hV)r‡}rˆ(h6j„h7j‚h8h;h=hZh?}r‰(hA]hB]hC]hD]hF]uhHK¤h1]rŠ(hŒ)r‹}rŒ(h6X``overflow_max``h?}r(hA]hB]hC]hD]hF]uh7j‡h1]rŽhRX overflow_maxr…r}r‘(h6Uh7j‹ubah=h“ubhRX has been renamed to r’…r“}r”(h6X has been renamed to h7j‡ubhŒ)r•}r–(h6X ``queue_max``h?}r—(hA]hB]hC]hD]hF]uh7j‡h1]r˜hRX queue_maxr™…rš}r›(h6Uh7j•ubah=h“ubhRX.…rœ}r(h6X.h7j‡ubeubaubj–)rž}rŸ(h6X1``purge_dups`` has been renamed to ``ban_dups``. h7jFh8h;h=jšh?}r (hA]hB]hC]hD]hF]uhHNhIhh1]r¡hV)r¢}r£(h6X0``purge_dups`` has been renamed to ``ban_dups``.r¤h7jžh8h;h=hZh?}r¥(hA]hB]hC]hD]hF]uhHK¥h1]r¦(hŒ)r§}r¨(h6X``purge_dups``h?}r©(hA]hB]hC]hD]hF]uh7j¢h1]rªhRX purge_dupsr«…r¬}r­(h6Uh7j§ubah=h“ubhRX has been renamed to r®…r¯}r°(h6X has been renamed to h7j¢ubhŒ)r±}r²(h6X ``ban_dups``h?}r³(hA]hB]hC]hD]hF]uh7j¢h1]r´hRXban_dupsrµ…r¶}r·(h6Uh7j±ubah=h“ubhRX.…r¸}r¹(h6X.h7j¢ubeubaubeubeubeubh3)rº}r»(h6Uh7h4h8h;h=h>h?}r¼(hA]hB]hC]hD]r½h*ahF]r¾hauhHK¨hIhh1]r¿(hK)rÀ}rÁ(h6XChanges to behaviourrÂh7jºh8h;h=hOh?}rÃ(hA]hB]hC]hD]hF]uhHK¨hIhh1]rÄhRXChanges to behaviourrÅ…rÆ}rÇ(h6jÂh7jÀubaubhV)rÈ}rÉ(h6XÛVarnish will return an error when headers are too large instead of just ignoring them. If the limits are too low, Varnish will return HTTP 413. You can change the limits by increasing http_req_hdr_len and http_req_size.rÊh7jºh8h;h=hZh?}rË(hA]hB]hC]hD]hF]uhHKªhIhh1]rÌhRXÛVarnish will return an error when headers are too large instead of just ignoring them. If the limits are too low, Varnish will return HTTP 413. You can change the limits by increasing http_req_hdr_len and http_req_size.rÍ…rÎ}rÏ(h6jÊh7jÈubaubhV)rÐ}rÑ(h6Xthread_pool_max is now per thread pool, while it was a total across all pools in 2.1. If you had this set in 2.1, you should adjust it for 3.0.rÒh7jºh8h;h=hZh?}rÓ(hA]hB]hC]hD]hF]uhHK¬hIhh1]rÔhRXthread_pool_max is now per thread pool, while it was a total across all pools in 2.1. If you had this set in 2.1, you should adjust it for 3.0.rÕ…rÖ}r×(h6jÒh7jÐubaubeubeubah6UU transformerrØNU footnote_refsrÙ}rÚUrefnamesrÛ}rÜUsymbol_footnotesrÝ]rÞUautofootnote_refsrß]ràUsymbol_footnote_refsrá]râU citationsrã]rähIhU current_lineråNUtransform_messagesræ]rçUreporterrèNUid_startréKU autofootnotesrê]rëU citation_refsrì}ríUindirect_targetsrî]rïUsettingsrð(cdocutils.frontend Values rñorò}ró(Ufootnote_backlinksrôKUrecord_dependenciesrõNU rfc_base_urlröUhttp://tools.ietf.org/html/r÷U tracebackrøˆUpep_referencesrùNUstrip_commentsrúNU toc_backlinksrûUentryrüU language_coderýUenrþU datestamprÿNU report_levelrKU _destinationrNU halt_levelrKU strip_classesrNhONUerror_encoding_error_handlerrUbackslashreplacerUdebugrNUembed_stylesheetr‰Uoutput_encoding_error_handlerrUstrictr U sectnum_xformr KUdump_transformsr NU docinfo_xformr KUwarning_streamr NUpep_file_url_templaterUpep-%04drUexit_status_levelrKUconfigrNUstrict_visitorrNUcloak_email_addressesrˆUtrim_footnote_reference_spacer‰UenvrNUdump_pseudo_xmlrNUexpose_internalsrNUsectsubtitle_xformr‰U source_linkrNUrfc_referencesrNUoutput_encodingrUutf-8rU source_urlrNUinput_encodingrU utf-8-sigrU_disable_configr NU id_prefixr!UU tab_widthr"KUerror_encodingr#UUTF-8r$U_sourcer%U8/home/tfheen/varnish/doc/sphinx/installation/upgrade.rstr&Ugettext_compactr'ˆU generatorr(NUdump_internalsr)NU smart_quotesr*‰U pep_base_urlr+Uhttp://www.python.org/dev/peps/r,Usyntax_highlightr-Ulongr.Uinput_encoding_error_handlerr/j Uauto_id_prefixr0Uidr1Udoctitle_xformr2‰Ustrip_elements_with_classesr3NU _config_filesr4]Ufile_insertion_enabledr5KU raw_enabledr6KU dump_settingsr7NubUsymbol_footnote_startr8KUidsr9}r:(h'h4h.jh%hvh+hôh!h`h0jDh j0h(jjh*jºh)jyh"j¹h/jIh&h–h-h¬h#jáh$jRh,j¸uUsubstitution_namesr;}r<h=hIh?}r=(hA]hD]hC]Usourceh;hB]hF]uU footnotesr>]r?Urefidsr@}rAub.varnish-3.0.5/doc/sphinx/=build/doctrees/installation/install.doctree0000644000175000017500000006515412247037213022726 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(XepelqˆXcompiling varnish from sourceqNXfreebsdqNXsource or packages?q NXinstalling varnishq NX debian/ubuntuq NXepel 5q ˆXconfiguring and compilingq NX&build dependencies on red hat / centosqNX centos/redhatqNX install-docqˆX installingqNX other systemsqNX%build dependencies on debian / ubuntuqNuUsubstitution_defsq}qUparse_messagesq]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hUepelqhUcompiling-varnish-from-sourceqhUfreebsdqh Usource-or-packagesq h Uinstalling-varnishq!h U debian-ubuntuq"h Uepel-5q#h Uconfiguring-and-compilingq$hU$build-dependencies-on-red-hat-centosq%hU centos-redhatq&hU install-docq'hU installingq(hU other-systemsq)hU#build-dependencies-on-debian-ubuntuq*uUchildrenq+]q,(cdocutils.nodes target q-)q.}q/(U rawsourceq0X.. _install-doc:Uparentq1hUsourceq2cdocutils.nodes reprunicode q3X8/home/tfheen/varnish/doc/sphinx/installation/install.rstq4…q5}q6bUtagnameq7Utargetq8U attributesq9}q:(Uidsq;]Ubackrefsq<]Udupnamesq=]Uclassesq>]Unamesq?]Urefidq@h'uUlineqAKUdocumentqBhh+]ubcdocutils.nodes section qC)qD}qE(h0Uh1hh2h5Uexpect_referenced_by_nameqF}qGhh.sh7UsectionqHh9}qI(h=]h>]h<]h;]qJ(h!h'eh?]qK(h heuhAKhBhUexpect_referenced_by_idqL}qMh'h.sh+]qN(cdocutils.nodes title qO)qP}qQ(h0XInstalling VarnishqRh1hDh2h5h7UtitleqSh9}qT(h=]h>]h<]h;]h?]uhAKhBhh+]qUcdocutils.nodes Text qVXInstalling VarnishqW…qX}qY(h0hRh1hPubaubcdocutils.nodes paragraph qZ)q[}q\(h0X)With open source software, you can choose to install binary packages or compile stuff from source-code. To install a package or compile from source is a matter of personal taste. If you don't know which method too choose read the whole document and choose the method you are most comfortable with.q]h1hDh2h5h7U paragraphq^h9}q_(h=]h>]h<]h;]h?]uhAKhBhh+]q`hVX)With open source software, you can choose to install binary packages or compile stuff from source-code. To install a package or compile from source is a matter of personal taste. If you don't know which method too choose read the whole document and choose the method you are most comfortable with.qa…qb}qc(h0h]h1h[ubaubhC)qd}qe(h0Uh1hDh2h5h7hHh9}qf(h=]h>]h<]h;]qgh ah?]qhh auhAKhBhh+]qi(hO)qj}qk(h0XSource or packages?qlh1hdh2h5h7hSh9}qm(h=]h>]h<]h;]h?]uhAKhBhh+]qnhVXSource or packages?qo…qp}qq(h0hlh1hjubaubhZ)qr}qs(h0XˆInstalling Varnish on most relevant operating systems can usually be done with with the systems package manager, typical examples being:qth1hdh2h5h7h^h9}qu(h=]h>]h<]h;]h?]uhAKhBhh+]qvhVXˆInstalling Varnish on most relevant operating systems can usually be done with with the systems package manager, typical examples being:qw…qx}qy(h0hth1hrubaubeubhC)qz}q{(h0Uh1hDh2h5h7hHh9}q|(h=]h>]h<]h;]q}hah?]q~hauhAKhBhh+]q(hO)q€}q(h0XFreeBSDq‚h1hzh2h5h7hSh9}qƒ(h=]h>]h<]h;]h?]uhAKhBhh+]q„hVXFreeBSDq……q†}q‡(h0h‚h1h€ubaubcdocutils.nodes definition_list qˆ)q‰}qŠ(h0Uh1hzh2h5h7Udefinition_listq‹h9}qŒ(h=]h>]h<]h;]h?]uhANhBhh+]q(cdocutils.nodes definition_list_item qŽ)q}q(h0X<From source: ``cd /usr/ports/varnish && make install clean``h1h‰h2h5h7Udefinition_list_itemq‘h9}q’(h=]h>]h<]h;]h?]uhAKh+]q“(cdocutils.nodes term q”)q•}q–(h0X From source:q—h1hh2h5h7Utermq˜h9}q™(h=]h>]h<]h;]h?]uhAKh+]qšhVX From source:q›…qœ}q(h0h—h1h•ubaubcdocutils.nodes definition qž)qŸ}q (h0Uh9}q¡(h=]h>]h<]h;]h?]uh1hh+]q¢hZ)q£}q¤(h0X/``cd /usr/ports/varnish && make install clean``q¥h1hŸh2h5h7h^h9}q¦(h=]h>]h<]h;]h?]uhAKh+]q§cdocutils.nodes literal q¨)q©}qª(h0h¥h9}q«(h=]h>]h<]h;]h?]uh1h£h+]q¬hVX+cd /usr/ports/varnish && make install cleanq­…q®}q¯(h0Uh1h©ubah7Uliteralq°ubaubah7U definitionq±ubeubhŽ)q²}q³(h0X'Binary package: ``pkg_add -r varnish`` h1h‰h2h5h7h‘h9}q´(h=]h>]h<]h;]h?]uhAKhBhh+]qµ(h”)q¶}q·(h0XBinary package:q¸h1h²h2h5h7h˜h9}q¹(h=]h>]h<]h;]h?]uhAKh+]qºhVXBinary package:q»…q¼}q½(h0h¸h1h¶ubaubhž)q¾}q¿(h0Uh9}qÀ(h=]h>]h<]h;]h?]uh1h²h+]qÁhZ)qÂ}qÃ(h0X``pkg_add -r varnish``qÄh1h¾h2h5h7h^h9}qÅ(h=]h>]h<]h;]h?]uhAKh+]qÆh¨)qÇ}qÈ(h0hÄh9}qÉ(h=]h>]h<]h;]h?]uh1hÂh+]qÊhVXpkg_add -r varnishqË…qÌ}qÍ(h0Uh1hÇubah7h°ubaubah7h±ubeubeubeubhC)qÎ}qÏ(h0Uh1hDh2h5h7hHh9}qÐ(h=]h>]h<]h;]qÑh&ah?]qÒhauhAKhBhh+]qÓ(hO)qÔ}qÕ(h0X CentOS/RedHatqÖh1hÎh2h5h7hSh9}q×(h=]h>]h<]h;]h?]uhAKhBhh+]qØhVX CentOS/RedHatqÙ…qÚ}qÛ(h0hÖh1hÔubaubhZ)qÜ}qÝ(h0XöWe try to keep the latest version available as prebuilt RPMs (el5) on `repo.varnish-cache.org `. See the `RedHat installation instructions ` for more information.h1hÎh2h5h7h^h9}qÞ(h=]h>]h<]h;]h?]uhAKhBhh+]qß(hVXFWe try to keep the latest version available as prebuilt RPMs (el5) on qà…qá}qâ(h0XFWe try to keep the latest version available as prebuilt RPMs (el5) on h1hÜubcdocutils.nodes title_reference qã)qä}qå(h0X9`repo.varnish-cache.org `h9}qæ(h=]h>]h<]h;]h?]uh1hÜh+]qçhVX7repo.varnish-cache.org qè…qé}qê(h0Uh1häubah7Utitle_referenceqëubhVX . See the qì…qí}qî(h0X . See the h1hÜubhã)qï}qð(h0XU`RedHat installation instructions `h9}qñ(h=]h>]h<]h;]h?]uh1hÜh+]qòhVXSRedHat installation instructions qó…qô}qõ(h0Uh1hïubah7hëubhVX for more information.qö…q÷}qø(h0X for more information.h1hÜubeubhZ)qù}qú(h0XVarnish is included in the `EPEL `_ repository. Unfortunately we had a syntax change in Varnish 2.0.6->2.1.X. This means that we can not update Varnish in `EPEL 5 `_ so the latest version there is Varnish 2.0.6.h1hÎh2h5h7h^h9}qû(h=]h>]h<]h;]h?]uhAK$hBhh+]qü(hVXVarnish is included in the qý…qþ}qÿ(h0XVarnish is included in the h1hùubcdocutils.nodes reference r)r}r(h0X,`EPEL `_h9}r(UnameXEPELUrefurirX"http://fedoraproject.org/wiki/EPELrh;]h<]h=]h>]h?]uh1hùh+]rhVXEPELr…r}r (h0Uh1jubah7U referencer ubh-)r }r (h0X% U referencedr Kh1hùh7h8h9}r(Urefurijh;]rhah<]h=]h>]h?]rhauh+]ubhVXy repository. Unfortunately we had a syntax change in Varnish 2.0.6->2.1.X. This means that we can not update Varnish in r…r}r(h0Xy repository. Unfortunately we had a syntax change in Varnish 2.0.6->2.1.X. This means that we can not update Varnish in h1hùubj)r}r(h0X.`EPEL 5 `_h9}r(UnameXEPEL 5jX"http://fedoraproject.org/wiki/EPELrh;]h<]h=]h>]h?]uh1hùh+]rhVXEPEL 5r…r}r(h0Uh1jubah7j ubh-)r}r(h0X% j Kh1hùh7h8h9}r(Urefurijh;]rh#ah<]h=]h>]h?]r h auh+]ubhVX. so the latest version there is Varnish 2.0.6.r!…r"}r#(h0X. so the latest version there is Varnish 2.0.6.h1hùubeubhZ)r$}r%(h0X9EPEL6 should have Varnish 2.1 available once it releases.r&h1hÎh2h5h7h^h9}r'(h=]h>]h<]h;]h?]uhAK*hBhh+]r(hVX9EPEL6 should have Varnish 2.1 available once it releases.r)…r*}r+(h0j&h1j$ubaubeubhC)r,}r-(h0Uh1hDh2h5h7hHh9}r.(h=]h>]h<]h;]r/h"ah?]r0h auhAK-hBhh+]r1(hO)r2}r3(h0X Debian/Ubuntur4h1j,h2h5h7hSh9}r5(h=]h>]h<]h;]h?]uhAK-hBhh+]r6hVX Debian/Ubuntur7…r8}r9(h0j4h1j2ubaubhZ)r:}r;(h0X–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 installation instructions for `Debian ` or `Ubuntu `.h1j,h2h5h7h^h9}r<(h=]h>]h<]h;]h?]uhAK/hBhh+]r=(hVX`Varnish is distributed with both Debian and Ubuntu. In order to get Varnish up and running type r>…r?}r@(h0X`Varnish is distributed with both Debian and Ubuntu. In order to get Varnish up and running type h1j:ubhã)rA}rB(h0X`sudo apt-get install varnish`h9}rC(h=]h>]h<]h;]h?]uh1j:h+]rDhVXsudo apt-get install varnishrE…rF}rG(h0Uh1jAubah7hëubhVX. Please note that this might not be the latest version of Varnish. If you need a later version of Varnish, please follow the installation instructions for rH…rI}rJ(h0X. Please note that this might not be the latest version of Varnish. If you need a later version of Varnish, please follow the installation instructions for h1j:ubhã)rK}rL(h0X;`Debian `h9}rM(h=]h>]h<]h;]h?]uh1j:h+]rNhVX9Debian rO…rP}rQ(h0Uh1jKubah7hëubhVX or rR…rS}rT(h0X or h1j:ubhã)rU}rV(h0X;`Ubuntu `h9}rW(h=]h>]h<]h;]h?]uh1j:h+]rXhVX9Ubuntu rY…rZ}r[(h0Uh1jUubah7hëubhVX.…r\}r](h0X.h1j:ubeubeubhC)r^}r_(h0Uh1hDh2h5h7hHh9}r`(h=]h>]h<]h;]rah)ah?]rbhauhAK8hBhh+]rc(hO)rd}re(h0X Other systemsrfh1j^h2h5h7hSh9}rg(h=]h>]h<]h;]h?]uhAK8hBhh+]rhhVX Other systemsri…rj}rk(h0jfh1jdubaubhZ)rl}rm(h0XWYou are probably best of compiling your own code. See `Compiling Varnish from source`_.h1j^h2h5h7h^h9}rn(h=]h>]h<]h;]h?]uhAK:hBhh+]ro(hVX6You are probably best of compiling your own code. See rp…rq}rr(h0X6You are probably best of compiling your own code. See h1jlubj)rs}rt(h0X `Compiling Varnish from source`_UresolvedruKh1jlh7j h9}rv(UnameXCompiling Varnish from sourceh;]h<]h=]h>]h?]h@huh+]rwhVXCompiling Varnish from sourcerx…ry}rz(h0Uh1jsubaubhVX.…r{}r|(h0X.h1jlubeubhZ)r}}r~(h0X–If that worked for you, you can skip the rest of this document for now, and and start reading the much more interesting :ref:`tutorial-index` instead.h1j^h2h5h7h^h9}r(h=]h>]h<]h;]h?]uhAK=hBhh+]r€(hVXxIf that worked for you, you can skip the rest of this document for now, and and start reading the much more interesting r…r‚}rƒ(h0XxIf that worked for you, you can skip the rest of this document for now, and and start reading the much more interesting h1j}ubcsphinx.addnodes pending_xref r„)r…}r†(h0X:ref:`tutorial-index`r‡h1j}h2h5h7U pending_xrefrˆh9}r‰(UreftypeXrefUrefwarnrŠˆU reftargetr‹Xtutorial-indexU refdomainXstdrŒh;]h<]U refexplicit‰h=]h>]h?]UrefdocrUinstallation/installrŽuhAK=h+]rcdocutils.nodes emphasis r)r‘}r’(h0j‡h9}r“(h=]h>]r”(Uxrefr•jŒXstd-refr–eh<]h;]h?]uh1j…h+]r—hVXtutorial-indexr˜…r™}rš(h0Uh1j‘ubah7Uemphasisr›ubaubhVX instead.rœ…r}rž(h0X instead.h1j}ubeubeubeubhC)rŸ}r (h0Uj Kh1hh2h5h7hHh9}r¡(h=]h>]h<]h;]r¢hah?]r£hauhAKChBhh+]r¤(hO)r¥}r¦(h0XCompiling Varnish from sourcer§h1jŸh2h5h7hSh9}r¨(h=]h>]h<]h;]h?]uhAKChBhh+]r©hVXCompiling Varnish from sourcerª…r«}r¬(h0j§h1j¥ubaubhZ)r­}r®(h0XIf there are no binary packages available for your system, or if you want to compile Varnish from source for other reasons, follow these steps:r¯h1jŸh2h5h7h^h9}r°(h=]h>]h<]h;]h?]uhAKEhBhh+]r±hVXIf there are no binary packages available for your system, or if you want to compile Varnish from source for other reasons, follow these steps:r²…r³}r´(h0j¯h1j­ubaubhZ)rµ}r¶(h0XƒWe recommend downloading a release tarball, which you can find on `repo.varnish-cache.org `.h1jŸh2h5h7h^h9}r·(h=]h>]h<]h;]h?]uhAKIhBhh+]r¸(hVXBWe recommend downloading a release tarball, which you can find on r¹…rº}r»(h0XBWe recommend downloading a release tarball, which you can find on h1jµubhã)r¼}r½(h0X@`repo.varnish-cache.org `h9}r¾(h=]h>]h<]h;]h?]uh1jµh+]r¿hVX>repo.varnish-cache.org rÀ…rÁ}rÂ(h0Uh1j¼ubah7hëubhVX.…rÃ}rÄ(h0X.h1jµubeubhZ)rÅ}rÆ(h0X\Alternatively, if you want to hack on Varnish, you should clone our git repository by doing.rÇh1jŸh2h5h7h^h9}rÈ(h=]h>]h<]h;]h?]uhAKLhBhh+]rÉhVX\Alternatively, if you want to hack on Varnish, you should clone our git repository by doing.rÊ…rË}rÌ(h0jÇh1jÅubaubcdocutils.nodes block_quote rÍ)rÎ}rÏ(h0Uh1jŸh2h5h7U block_quoterÐh9}rÑ(h=]h>]h<]h;]h?]uhANhBhh+]rÒhZ)rÓ}rÔ(h0X3git clone git://git.varnish-cache.org/varnish-cacherÕh1jÎh2h5h7h^h9}rÖ(h=]h>]h<]h;]h?]uhAKOh+]r×hVX3git clone git://git.varnish-cache.org/varnish-cacherØ…rÙ}rÚ(h0jÕh1jÓubaubaubhZ)rÛ}rÜ(h0X‡Please note that a git checkout will need some more build-dependencies than listed below, in particular the Python Docutils and Sphinx.rÝh1jŸh2h5h7h^h9}rÞ(h=]h>]h<]h;]h?]uhAKQhBhh+]rßhVX‡Please note that a git checkout will need some more build-dependencies than listed below, in particular the Python Docutils and Sphinx.rà…rá}râ(h0jÝh1jÛubaubhC)rã}rä(h0Uh1jŸh2h5h7hHh9}rå(h=]h>]h<]h;]ræh*ah?]rçhauhAKUhBhh+]rè(hO)ré}rê(h0X%Build dependencies on Debian / Ubunturëh1jãh2h5h7hSh9}rì(h=]h>]h<]h;]h?]uhAKUhBhh+]ríhVX%Build dependencies on Debian / Ubunturî…rï}rð(h0jëh1jéubaubhZ)rñ}rò(h0XvIn order to build Varnish from source you need a number of packages installed. On a Debian or Ubuntu system these are:róh1jãh2h5h7h^h9}rô(h=]h>]h<]h;]h?]uhAKWhBhh+]rõhVXvIn order to build Varnish from source you need a number of packages installed. On a Debian or Ubuntu system these are:rö…r÷}rø(h0jóh1jñubaubcdocutils.nodes bullet_list rù)rú}rû(h0Uh1jãh2h5h7U bullet_listrüh9}rý(UbulletrþX*h;]h<]h=]h>]h?]uhAKZhBhh+]rÿ(cdocutils.nodes list_item r)r}r(h0X autotools-devrh1júh2h5h7U list_itemrh9}r(h=]h>]h<]h;]h?]uhANhBhh+]rhZ)r}r(h0jh1jh2h5h7h^h9}r (h=]h>]h<]h;]h?]uhAKZh+]r hVX autotools-devr …r }r (h0jh1jubaubaubj)r}r(h0X automake1.9rh1júh2h5h7jh9}r(h=]h>]h<]h;]h?]uhANhBhh+]rhZ)r}r(h0jh1jh2h5h7h^h9}r(h=]h>]h<]h;]h?]uhAK[h+]rhVX automake1.9r…r}r(h0jh1jubaubaubj)r}r(h0Xlibtoolrh1júh2h5h7jh9}r(h=]h>]h<]h;]h?]uhANhBhh+]rhZ)r}r (h0jh1jh2h5h7h^h9}r!(h=]h>]h<]h;]h?]uhAK\h+]r"hVXlibtoolr#…r$}r%(h0jh1jubaubaubj)r&}r'(h0Xautoconfr(h1júh2h5h7jh9}r)(h=]h>]h<]h;]h?]uhANhBhh+]r*hZ)r+}r,(h0j(h1j&h2h5h7h^h9}r-(h=]h>]h<]h;]h?]uhAK]h+]r.hVXautoconfr/…r0}r1(h0j(h1j+ubaubaubj)r2}r3(h0Xlibncurses-devr4h1júh2h5h7jh9}r5(h=]h>]h<]h;]h?]uhANhBhh+]r6hZ)r7}r8(h0j4h1j2h2h5h7h^h9}r9(h=]h>]h<]h;]h?]uhAK^h+]r:hVXlibncurses-devr;…r<}r=(h0j4h1j7ubaubaubj)r>}r?(h0Xxsltprocr@h1júh2h5h7jh9}rA(h=]h>]h<]h;]h?]uhANhBhh+]rBhZ)rC}rD(h0j@h1j>h2h5h7h^h9}rE(h=]h>]h<]h;]h?]uhAK_h+]rFhVXxsltprocrG…rH}rI(h0j@h1jCubaubaubj)rJ}rK(h0X groff-baserLh1júh2h5h7jh9}rM(h=]h>]h<]h;]h?]uhANhBhh+]rNhZ)rO}rP(h0jLh1jJh2h5h7h^h9}rQ(h=]h>]h<]h;]h?]uhAK`h+]rRhVX groff-baserS…rT}rU(h0jLh1jOubaubaubj)rV}rW(h0X libpcre3-devrXh1júh2h5h7jh9}rY(h=]h>]h<]h;]h?]uhANhBhh+]rZhZ)r[}r\(h0jXh1jVh2h5h7h^h9}r](h=]h>]h<]h;]h?]uhAKah+]r^hVX libpcre3-devr_…r`}ra(h0jXh1j[ubaubaubj)rb}rc(h0X pkg-config h1júh2h5h7jh9}rd(h=]h>]h<]h;]h?]uhANhBhh+]rehZ)rf}rg(h0X pkg-configrhh1jbh2h5h7h^h9}ri(h=]h>]h<]h;]h?]uhAKbh+]rjhVX pkg-configrk…rl}rm(h0jhh1jfubaubaubeubeubhC)rn}ro(h0Uh1jŸh2h5h7hHh9}rp(h=]h>]h<]h;]rqh%ah?]rrhauhAKehBhh+]rs(hO)rt}ru(h0X&Build dependencies on Red Hat / CentOSrvh1jnh2h5h7hSh9}rw(h=]h>]h<]h;]h?]uhAKehBhh+]rxhVX&Build dependencies on Red Hat / CentOSry…rz}r{(h0jvh1jtubaubhZ)r|}r}(h0XYTo build Varnish on a Red Hat or CentOS system you need the following packages installed:r~h1jnh2h5h7h^h9}r(h=]h>]h<]h;]h?]uhAKghBhh+]r€hVXYTo build Varnish on a Red Hat or CentOS system you need the following packages installed:r…r‚}rƒ(h0j~h1j|ubaubjù)r„}r…(h0Uh1jnh2h5h7jüh9}r†(jþX*h;]h<]h=]h>]h?]uhAKjhBhh+]r‡(j)rˆ}r‰(h0XautomakerŠh1j„h2h5h7jh9}r‹(h=]h>]h<]h;]h?]uhANhBhh+]rŒhZ)r}rŽ(h0jŠh1jˆh2h5h7h^h9}r(h=]h>]h<]h;]h?]uhAKjh+]rhVXautomaker‘…r’}r“(h0jŠh1jubaubaubj)r”}r•(h0Xautoconfr–h1j„h2h5h7jh9}r—(h=]h>]h<]h;]h?]uhANhBhh+]r˜hZ)r™}rš(h0j–h1j”h2h5h7h^h9}r›(h=]h>]h<]h;]h?]uhAKkh+]rœhVXautoconfr…rž}rŸ(h0j–h1j™ubaubaubj)r }r¡(h0Xlibtoolr¢h1j„h2h5h7jh9}r£(h=]h>]h<]h;]h?]uhANhBhh+]r¤hZ)r¥}r¦(h0j¢h1j h2h5h7h^h9}r§(h=]h>]h<]h;]h?]uhAKlh+]r¨hVXlibtoolr©…rª}r«(h0j¢h1j¥ubaubaubj)r¬}r­(h0X ncurses-develr®h1j„h2h5h7jh9}r¯(h=]h>]h<]h;]h?]uhANhBhh+]r°hZ)r±}r²(h0j®h1j¬h2h5h7h^h9}r³(h=]h>]h<]h;]h?]uhAKmh+]r´hVX ncurses-develrµ…r¶}r·(h0j®h1j±ubaubaubj)r¸}r¹(h0Xlibxsltrºh1j„h2h5h7jh9}r»(h=]h>]h<]h;]h?]uhANhBhh+]r¼hZ)r½}r¾(h0jºh1j¸h2h5h7h^h9}r¿(h=]h>]h<]h;]h?]uhAKnh+]rÀhVXlibxsltrÁ…rÂ}rÃ(h0jºh1j½ubaubaubj)rÄ}rÅ(h0XgroffrÆh1j„h2h5h7jh9}rÇ(h=]h>]h<]h;]h?]uhANhBhh+]rÈhZ)rÉ}rÊ(h0jÆh1jÄh2h5h7h^h9}rË(h=]h>]h<]h;]h?]uhAKoh+]rÌhVXgroffrÍ…rÎ}rÏ(h0jÆh1jÉubaubaubj)rÐ}rÑ(h0X pcre-develrÒh1j„h2h5h7jh9}rÓ(h=]h>]h<]h;]h?]uhANhBhh+]rÔhZ)rÕ}rÖ(h0jÒh1jÐh2h5h7h^h9}r×(h=]h>]h<]h;]h?]uhAKph+]rØhVX pcre-develrÙ…rÚ}rÛ(h0jÒh1jÕubaubaubj)rÜ}rÝ(h0X pkgconfig h1j„h2h5h7jh9}rÞ(h=]h>]h<]h;]h?]uhANhBhh+]rßhZ)rà}rá(h0X pkgconfigrâh1jÜh2h5h7h^h9}rã(h=]h>]h<]h;]h?]uhAKqh+]rähVX pkgconfigrå…ræ}rç(h0jâh1jàubaubaubeubeubhC)rè}ré(h0Uh1jŸh2h5h7hHh9}rê(h=]h>]h<]h;]rëh$ah?]rìh auhAKthBhh+]rí(hO)rî}rï(h0XConfiguring and compilingrðh1jèh2h5h7hSh9}rñ(h=]h>]h<]h;]h?]uhAKthBhh+]ròhVXConfiguring and compilingró…rô}rõ(h0jðh1jîubaubhZ)rö}r÷(h0XoNext, configuration: The configuration will need the dependencies above satisfied. Once that is taken care of::h1jèh2h5h7h^h9}rø(h=]h>]h<]h;]h?]uhAKvhBhh+]rùhVXnNext, configuration: The configuration will need the dependencies above satisfied. Once that is taken care of:rú…rû}rü(h0XnNext, configuration: The configuration will need the dependencies above satisfied. Once that is taken care of:h1jöubaubcdocutils.nodes literal_block rý)rþ}rÿ(h0X0cd varnish-cache sh autogen.sh sh configure makeh1jèh2h5h7U literal_blockrh9}r(U xml:spacerUpreserverh;]h<]h=]h>]h?]uhAKyhBhh+]rhVX0cd varnish-cache sh autogen.sh sh configure maker…r}r(h0Uh1jþubaubhZ)r}r (h0X¡The ``configure`` script takes some arguments, but more likely than not, you can forget about that for now, almost everything in Varnish are run time parameters.h1jèh2h5h7h^h9}r (h=]h>]h<]h;]h?]uhAK~hBhh+]r (hVXThe r …r }r(h0XThe h1jubh¨)r}r(h0X ``configure``h9}r(h=]h>]h<]h;]h?]uh1jh+]rhVX configurer…r}r(h0Uh1jubah7h°ubhVX script takes some arguments, but more likely than not, you can forget about that for now, almost everything in Varnish are run time parameters.r…r}r(h0X script takes some arguments, but more likely than not, you can forget about that for now, almost everything in Varnish are run time parameters.h1jubeubhZ)r}r(h0XvBefore you install, you may want to run the regression tests, make a cup of tea while it runs, it takes some minutes::h1jèh2h5h7h^h9}r(h=]h>]h<]h;]h?]uhAK‚hBhh+]rhVXuBefore you install, you may want to run the regression tests, make a cup of tea while it runs, it takes some minutes:r…r}r(h0XuBefore you install, you may want to run the regression tests, make a cup of tea while it runs, it takes some minutes:h1jubaubjý)r }r!(h0X make checkh1jèh2h5h7jh9}r"(jjh;]h<]h=]h>]h?]uhAK…hBhh+]r#hVX make checkr$…r%}r&(h0Uh1j ubaubhZ)r'}r((h0X$Don't worry of a single or two tests fail, some of the tests are a bit too timing sensitive (Please tell us which so we can fix it) but if a lot of them fails, and in particular if the ``b00000.vtc`` test fails, something is horribly wrong, and you will get nowhere without figuring out what.h1jèh2h5h7h^h9}r)(h=]h>]h<]h;]h?]uhAK‡hBhh+]r*(hVX¹Don't worry of a single or two tests fail, some of the tests are a bit too timing sensitive (Please tell us which so we can fix it) but if a lot of them fails, and in particular if the r+…r,}r-(h0X¹Don't worry of a single or two tests fail, some of the tests are a bit too timing sensitive (Please tell us which so we can fix it) but if a lot of them fails, and in particular if the h1j'ubh¨)r.}r/(h0X``b00000.vtc``h9}r0(h=]h>]h<]h;]h?]uh1j'h+]r1hVX b00000.vtcr2…r3}r4(h0Uh1j.ubah7h°ubhVX] test fails, something is horribly wrong, and you will get nowhere without figuring out what.r5…r6}r7(h0X] test fails, something is horribly wrong, and you will get nowhere without figuring out what.h1j'ubeubeubhC)r8}r9(h0Uh1jŸh2h5h7hHh9}r:(h=]h>]h<]h;]r;h(ah?]r<hauhAKŽhBhh+]r=(hO)r>}r?(h0X Installingr@h1j8h2h5h7hSh9}rA(h=]h>]h<]h;]h?]uhAKŽhBhh+]rBhVX InstallingrC…rD}rE(h0j@h1j>ubaubhZ)rF}rG(h0X-And finally, the true test of a brave heart::rHh1j8h2h5h7h^h9}rI(h=]h>]h<]h;]h?]uhAKhBhh+]rJhVX,And finally, the true test of a brave heart:rK…rL}rM(h0X,And finally, the true test of a brave heart:h1jFubaubjý)rN}rO(h0X make installh1j8h2h5h7jh9}rP(jjh;]h<]h=]h>]h?]uhAK’hBhh+]rQhVX make installrR…rS}rT(h0Uh1jNubaubhZ)rU}rV(h0X©Varnish will now be installed in /usr/local. The varnishd binary is in /usr/local/sbin/varnishd and its default configuration will be /usr/local/etc/varnish/default.vcl.rWh1j8h2h5h7h^h9}rX(h=]h>]h<]h;]h?]uhAK”hBhh+]rYhVX©Varnish will now be installed in /usr/local. The varnishd binary is in /usr/local/sbin/varnishd and its default configuration will be /usr/local/etc/varnish/default.vcl.rZ…r[}r\(h0jWh1jUubaubhZ)r]}r^(h0X1You can now proceed to the :ref:`tutorial-index`.r_h1j8h2h5h7h^h9}r`(h=]h>]h<]h;]h?]uhAK˜hBhh+]ra(hVXYou can now proceed to the rb…rc}rd(h0XYou can now proceed to the h1j]ubj„)re}rf(h0X:ref:`tutorial-index`rgh1j]h2h5h7jˆh9}rh(UreftypeXrefjŠˆj‹Xtutorial-indexU refdomainXstdrih;]h<]U refexplicit‰h=]h>]h?]jjŽuhAK˜h+]rjj)rk}rl(h0jgh9}rm(h=]h>]rn(j•jiXstd-refroeh<]h;]h?]uh1jeh+]rphVXtutorial-indexrq…rr}rs(h0Uh1jkubah7j›ubaubhVX.…rt}ru(h0X.h1j]ubeubeubeubeh0UU transformerrvNU footnote_refsrw}rxUrefnamesry}rzXcompiling varnish from source]r{jsasUsymbol_footnotesr|]r}Uautofootnote_refsr~]rUsymbol_footnote_refsr€]rU citationsr‚]rƒhBhU current_liner„NUtransform_messagesr…]r†cdocutils.nodes system_message r‡)rˆ}r‰(h0Uh9}rŠ(h=]UlevelKh;]h<]Usourceh5h>]h?]UlineKUtypeUINFOr‹uh+]rŒhZ)r}rŽ(h0Uh9}r(h=]h>]h<]h;]h?]uh1jˆh+]rhVX1Hyperlink target "install-doc" is not referenced.r‘…r’}r“(h0Uh1jubah7h^ubah7Usystem_messager”ubaUreporterr•NUid_startr–KU autofootnotesr—]r˜U citation_refsr™}ršUindirect_targetsr›]rœUsettingsr(cdocutils.frontend Values ržorŸ}r (Ufootnote_backlinksr¡KUrecord_dependenciesr¢NU rfc_base_urlr£Uhttp://tools.ietf.org/html/r¤U tracebackr¥ˆUpep_referencesr¦NUstrip_commentsr§NU toc_backlinksr¨Uentryr©U language_coderªUenr«U datestampr¬NU report_levelr­KU _destinationr®NU halt_levelr¯KU strip_classesr°NhSNUerror_encoding_error_handlerr±Ubackslashreplacer²Udebugr³NUembed_stylesheetr´‰Uoutput_encoding_error_handlerrµUstrictr¶U sectnum_xformr·KUdump_transformsr¸NU docinfo_xformr¹KUwarning_streamrºNUpep_file_url_templater»Upep-%04dr¼Uexit_status_levelr½KUconfigr¾NUstrict_visitorr¿NUcloak_email_addressesrÀˆUtrim_footnote_reference_spacerÁ‰UenvrÂNUdump_pseudo_xmlrÃNUexpose_internalsrÄNUsectsubtitle_xformrʼnU source_linkrÆNUrfc_referencesrÇNUoutput_encodingrÈUutf-8rÉU source_urlrÊNUinput_encodingrËU utf-8-sigrÌU_disable_configrÍNU id_prefixrÎUU tab_widthrÏKUerror_encodingrÐUUTF-8rÑU_sourcerÒU8/home/tfheen/varnish/doc/sphinx/installation/install.rstrÓUgettext_compactrÔˆU generatorrÕNUdump_internalsrÖNU smart_quotesr׉U pep_base_urlrØUhttp://www.python.org/dev/peps/rÙUsyntax_highlightrÚUlongrÛUinput_encoding_error_handlerrÜj¶Uauto_id_prefixrÝUidrÞUdoctitle_xformr߉Ustrip_elements_with_classesràNU _config_filesrá]Ufile_insertion_enabledrâKU raw_enabledrãKU dump_settingsräNubUsymbol_footnote_startråKUidsræ}rç(hj h#jhjŸh$jèh"j,h(j8h!hDh&hÎhhzh'hDh hdh)j^h%jnh*jãuUsubstitution_namesrè}réh7hBh9}rê(h=]h;]h<]Usourceh5h>]h?]uU footnotesrë]rìUrefidsrí}rîh']rïh.asub.varnish-3.0.5/doc/sphinx/=build/doctrees/installation/prerequisites.doctree0000644000175000017500000001146012247037213024153 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}qX prerequisitesqNsUsubstitution_defsq}qUparse_messagesq ]q Ucurrent_sourceq NU decorationq NUautofootnote_startq KUnameidsq}qhU prerequisitesqsUchildrenq]qcdocutils.nodes section q)q}q(U rawsourceqUUparentqhUsourceqcdocutils.nodes reprunicode qX>/home/tfheen/varnish/doc/sphinx/installation/prerequisites.rstq…q}qbUtagnameqUsectionqU attributesq}q (Udupnamesq!]Uclassesq"]Ubackrefsq#]Uidsq$]q%haUnamesq&]q'hauUlineq(KUdocumentq)hh]q*(cdocutils.nodes title q+)q,}q-(hX Prerequisitesq.hhhhhUtitleq/h}q0(h!]h"]h#]h$]h&]uh(Kh)hh]q1cdocutils.nodes Text q2X Prerequisitesq3…q4}q5(hh.hh,ubaubcdocutils.nodes paragraph q6)q7}q8(hX@In order for you to install Varnish you must have the following:q9hhhhhU paragraphq:h}q;(h!]h"]h#]h$]h&]uh(Kh)hh]q}q?(hh9hh7ubaubcdocutils.nodes block_quote q@)qA}qB(hUhhhNhU block_quoteqCh}qD(h!]h"]h#]h$]h&]uh(Nh)hh]qEcdocutils.nodes bullet_list qF)qG}qH(hUh}qI(UbulletqJX*h$]h#]h!]h"]h&]uhhAh]qK(cdocutils.nodes list_item qL)qM}qN(hXHA fairly modern and 64 bit version of either - Linux - FreeBSD - Solarish}qO(h!]h"]h#]h$]h&]uhhGh]qPh6)qQ}qR(hXHA fairly modern and 64 bit version of either - Linux - FreeBSD - SolarisqShhMhhhh:h}qT(h!]h"]h#]h$]h&]uh(Kh]qUh2XHA fairly modern and 64 bit version of either - Linux - FreeBSD - SolarisqV…qW}qX(hhShhQubaubahU list_itemqYubhL)qZ}q[(hXroot access to said system h}q\(h!]h"]h#]h$]h&]uhhGh]q]h6)q^}q_(hXroot access to said systemq`hhZhhhh:h}qa(h!]h"]h#]h$]h&]uh(K h]qbh2Xroot access to said systemqc…qd}qe(hh`hh^ubaubahhYubehU bullet_listqfubaubh6)qg}qh(hX£Varnish can be installed on other UNIX systems as well, but it is not tested particularly well on these plattforms. Varnish is, from time to time, said to work on:qihhhhhh:h}qj(h!]h"]h#]h$]h&]uh(Kh)hh]qkh2X£Varnish can be installed on other UNIX systems as well, but it is not tested particularly well on these plattforms. Varnish is, from time to time, said to work on:ql…qm}qn(hhihhgubaubh@)qo}qp(hUhhhNhhCh}qq(h!]h"]h#]h$]h&]uh(Nh)hh]qrhF)qs}qt(hUh}qu(hJX*h$]h#]h!]h"]h&]uhhoh]qv(hL)qw}qx(hX032 bit versions of the before-mentioned systems.qyh}qz(h!]h"]h#]h$]h&]uhhsh]q{h6)q|}q}(hhyhhwhhhh:h}q~(h!]h"]h#]h$]h&]uh(Kh]qh2X032 bit versions of the before-mentioned systems.q€…q}q‚(hhyhh|ubaubahhYubhL)qƒ}q„(hXOS Xq…h}q†(h!]h"]h#]h$]h&]uhhsh]q‡h6)qˆ}q‰(hh…hhƒhhhh:h}qŠ(h!]h"]h#]h$]h&]uh(Kh]q‹h2XOS XqŒ…q}qŽ(hh…hhˆubaubahhYubhL)q}q(hXNetBSDq‘h}q’(h!]h"]h#]h$]h&]uhhsh]q“h6)q”}q•(hh‘hhhhhh:h}q–(h!]h"]h#]h$]h&]uh(Kh]q—h2XNetBSDq˜…q™}qš(hh‘hh”ubaubahhYubhL)q›}qœ(hXOpenBSD h}q(h!]h"]h#]h$]h&]uhhsh]qžh6)qŸ}q (hXOpenBSDq¡hh›hhhh:h}q¢(h!]h"]h#]h$]h&]uh(Kh]q£h2XOpenBSDq¤…q¥}q¦(hh¡hhŸubaubahhYubehhfubaubeubahUU transformerq§NU footnote_refsq¨}q©Urefnamesqª}q«Usymbol_footnotesq¬]q­Uautofootnote_refsq®]q¯Usymbol_footnote_refsq°]q±U citationsq²]q³h)hU current_lineq´NUtransform_messagesqµ]q¶Ureporterq·NUid_startq¸KU autofootnotesq¹]qºU citation_refsq»}q¼Uindirect_targetsq½]q¾Usettingsq¿(cdocutils.frontend Values qÀoqÁ}qÂ(Ufootnote_backlinksqÃKUrecord_dependenciesqÄNU rfc_base_urlqÅUhttp://tools.ietf.org/html/qÆU tracebackqLjUpep_referencesqÈNUstrip_commentsqÉNU toc_backlinksqÊUentryqËU language_codeqÌUenqÍU datestampqÎNU report_levelqÏKU _destinationqÐNU halt_levelqÑKU strip_classesqÒNh/NUerror_encoding_error_handlerqÓUbackslashreplaceqÔUdebugqÕNUembed_stylesheetqÖ‰Uoutput_encoding_error_handlerq×UstrictqØU sectnum_xformqÙKUdump_transformsqÚNU docinfo_xformqÛKUwarning_streamqÜNUpep_file_url_templateqÝUpep-%04dqÞUexit_status_levelqßKUconfigqàNUstrict_visitorqáNUcloak_email_addressesqâˆUtrim_footnote_reference_spaceqã‰UenvqäNUdump_pseudo_xmlqåNUexpose_internalsqæNUsectsubtitle_xformqç‰U source_linkqèNUrfc_referencesqéNUoutput_encodingqêUutf-8qëU source_urlqìNUinput_encodingqíU utf-8-sigqîU_disable_configqïNU id_prefixqðUU tab_widthqñKUerror_encodingqòUUTF-8qóU_sourceqôU>/home/tfheen/varnish/doc/sphinx/installation/prerequisites.rstqõUgettext_compactqöˆU generatorq÷NUdump_internalsqøNU smart_quotesqù‰U pep_base_urlqúUhttp://www.python.org/dev/peps/qûUsyntax_highlightqüUlongqýUinput_encoding_error_handlerqþhØUauto_id_prefixqÿUidrUdoctitle_xformr‰Ustrip_elements_with_classesrNU _config_filesr]rUfile_insertion_enabledrKU raw_enabledrKU dump_settingsrNubUsymbol_footnote_startrKUidsr }r hhsUsubstitution_namesr }r hh)h}r (h!]h$]h#]Usourcehh"]h&]uU footnotesr]rUrefidsr}rub.varnish-3.0.5/doc/sphinx/=build/doctrees/index.doctree0000644000175000017500000001505612247037213017662 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(X#welcome to varnish's documentation!qNXindices and tablesqNuUsubstitution_defsq}q Uparse_messagesq ]q Ucurrent_sourceq NU decorationq NUautofootnote_startqKUnameidsq}q(hU"welcome-to-varnish-s-documentationqhUindices-and-tablesquUchildrenq]q(cdocutils.nodes comment q)q}q(U rawsourceqX\Varnish documentation master file, created by sphinx-quickstart on Tue Apr 20 13:02:15 2010.UparentqhUsourceqcdocutils.nodes reprunicode qX)/home/tfheen/varnish/doc/sphinx/index.rstq…q}qbUtagnameqUcommentq U attributesq!}q"(U xml:spaceq#Upreserveq$Uidsq%]Ubackrefsq&]Udupnamesq']Uclassesq(]Unamesq)]uUlineq*KUdocumentq+hh]q,cdocutils.nodes Text q-X\Varnish documentation master file, created by sphinx-quickstart on Tue Apr 20 13:02:15 2010.q.…q/}q0(hUhhubaubcdocutils.nodes section q1)q2}q3(hUhhhhhUsectionq4h!}q5(h']h(]h&]h%]q6hah)]q7hauh*Kh+hh]q8(cdocutils.nodes title q9)q:}q;(hX#Welcome to Varnish's documentation!q(h']h(]h&]h%]h)]uh*Kh+hh]q?h-X#Welcome to Varnish's documentation!q@…qA}qB(hhUU tab_widthr?KUerror_encodingr@UUTF-8rAU_sourcerBU)/home/tfheen/varnish/doc/sphinx/index.rstrCUgettext_compactrDˆU generatorrENUdump_internalsrFNU smart_quotesrG‰U pep_base_urlrHUhttp://www.python.org/dev/peps/rIUsyntax_highlightrJUlongrKUinput_encoding_error_handlerrLj&Uauto_id_prefixrMUidrNUdoctitle_xformrO‰Ustrip_elements_with_classesrPNU _config_filesrQ]Ufile_insertion_enabledrRKU raw_enabledrSKU dump_settingsrTNubUsymbol_footnote_startrUKUidsrV}rW(hh¨hh2uUsubstitution_namesrX}rYhh+h!}rZ(h']h%]h&]Usourcehh(]h)]uU footnotesr[]r\Urefidsr]}r^ub.varnish-3.0.5/doc/sphinx/=build/doctrees/reference/0000755000175000017500000000000012247037213017213 500000000000000varnish-3.0.5/doc/sphinx/=build/doctrees/reference/varnishncsa.doctree0000644000175000017500000011356512247037213023034 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(X descriptionqNX copyrightqNXsynopsisqNX varnishncsaq NX9display varnish logs in apache / ncsa combined log formatq NXsee alsoq NXhistoryq NuUsubstitution_defsq }qUparse_messagesq]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hU descriptionqhU copyrightqhUsynopsisqh U varnishncsaqh U7display-varnish-logs-in-apache-ncsa-combined-log-formatqh Usee-alsoqh UhistoryquUchildrenq]qcdocutils.nodes section q)q }q!(U rawsourceq"UUparentq#hUsourceq$cdocutils.nodes reprunicode q%X9/home/tfheen/varnish/doc/sphinx/reference/varnishncsa.rstq&…q'}q(bUtagnameq)Usectionq*U attributesq+}q,(Udupnamesq-]Uclassesq.]Ubackrefsq/]Uidsq0]q1haUnamesq2]q3h auUlineq4KUdocumentq5hh]q6(cdocutils.nodes title q7)q8}q9(h"X varnishncsaq:h#h h$h'h)Utitleq;h+}q<(h-]h.]h/]h0]h2]uh4Kh5hh]q=cdocutils.nodes Text q>X varnishncsaq?…q@}qA(h"h:h#h8ubaubh)qB}qC(h"Uh#h h$h'h)h*h+}qD(h-]h.]h/]h0]qEhah2]qFh auh4Kh5hh]qG(h7)qH}qI(h"X9Display Varnish logs in Apache / NCSA combined log formatqJh#hBh$h'h)h;h+}qK(h-]h.]h/]h0]h2]uh4Kh5hh]qLh>X9Display Varnish logs in Apache / NCSA combined log formatqM…qN}qO(h"hJh#hHubaubcdocutils.nodes field_list qP)qQ}qR(h"Uh#hBh$h'h)U field_listqSh+}qT(h-]h.]h/]h0]h2]uh4K h5hh]qU(cdocutils.nodes field qV)qW}qX(h"Uh#hQh$h'h)UfieldqYh+}qZ(h-]h.]h/]h0]h2]uh4K h5hh]q[(cdocutils.nodes field_name q\)q]}q^(h"XAuthorq_h+}q`(h-]h.]h/]h0]h2]uh#hWh]qah>XAuthorqb…qc}qd(h"h_h#h]ubah)U field_nameqeubcdocutils.nodes field_body qf)qg}qh(h"XDag-Erling Smørgravqih+}qj(h-]h.]h/]h0]h2]uh#hWh]qkcdocutils.nodes paragraph ql)qm}qn(h"hih#hgh$h'h)U paragraphqoh+}qp(h-]h.]h/]h0]h2]uh4K h]qqh>XDag-Erling Smørgravqr…qs}qt(h"hih#hmubaubah)U field_bodyquubeubhV)qv}qw(h"Uh#hQh$h'h)hYh+}qx(h-]h.]h/]h0]h2]uh4K h5hh]qy(h\)qz}q{(h"XDateq|h+}q}(h-]h.]h/]h0]h2]uh#hvh]q~h>XDateq…q€}q(h"h|h#hzubah)heubhf)q‚}qƒ(h"X 2010-05-31q„h+}q…(h-]h.]h/]h0]h2]uh#hvh]q†hl)q‡}qˆ(h"h„h#h‚h$h'h)hoh+}q‰(h-]h.]h/]h0]h2]uh4K h]qŠh>X 2010-05-31q‹…qŒ}q(h"h„h#h‡ubaubah)huubeubhV)qŽ}q(h"Uh#hQh$h'h)hYh+}q(h-]h.]h/]h0]h2]uh4K h5hh]q‘(h\)q’}q“(h"XVersionq”h+}q•(h-]h.]h/]h0]h2]uh#hŽh]q–h>XVersionq—…q˜}q™(h"h”h#h’ubah)heubhf)qš}q›(h"X1.0qœh+}q(h-]h.]h/]h0]h2]uh#hŽh]qžhl)qŸ}q (h"hœh#hšh$h'h)hoh+}q¡(h-]h.]h/]h0]h2]uh4K h]q¢h>X1.0q£…q¤}q¥(h"hœh#hŸubaubah)huubeubhV)q¦}q§(h"Uh#hQh$h'h)hYh+}q¨(h-]h.]h/]h0]h2]uh4K h5hh]q©(h\)qª}q«(h"XManual sectionq¬h+}q­(h-]h.]h/]h0]h2]uh#h¦h]q®h>XManual sectionq¯…q°}q±(h"h¬h#hªubah)heubhf)q²}q³(h"X1 h+}q´(h-]h.]h/]h0]h2]uh#h¦h]qµhl)q¶}q·(h"X1h#h²h$h'h)hoh+}q¸(h-]h.]h/]h0]h2]uh4K h]q¹h>X1…qº}q»(h"X1h#h¶ubaubah)huubeubeubh)q¼}q½(h"Uh#hBh$h'h)h*h+}q¾(h-]h.]h/]h0]q¿hah2]qÀhauh4Kh5hh]qÁ(h7)qÂ}qÃ(h"XSYNOPSISqÄh#h¼h$h'h)h;h+}qÅ(h-]h.]h/]h0]h2]uh4Kh5hh]qÆh>XSYNOPSISqÇ…qÈ}qÉ(h"hÄh#hÂubaubhl)qÊ}qË(h"X varnishncsa [-a] [-C] [-D] [-d] [-f] [-F format] [-I regex] [-i tag] [-n varnish_name] [-m tag:regex ...] [-P file] [-r file] [-V] [-w file] [-X regex] [-x tag]h#h¼h$h'h)hoh+}qÌ(h-]h.]h/]h0]h2]uh4Kh5hh]qÍ(h>X[varnishncsa [-a] [-C] [-D] [-d] [-f] [-F format] [-I regex] [-i tag] [-n varnish_name] [-m qÎ…qÏ}qÐ(h"X[varnishncsa [-a] [-C] [-D] [-d] [-f] [-F format] [-I regex] [-i tag] [-n varnish_name] [-m h#hÊubcdocutils.nodes reference qÑ)qÒ}qÓ(h"X tag:regexqÔh+}qÕ(UrefurihÔh0]h/]h-]h.]h2]uh#hÊh]qÖh>X tag:regexq×…qØ}qÙ(h"Uh#hÒubah)U referenceqÚubh>X< ...] [-P file] [-r file] [-V] [-w file] [-X regex] [-x tag]qÛ…qÜ}qÝ(h"X< ...] [-P file] [-r file] [-V] [-w file] [-X regex] [-x tag]h#hÊubeubeubh)qÞ}qß(h"Uh#hBh$h'h)h*h+}qà(h-]h.]h/]h0]qáhah2]qâhauh4Kh5hh]qã(h7)qä}qå(h"X DESCRIPTIONqæh#hÞh$h'h)h;h+}qç(h-]h.]h/]h0]h2]uh4Kh5hh]qèh>X DESCRIPTIONqé…qê}që(h"hæh#häubaubhl)qì}qí(h"XzThe varnishncsa utility reads varnishd(1) shared memory logs and presents them in the Apache / NCSA "combined" log format.qîh#hÞh$h'h)hoh+}qï(h-]h.]h/]h0]h2]uh4Kh5hh]qðh>XzThe varnishncsa utility reads varnishd(1) shared memory logs and presents them in the Apache / NCSA "combined" log format.qñ…qò}qó(h"hîh#hìubaubhl)qô}qõ(h"X$The following options are available:qöh#hÞh$h'h)hoh+}q÷(h-]h.]h/]h0]h2]uh4Kh5hh]qøh>X$The following options are available:qù…qú}qû(h"höh#hôubaubcdocutils.nodes option_list qü)qý}qþ(h"Uh#hÞh$h'h)U option_listqÿh+}r(h-]h.]h/]h0]h2]uh4Nh5hh]r(cdocutils.nodes option_list_item r)r}r(h"Uh#hýh$h'h)Uoption_list_itemrh+}r(h-]h.]h/]h0]h2]uh4Nh5hh]r(cdocutils.nodes option_group r)r }r (h"Uh+}r (h-]h.]h/]h0]h2]uh#jh]r cdocutils.nodes option r )r}r(h"X-arh+}r(h-]h.]h/]h0]h2]uh#j h]rcdocutils.nodes option_string r)r}r(h"jh+}r(h-]h.]h/]h0]h2]uh#jh]rh>X-ar…r}r(h"Uh#jubah)U option_stringrubah)Uoptionrubah)U option_grouprubcdocutils.nodes description r)r}r (h"X?When writing to a file, append to it rather than overwrite it. h+}r!(h-]h.]h/]h0]h2]uh#jh]r"hl)r#}r$(h"X>When writing to a file, append to it rather than overwrite it.r%h#jh$h'h)hoh+}r&(h-]h.]h/]h0]h2]uh4Kh]r'h>X>When writing to a file, append to it rather than overwrite it.r(…r)}r*(h"j%h#j#ubaubah)U descriptionr+ubeubj)r,}r-(h"Uh#hýh$h'h)jh+}r.(h-]h.]h/]h0]h2]uh4Nh5hh]r/(j)r0}r1(h"Uh+}r2(h-]h.]h/]h0]h2]uh#j,h]r3j )r4}r5(h"X-Cr6h+}r7(h-]h.]h/]h0]h2]uh#j0h]r8j)r9}r:(h"j6h+}r;(h-]h.]h/]h0]h2]uh#j4h]r<h>X-Cr=…r>}r?(h"Uh#j9ubah)jubah)jubah)jubj)r@}rA(h"X/Ignore case when matching regular expressions. h+}rB(h-]h.]h/]h0]h2]uh#j,h]rChl)rD}rE(h"X.Ignore case when matching regular expressions.rFh#j@h$h'h)hoh+}rG(h-]h.]h/]h0]h2]uh4K!h]rHh>X.Ignore case when matching regular expressions.rI…rJ}rK(h"jFh#jDubaubah)j+ubeubj)rL}rM(h"Uh#hýh$h'h)jh+}rN(h-]h.]h/]h0]h2]uh4Nh5hh]rO(j)rP}rQ(h"Uh+}rR(h-]h.]h/]h0]h2]uh#jLh]rSj )rT}rU(h"X-DrVh+}rW(h-]h.]h/]h0]h2]uh#jPh]rXj)rY}rZ(h"jVh+}r[(h-]h.]h/]h0]h2]uh#jTh]r\h>X-Dr]…r^}r_(h"Uh#jYubah)jubah)jubah)jubj)r`}ra(h"X Daemonize. h+}rb(h-]h.]h/]h0]h2]uh#jLh]rchl)rd}re(h"X Daemonize.rfh#j`h$h'h)hoh+}rg(h-]h.]h/]h0]h2]uh4K#h]rhh>X Daemonize.ri…rj}rk(h"jfh#jdubaubah)j+ubeubj)rl}rm(h"Uh#hýh$h'h)jh+}rn(h-]h.]h/]h0]h2]uh4Nh5hh]ro(j)rp}rq(h"Uh+}rr(h-]h.]h/]h0]h2]uh#jlh]rsj )rt}ru(h"X-drvh+}rw(h-]h.]h/]h0]h2]uh#jph]rxj)ry}rz(h"jvh+}r{(h-]h.]h/]h0]h2]uh#jth]r|h>X-dr}…r~}r(h"Uh#jyubah)jubah)jubah)jubj)r€}r(h"XƒProcess old log entries on startup. Normally, varnishncsa will only process entries which are written to the log after it starts. h+}r‚(h-]h.]h/]h0]h2]uh#jlh]rƒhl)r„}r…(h"X‚Process old log entries on startup. Normally, varnishncsa will only process entries which are written to the log after it starts.r†h#j€h$h'h)hoh+}r‡(h-]h.]h/]h0]h2]uh4K%h]rˆh>X‚Process old log entries on startup. Normally, varnishncsa will only process entries which are written to the log after it starts.r‰…rŠ}r‹(h"j†h#j„ubaubah)j+ubeubj)rŒ}r(h"Uh#hýh$h'h)jh+}rŽ(h-]h.]h/]h0]h2]uh4Nh5hh]r(j)r}r‘(h"Uh+}r’(h-]h.]h/]h0]h2]uh#jŒh]r“j )r”}r•(h"X-fr–h+}r—(h-]h.]h/]h0]h2]uh#jh]r˜j)r™}rš(h"j–h+}r›(h-]h.]h/]h0]h2]uh#j”h]rœh>X-fr…rž}rŸ(h"Uh#j™ubah)jubah)jubah)jubj)r }r¡(h"XIPrefer the X-Forwarded-For HTTP header over client.ip in the log output. h+}r¢(h-]h.]h/]h0]h2]uh#jŒh]r£hl)r¤}r¥(h"XHPrefer the X-Forwarded-For HTTP header over client.ip in the log output.r¦h#j h$h'h)hoh+}r§(h-]h.]h/]h0]h2]uh4K)h]r¨h>XHPrefer the X-Forwarded-For HTTP header over client.ip in the log output.r©…rª}r«(h"j¦h#j¤ubaubah)j+ubeubj)r¬}r­(h"Uh#hýh$h'h)jh+}r®(h-]h.]h/]h0]h2]uh4Nh5hh]r¯(j)r°}r±(h"Uh+}r²(h-]h.]h/]h0]h2]uh#j¬h]r³j )r´}rµ(h"X -F formath+}r¶(h-]h.]h/]h0]h2]uh#j°h]r·(j)r¸}r¹(h"X-Fh+}rº(h-]h.]h/]h0]h2]uh#j´h]r»h>X-Fr¼…r½}r¾(h"Uh#j¸ubah)jubcdocutils.nodes option_argument r¿)rÀ}rÁ(h"Xformath+}rÂ(h0]h/]h-]U delimiterU h.]h2]uh#j´h]rÃh>XformatrÄ…rÅ}rÆ(h"Uh#jÀubah)Uoption_argumentrÇubeh)jubah)jubj)rÈ}rÉ(h"XSpecify the log format used. If no format is specified the default log format is used. Currently it 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. %H The request protocol. Defaults to HTTP/1.0 if not known. %h Remote host. Defaults to '-' if not known. Defaults to 127.0.0.1 for backend requests. %{X}i The contents of request header X. %l Remote logname (always '-') %m Request method. Defaults to '-' if not known. %q The query string, if no query string exists, an empty string. %{X}o The contents of response header X. %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). %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 to the first byte from the backend arrived 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 error. VCL_Log:key Output value set by std.log("key:value") in VCL. h+}rÊ(h-]h.]h/]h0]h2]uh#j¬h]rË(hl)rÌ}rÍ(h"XgSpecify the log format used. If no format is specified the default log format is used. Currently it is:rÎh#jÈh$h'h)hoh+}rÏ(h-]h.]h/]h0]h2]uh4K,h]rÐh>XgSpecify the log format used. If no format is specified the default log format is used. Currently it is:rÑ…rÒ}rÓ(h"jÎh#jÌubaubhl)rÔ}rÕ(h"X5%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-agent}i"rÖh#jÈh$h'h)hoh+}r×(h-]h.]h/]h0]h2]uh4K/h]rØh>X5%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-agent}i"rÙ…rÚ}rÛ(h"jÖh#jÔubaubhl)rÜ}rÝ(h"X+Escape sequences \\n and \\t are supported.rÞh#jÈh$h'h)hoh+}rß(h-]h.]h/]h0]h2]uh4K1h]ràh>X)Escape sequences \n and \t are supported.rá…râ}rã(h"X+Escape sequences \\n and \\t are supported.h#jÜubaubhl)rä}rå(h"XSupported formatters are:ræh#jÈh$h'h)hoh+}rç(h-]h.]h/]h0]h2]uh4K3h]rèh>XSupported formatters are:ré…rê}rë(h"jæh#jäubaubcdocutils.nodes block_quote rì)rí}rî(h"Uh+}rï(h-]h.]h/]h0]h2]uh#jÈh]rðcdocutils.nodes definition_list rñ)rò}ró(h"Uh+}rô(h-]h.]h/]h0]h2]uh#jíh]rõ(cdocutils.nodes definition_list_item rö)r÷}rø(h"Xx%b Size of response in bytes, excluding HTTP headers. In CLF format, i.e. a '-' rather than a 0 when no bytes are sent. h#jòh$h'h)Udefinition_list_itemrùh+}rú(h-]h.]h/]h0]h2]uh4K8h]rû(cdocutils.nodes term rü)rý}rþ(h"X%brÿh#j÷h$h'h)Utermrh+}r(h-]h.]h/]h0]h2]uh4K8h]rh>X%br…r}r(h"jÿh#jýubaubcdocutils.nodes definition r)r}r(h"Uh+}r (h-]h.]h/]h0]h2]uh#j÷h]r hl)r }r (h"XtSize of response in bytes, excluding HTTP headers. In CLF format, i.e. a '-' rather than a 0 when no bytes are sent.r h#jh$h'h)hoh+}r(h-]h.]h/]h0]h2]uh4K6h]rh>XtSize of response in bytes, excluding HTTP headers. In CLF format, i.e. a '-' rather than a 0 when no bytes are sent.r…r}r(h"j h#j ubaubah)U definitionrubeubjö)r}r(h"X<%H The request protocol. Defaults to HTTP/1.0 if not known. h#jòh$h'h)jùh+}r(h-]h.]h/]h0]h2]uh4KX%Hr…r}r(h"jh#jubaubj)r }r!(h"Uh+}r"(h-]h.]h/]h0]h2]uh#jh]r#hl)r$}r%(h"X8The request protocol. Defaults to HTTP/1.0 if not known.r&h#j h$h'h)hoh+}r'(h-]h.]h/]h0]h2]uh4K;h]r(h>X8The request protocol. Defaults to HTTP/1.0 if not known.r)…r*}r+(h"j&h#j$ubaubah)jubeubjö)r,}r-(h"XZ%h Remote host. Defaults to '-' if not known. Defaults to 127.0.0.1 for backend requests. h#jòh$h'h)jùh+}r.(h-]h.]h/]h0]h2]uh4K@h]r/(jü)r0}r1(h"X%hr2h#j,h$h'h)jh+}r3(h-]h.]h/]h0]h2]uh4K@h]r4h>X%hr5…r6}r7(h"j2h#j0ubaubj)r8}r9(h"Uh+}r:(h-]h.]h/]h0]h2]uh#j,h]r;hl)r<}r=(h"XVRemote host. Defaults to '-' if not known. Defaults to 127.0.0.1 for backend requests.r>h#j8h$h'h)hoh+}r?(h-]h.]h/]h0]h2]uh4K?h]r@h>XVRemote host. Defaults to '-' if not known. Defaults to 127.0.0.1 for backend requests.rA…rB}rC(h"j>h#j<ubaubah)jubeubjö)rD}rE(h"X(%{X}i The contents of request header X. h#jòh$h'h)jùh+}rF(h-]h.]h/]h0]h2]uh4KCh]rG(jü)rH}rI(h"X%{X}irJh#jDh$h'h)jh+}rK(h-]h.]h/]h0]h2]uh4KCh]rLh>X%{X}irM…rN}rO(h"jJh#jHubaubj)rP}rQ(h"Uh+}rR(h-]h.]h/]h0]h2]uh#jDh]rShl)rT}rU(h"X!The contents of request header X.rVh#jPh$h'h)hoh+}rW(h-]h.]h/]h0]h2]uh4KCh]rXh>X!The contents of request header X.rY…rZ}r[(h"jVh#jTubaubah)jubeubjö)r\}r](h"X%l Remote logname (always '-') h#jòh$h'h)jùh+}r^(h-]h.]h/]h0]h2]uh4KFh]r_(jü)r`}ra(h"X%lrbh#j\h$h'h)jh+}rc(h-]h.]h/]h0]h2]uh4KFh]rdh>X%lre…rf}rg(h"jbh#j`ubaubj)rh}ri(h"Uh+}rj(h-]h.]h/]h0]h2]uh#j\h]rkhl)rl}rm(h"XRemote logname (always '-')rnh#jhh$h'h)hoh+}ro(h-]h.]h/]h0]h2]uh4KFh]rph>XRemote logname (always '-')rq…rr}rs(h"jnh#jlubaubah)jubeubjö)rt}ru(h"X1%m Request method. Defaults to '-' if not known. h#jòh$h'h)jùh+}rv(h-]h.]h/]h0]h2]uh4KIh]rw(jü)rx}ry(h"X%mrzh#jth$h'h)jh+}r{(h-]h.]h/]h0]h2]uh4KIh]r|h>X%mr}…r~}r(h"jzh#jxubaubj)r€}r(h"Uh+}r‚(h-]h.]h/]h0]h2]uh#jth]rƒhl)r„}r…(h"X-Request method. Defaults to '-' if not known.r†h#j€h$h'h)hoh+}r‡(h-]h.]h/]h0]h2]uh4KIh]rˆh>X-Request method. Defaults to '-' if not known.r‰…rŠ}r‹(h"j†h#j„ubaubah)jubeubjö)rŒ}r(h"XA%q The query string, if no query string exists, an empty string. h#jòh$h'h)jùh+}rŽ(h-]h.]h/]h0]h2]uh4KMh]r(jü)r}r‘(h"X%qr’h#jŒh$h'h)jh+}r“(h-]h.]h/]h0]h2]uh4KMh]r”h>X%qr•…r–}r—(h"j’h#jubaubj)r˜}r™(h"Uh+}rš(h-]h.]h/]h0]h2]uh#jŒh]r›hl)rœ}r(h"X=The query string, if no query string exists, an empty string.ržh#j˜h$h'h)hoh+}rŸ(h-]h.]h/]h0]h2]uh4KLh]r h>X=The query string, if no query string exists, an empty string.r¡…r¢}r£(h"jžh#jœubaubah)jubeubjö)r¤}r¥(h"X)%{X}o The contents of response header X. h#jòh$h'h)jùh+}r¦(h-]h.]h/]h0]h2]uh4KPh]r§(jü)r¨}r©(h"X%{X}orªh#j¤h$h'h)jh+}r«(h-]h.]h/]h0]h2]uh4KPh]r¬h>X%{X}or­…r®}r¯(h"jªh#j¨ubaubj)r°}r±(h"Uh+}r²(h-]h.]h/]h0]h2]uh#j¤h]r³hl)r´}rµ(h"X"The contents of response header X.r¶h#j°h$h'h)hoh+}r·(h-]h.]h/]h0]h2]uh4KPh]r¸h>X"The contents of response header X.r¹…rº}r»(h"j¶h#j´ubaubah)jubeubjö)r¼}r½(h"Xh%r The first line of the request. Synthesized from other fields, so it may not be the request verbatim. h#jòh$h'h)jùh+}r¾(h-]h.]h/]h0]h2]uh4KTh]r¿(jü)rÀ}rÁ(h"X%rrÂh#j¼h$h'h)jh+}rÃ(h-]h.]h/]h0]h2]uh4KTh]rÄh>X%rrÅ…rÆ}rÇ(h"jÂh#jÀubaubj)rÈ}rÉ(h"Uh+}rÊ(h-]h.]h/]h0]h2]uh#j¼h]rËhl)rÌ}rÍ(h"XdThe first line of the request. Synthesized from other fields, so it may not be the request verbatim.rÎh#jÈh$h'h)hoh+}rÏ(h-]h.]h/]h0]h2]uh4KSh]rÐh>XdThe first line of the request. Synthesized from other fields, so it may not be the request verbatim.rÑ…rÒ}rÓ(h"jÎh#jÌubaubah)jubeubjö)rÔ}rÕ(h"X%s Status sent to the client h#jòh$h'h)jùh+}rÖ(h-]h.]h/]h0]h2]uh4KWh]r×(jü)rØ}rÙ(h"X%srÚh#jÔh$h'h)jh+}rÛ(h-]h.]h/]h0]h2]uh4KWh]rÜh>X%srÝ…rÞ}rß(h"jÚh#jØubaubj)rà}rá(h"Uh+}râ(h-]h.]h/]h0]h2]uh#jÔh]rãhl)rä}rå(h"XStatus sent to the clientræh#jàh$h'h)hoh+}rç(h-]h.]h/]h0]h2]uh4KWh]rèh>XStatus sent to the clientré…rê}rë(h"jæh#jäubaubah)jubeubjö)rì}rí(h"XA%t Time when the request was received, in HTTP date/time format. h#jòh$h'h)jùh+}rî(h-]h.]h/]h0]h2]uh4K[h]rï(jü)rð}rñ(h"X%tròh#jìh$h'h)jh+}ró(h-]h.]h/]h0]h2]uh4K[h]rôh>X%trõ…rö}r÷(h"jòh#jðubaubj)rø}rù(h"Uh+}rú(h-]h.]h/]h0]h2]uh#jìh]rûhl)rü}rý(h"X=Time when the request was received, in HTTP date/time format.rþh#jøh$h'h)hoh+}rÿ(h-]h.]h/]h0]h2]uh4KZh]rh>X=Time when the request was received, in HTTP date/time format.r…r}r(h"jþh#jüubaubah)jubeubjö)r}r(h"X‡%{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). h#jòh$h'h)jùh+}r(h-]h.]h/]h0]h2]uh4K`h]r(jü)r}r (h"X%{X}tr h#jh$h'h)jh+}r (h-]h.]h/]h0]h2]uh4K`h]r h>X%{X}tr …r}r(h"j h#jubaubj)r}r(h"Uh+}r(h-]h.]h/]h0]h2]uh#jh]rhl)r}r(h"X€Time when the request was received, in the format specified by X. The time specification format is the same as for strftime(3).rh#jh$h'h)hoh+}r(h-]h.]h/]h0]h2]uh4K^h]rh>X€Time when the request was received, in the format specified by X. The time specification format is the same as for strftime(3).r…r}r(h"jh#jubaubah)jubeubjö)r}r(h"XK%U The request URL without any query string. Defaults to '-' if not known. h#jòh$h'h)jùh+}r(h-]h.]h/]h0]h2]uh4Kdh]r(jü)r }r!(h"X%Ur"h#jh$h'h)jh+}r#(h-]h.]h/]h0]h2]uh4Kdh]r$h>X%Ur%…r&}r'(h"j"h#j ubaubj)r(}r)(h"Uh+}r*(h-]h.]h/]h0]h2]uh#jh]r+hl)r,}r-(h"XGThe request URL without any query string. Defaults to '-' if not known.r.h#j(h$h'h)hoh+}r/(h-]h.]h/]h0]h2]uh4Kch]r0h>XGThe request URL without any query string. Defaults to '-' if not known.r1…r2}r3(h"j.h#j,ubaubah)jubeubjö)r4}r5(h"X%u Remote user from auth h#jòh$h'h)jùh+}r6(h-]h.]h/]h0]h2]uh4Kgh]r7(jü)r8}r9(h"X%ur:h#j4h$h'h)jh+}r;(h-]h.]h/]h0]h2]uh4Kgh]r<h>X%ur=…r>}r?(h"j:h#j8ubaubj)r@}rA(h"Uh+}rB(h-]h.]h/]h0]h2]uh#j4h]rChl)rD}rE(h"XRemote user from authrFh#j@h$h'h)hoh+}rG(h-]h.]h/]h0]h2]uh4Kgh]rHh>XRemote user from authrI…rJ}rK(h"jFh#jDubaubah)jubeubjö)rL}rM(h"X¤%{X}x Extended variables. Supported variables are: Varnish:time_firstbyte Time to the first byte from the backend arrived 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 error. VCL_Log:key Output value set by std.log("key:value") in VCL. h#jòh$h'h)jùh+}rN(h-]h.]h/]h0]h2]uh4Kyh]rO(jü)rP}rQ(h"X%{X}xrRh#jLh$h'h)jh+}rS(h-]h.]h/]h0]h2]uh4Kyh]rTh>X%{X}xrU…rV}rW(h"jRh#jPubaubj)rX}rY(h"Uh+}rZ(h-]h.]h/]h0]h2]uh#jLh]r[(hl)r\}r](h"X-Extended variables. Supported variables are:r^h#jXh$h'h)hoh+}r_(h-]h.]h/]h0]h2]uh4Kjh]r`h>X-Extended variables. Supported variables are:ra…rb}rc(h"j^h#j\ubaubjì)rd}re(h"Uh+}rf(h-]h.]h/]h0]h2]uh#jXh]rgjñ)rh}ri(h"Uh+}rj(h-]h.]h/]h0]h2]uh#jdh]rk(jö)rl}rm(h"XGVarnish:time_firstbyte Time to the first byte from the backend arrived h#jhh$h'h)jùh+}rn(h-]h.]h/]h0]h2]uh4Kmh]ro(jü)rp}rq(h"XVarnish:time_firstbyterrh#jlh$h'h)jh+}rs(h-]h.]h/]h0]h2]uh4Kmh]rth>XVarnish:time_firstbyteru…rv}rw(h"jrh#jpubaubj)rx}ry(h"Uh+}rz(h-]h.]h/]h0]h2]uh#jlh]r{hl)r|}r}(h"X/Time to the first byte from the backend arrivedr~h#jxh$h'h)hoh+}r(h-]h.]h/]h0]h2]uh4Kmh]r€h>X/Time to the first byte from the backend arrivedr…r‚}rƒ(h"j~h#j|ubaubah)jubeubjö)r„}r…(h"XbVarnish:hitmiss Whether the request was a cache hit or miss. Pipe and pass are considered misses. h#jhh$h'h)jùh+}r†(h-]h.]h/]h0]h2]uh4Kqh]r‡(jü)rˆ}r‰(h"XVarnish:hitmissrŠh#j„h$h'h)jh+}r‹(h-]h.]h/]h0]h2]uh4Kqh]rŒh>XVarnish:hitmissr…rŽ}r(h"jŠh#jˆubaubj)r}r‘(h"Uh+}r’(h-]h.]h/]h0]h2]uh#j„h]r“hl)r”}r•(h"XQWhether the request was a cache hit or miss. Pipe and pass are considered misses.r–h#jh$h'h)hoh+}r—(h-]h.]h/]h0]h2]uh4Kph]r˜h>XQWhether the request was a cache hit or miss. Pipe and pass are considered misses.r™…rš}r›(h"j–h#j”ubaubah)jubeubjö)rœ}r(h"XeVarnish:handling How the request was handled, whether it was a cache hit, miss, pass, pipe or error. h#jhh$h'h)jùh+}rž(h-]h.]h/]h0]h2]uh4Kuh]rŸ(jü)r }r¡(h"XVarnish:handlingr¢h#jœh$h'h)jh+}r£(h-]h.]h/]h0]h2]uh4Kuh]r¤h>XVarnish:handlingr¥…r¦}r§(h"j¢h#j ubaubj)r¨}r©(h"Uh+}rª(h-]h.]h/]h0]h2]uh#jœh]r«hl)r¬}r­(h"XSHow the request was handled, whether it was a cache hit, miss, pass, pipe or error.r®h#j¨h$h'h)hoh+}r¯(h-]h.]h/]h0]h2]uh4Kth]r°h>XSHow the request was handled, whether it was a cache hit, miss, pass, pipe or error.r±…r²}r³(h"j®h#j¬ubaubah)jubeubjö)r´}rµ(h"X>VCL_Log:key Output value set by std.log("key:value") in VCL. h#jhh$h'h)jùh+}r¶(h-]h.]h/]h0]h2]uh4Kyh]r·(jü)r¸}r¹(h"X VCL_Log:keyrºh#j´h$h'h)jh+}r»(h-]h.]h/]h0]h2]uh4Kyh]r¼h>X VCL_Log:keyr½…r¾}r¿(h"jºh#j¸ubaubj)rÀ}rÁ(h"Uh+}rÂ(h-]h.]h/]h0]h2]uh#j´h]rÃhl)rÄ}rÅ(h"X0Output value set by std.log("key:value") in VCL.rÆh#jÀh$h'h)hoh+}rÇ(h-]h.]h/]h0]h2]uh4Kxh]rÈh>X0Output value set by std.log("key:value") in VCL.rÉ…rÊ}rË(h"jÆh#jÄubaubah)jubeubeh)Udefinition_listrÌubah)U block_quoterÍubeh)jubeubeh)jÌubah)jÍubeh)j+ubeubeubjñ)rÎ}rÏ(h"Uh#hÞh$h'h)jÌh+}rÐ(h-]h.]h/]h0]h2]uh4Nh5hh]rÑjö)rÒ}rÓ(h"Xa-m tag:regex only list records where tag matches regex. Multiple -m options are AND-ed together. h#jÎh$h'h)jùh+}rÔ(h-]h.]h/]h0]h2]uh4K|h]rÕ(jü)rÖ}r×(h"X@-m tag:regex only list records where tag matches regex. MultiplerØh#jÒh$h'h)jh+}rÙ(h-]h.]h/]h0]h2]uh4K|h]rÚ(h>X-m rÛ…rÜ}rÝ(h"X-m h#jÖubhÑ)rÞ}rß(h"X tag:regexràh+}rá(Urefurijàh0]h/]h-]h.]h2]uh#jÖh]râh>X tag:regexrã…rä}rå(h"Uh#jÞubah)hÚubh>X4 only list records where tag matches regex. Multipleræ…rç}rè(h"X4 only list records where tag matches regex. Multipleh#jÖubeubj)ré}rê(h"Uh+}rë(h-]h.]h/]h0]h2]uh#jÒh]rìhl)rí}rî(h"X-m options are AND-ed together.rïh#jéh$h'h)hoh+}rð(h-]h.]h/]h0]h2]uh4K|h]rñh>X-m options are AND-ed together.rò…ró}rô(h"jïh#jíubaubah)jubeubaubhü)rõ}rö(h"Uh#hÞh$h'h)hÿh+}r÷(h-]h.]h/]h0]h2]uh4Nh5hh]rø(j)rù}rú(h"Uh#jõh$h'h)jh+}rû(h-]h.]h/]h0]h2]uh4Nh5hh]rü(j)rý}rþ(h"Uh+}rÿ(h-]h.]h/]h0]h2]uh#jùh]rj )r}r(h"X-nrh+}r(h-]h.]h/]h0]h2]uh#jýh]rj)r}r(h"jh+}r(h-]h.]h/]h0]h2]uh#jh]r h>X-nr …r }r (h"Uh#jubah)jubah)jubah)jubj)r }r(h"XnSpecifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used. h+}r(h-]h.]h/]h0]h2]uh#jùh]rhl)r}r(h"XmSpecifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used.rh#j h$h'h)hoh+}r(h-]h.]h/]h0]h2]uh4K~h]rh>XmSpecifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used.r…r}r(h"jh#jubaubah)j+ubeubj)r}r(h"Uh#jõh$h'h)jh+}r(h-]h.]h/]h0]h2]uh4Nh5hh]r(j)r}r(h"Uh+}r(h-]h.]h/]h0]h2]uh#jh]r j )r!}r"(h"X-P fileh+}r#(h-]h.]h/]h0]h2]uh#jh]r$(j)r%}r&(h"X-Ph+}r'(h-]h.]h/]h0]h2]uh#j!h]r(h>X-Pr)…r*}r+(h"Uh#j%ubah)jubj¿)r,}r-(h"Xfileh+}r.(h0]h/]h-]U delimiterU h.]h2]uh#j!h]r/h>Xfiler0…r1}r2(h"Uh#j,ubah)jÇubeh)jubah)jubj)r3}r4(h"X/Write the process's PID to the specified file. h+}r5(h-]h.]h/]h0]h2]uh#jh]r6hl)r7}r8(h"X.Write the process's PID to the specified file.r9h#j3h$h'h)hoh+}r:(h-]h.]h/]h0]h2]uh4Kh]r;h>X.Write the process's PID to the specified file.r<…r=}r>(h"j9h#j7ubaubah)j+ubeubj)r?}r@(h"Uh#jõh$h'h)jh+}rA(h-]h.]h/]h0]h2]uh4Nh5hh]rB(j)rC}rD(h"Uh+}rE(h-]h.]h/]h0]h2]uh#j?h]rFj )rG}rH(h"X-r fileh+}rI(h-]h.]h/]h0]h2]uh#jCh]rJ(j)rK}rL(h"X-rh+}rM(h-]h.]h/]h0]h2]uh#jGh]rNh>X-rrO…rP}rQ(h"Uh#jKubah)jubj¿)rR}rS(h"Xfileh+}rT(h0]h/]h-]U delimiterU h.]h2]uh#jGh]rUh>XfilerV…rW}rX(h"Uh#jRubah)jÇubeh)jubah)jubj)rY}rZ(h"X5Read log entries from file instead of shared memory. h+}r[(h-]h.]h/]h0]h2]uh#j?h]r\hl)r]}r^(h"X4Read log entries from file instead of shared memory.r_h#jYh$h'h)hoh+}r`(h-]h.]h/]h0]h2]uh4Kƒh]rah>X4Read log entries from file instead of shared memory.rb…rc}rd(h"j_h#j]ubaubah)j+ubeubj)re}rf(h"Uh#jõh$h'h)jh+}rg(h-]h.]h/]h0]h2]uh4Nh5hh]rh(j)ri}rj(h"Uh+}rk(h-]h.]h/]h0]h2]uh#jeh]rlj )rm}rn(h"X-Vroh+}rp(h-]h.]h/]h0]h2]uh#jih]rqj)rr}rs(h"joh+}rt(h-]h.]h/]h0]h2]uh#jmh]ruh>X-Vrv…rw}rx(h"Uh#jrubah)jubah)jubah)jubj)ry}rz(h"X%Display the version number and exit. h+}r{(h-]h.]h/]h0]h2]uh#jeh]r|hl)r}}r~(h"X$Display the version number and exit.rh#jyh$h'h)hoh+}r€(h-]h.]h/]h0]h2]uh4K…h]rh>X$Display the version number and exit.r‚…rƒ}r„(h"jh#j}ubaubah)j+ubeubj)r…}r†(h"Uh#jõh$h'h)jh+}r‡(h-]h.]h/]h0]h2]uh4Nh5hh]rˆ(j)r‰}rŠ(h"Uh+}r‹(h-]h.]h/]h0]h2]uh#j…h]rŒj )r}rŽ(h"X-w fileh+}r(h-]h.]h/]h0]h2]uh#j‰h]r(j)r‘}r’(h"X-wh+}r“(h-]h.]h/]h0]h2]uh#jh]r”h>X-wr•…r–}r—(h"Uh#j‘ubah)jubj¿)r˜}r™(h"Xfileh+}rš(h0]h/]h-]U delimiterU h.]h2]uh#jh]r›h>Xfilerœ…r}rž(h"Uh#j˜ubah)jÇubeh)jubah)jubj)rŸ}r (h"XôWrite log entries to file instead of displaying them. The file will be overwritten unless the -a option was specified. If varnishncsa receives a SIGHUP while writing to a file, it will reopen the file, allowing the old one to be rotated away. h+}r¡(h-]h.]h/]h0]h2]uh#j…h]r¢(hl)r£}r¤(h"XvWrite log entries to file instead of displaying them. The file will be overwritten unless the -a option was specified.r¥h#jŸh$h'h)hoh+}r¦(h-]h.]h/]h0]h2]uh4K‡h]r§h>XvWrite log entries to file instead of displaying them. The file will be overwritten unless the -a option was specified.r¨…r©}rª(h"j¥h#j£ubaubhl)r«}r¬(h"X{If varnishncsa receives a SIGHUP while writing to a file, it will reopen the file, allowing the old one to be rotated away.r­h#jŸh$h'h)hoh+}r®(h-]h.]h/]h0]h2]uh4K‹h]r¯h>X{If varnishncsa receives a SIGHUP while writing to a file, it will reopen the file, allowing the old one to be rotated away.r°…r±}r²(h"j­h#j«ubaubeh)j+ubeubj)r³}r´(h"Uh#jõh$h'h)jh+}rµ(h-]h.]h/]h0]h2]uh4Nh5hh]r¶(j)r·}r¸(h"Uh+}r¹(h-]h.]h/]h0]h2]uh#j³h]rºj )r»}r¼(h"X-X regexh+}r½(h-]h.]h/]h0]h2]uh#j·h]r¾(j)r¿}rÀ(h"X-Xh+}rÁ(h-]h.]h/]h0]h2]uh#j»h]rÂh>X-XrÃ…rÄ}rÅ(h"Uh#j¿ubah)jubj¿)rÆ}rÇ(h"Xregexh+}rÈ(h0]h/]h-]U delimiterU h.]h2]uh#j»h]rÉh>XregexrÊ…rË}rÌ(h"Uh#jÆubah)jÇubeh)jubah)jubj)rÍ}rÎ(h"XBExclude log entries which match the specified regular expression. h+}rÏ(h-]h.]h/]h0]h2]uh#j³h]rÐhl)rÑ}rÒ(h"XAExclude log entries which match the specified regular expression.rÓh#jÍh$h'h)hoh+}rÔ(h-]h.]h/]h0]h2]uh4Kh]rÕh>XAExclude log entries which match the specified regular expression.rÖ…r×}rØ(h"jÓh#jÑubaubah)j+ubeubj)rÙ}rÚ(h"Uh#jõh$h'h)jh+}rÛ(h-]h.]h/]h0]h2]uh4Nh5hh]rÜ(j)rÝ}rÞ(h"Uh+}rß(h-]h.]h/]h0]h2]uh#jÙh]ràj )rá}râ(h"X-x tagh+}rã(h-]h.]h/]h0]h2]uh#jÝh]rä(j)rå}ræ(h"X-xh+}rç(h-]h.]h/]h0]h2]uh#jáh]rèh>X-xré…rê}rë(h"Uh#jåubah)jubj¿)rì}rí(h"Xtagh+}rî(h0]h/]h-]U delimiterU h.]h2]uh#jáh]rïh>Xtagrð…rñ}rò(h"Uh#jìubah)jÇubeh)jubah)jubj)ró}rô(h"X,Exclude log entries with the specified tag. h+}rõ(h-]h.]h/]h0]h2]uh#jÙh]röhl)r÷}rø(h"X+Exclude log entries with the specified tag.rùh#jóh$h'h)hoh+}rú(h-]h.]h/]h0]h2]uh4K’h]rûh>X+Exclude log entries with the specified tag.rü…rý}rþ(h"jùh#j÷ubaubah)j+ubeubeubhl)rÿ}r(h"XÂIf the -o option was specified, a tag and a regex argument must be given. varnishncsa will then only log for request groups which include that tag and the regular expression matches on that tag.rh#hÞh$h'h)hoh+}r(h-]h.]h/]h0]h2]uh4K”h5hh]rh>XÂIf the -o option was specified, a tag and a regex argument must be given. varnishncsa will then only log for request groups which include that tag and the regular expression matches on that tag.r…r}r(h"jh#jÿubaubeubh)r}r(h"Uh#hBh$h'h)h*h+}r (h-]h.]h/]h0]r hah2]r h auh4K™h5hh]r (h7)r }r(h"XSEE ALSOrh#jh$h'h)h;h+}r(h-]h.]h/]h0]h2]uh4K™h5hh]rh>XSEE ALSOr…r}r(h"jh#j ubaubcdocutils.nodes bullet_list r)r}r(h"Uh#jh$h'h)U bullet_listrh+}r(UbulletrX*h0]h/]h-]h.]h2]uh4K›h5hh]r(cdocutils.nodes list_item r)r}r(h"X varnishd(1)rh#jh$h'h)U list_itemr h+}r!(h-]h.]h/]h0]h2]uh4Nh5hh]r"hl)r#}r$(h"jh#jh$h'h)hoh+}r%(h-]h.]h/]h0]h2]uh4K›h]r&h>X varnishd(1)r'…r(}r)(h"jh#j#ubaubaubj)r*}r+(h"Xvarnishhist(1)r,h#jh$h'h)j h+}r-(h-]h.]h/]h0]h2]uh4Nh5hh]r.hl)r/}r0(h"j,h#j*h$h'h)hoh+}r1(h-]h.]h/]h0]h2]uh4Kœh]r2h>Xvarnishhist(1)r3…r4}r5(h"j,h#j/ubaubaubj)r6}r7(h"X varnishlog(1)r8h#jh$h'h)j h+}r9(h-]h.]h/]h0]h2]uh4Nh5hh]r:hl)r;}r<(h"j8h#j6h$h'h)hoh+}r=(h-]h.]h/]h0]h2]uh4Kh]r>h>X varnishlog(1)r?…r@}rA(h"j8h#j;ubaubaubj)rB}rC(h"Xvarnishstat(1)rDh#jh$h'h)j h+}rE(h-]h.]h/]h0]h2]uh4Nh5hh]rFhl)rG}rH(h"jDh#jBh$h'h)hoh+}rI(h-]h.]h/]h0]h2]uh4Kžh]rJh>Xvarnishstat(1)rK…rL}rM(h"jDh#jGubaubaubj)rN}rO(h"Xvarnishtop(1) h#jh$h'h)j h+}rP(h-]h.]h/]h0]h2]uh4Nh5hh]rQhl)rR}rS(h"X varnishtop(1)rTh#jNh$h'h)hoh+}rU(h-]h.]h/]h0]h2]uh4KŸh]rVh>X varnishtop(1)rW…rX}rY(h"jTh#jRubaubaubeubeubh)rZ}r[(h"Uh#hBh$h'h)h*h+}r\(h-]h.]h/]h0]r]hah2]r^h auh4K¢h5hh]r_(h7)r`}ra(h"XHISTORYrbh#jZh$h'h)h;h+}rc(h-]h.]h/]h0]h2]uh4K¢h5hh]rdh>XHISTORYre…rf}rg(h"jbh#j`ubaubhl)rh}ri(h"X¿The varnishncsa utility was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS and Varnish Software AS. This manual page was written by Dag-Erling Smørgrav ⟨des@des.no⟩.h#jZh$h'h)hoh+}rj(h-]h.]h/]h0]h2]uh4K¤h5hh]rk(h>X±The varnishncsa utility was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS and Varnish Software AS. This manual page was written by Dag-Erling Smørgrav ⟨rl…rm}rn(h"X±The varnishncsa utility was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS and Varnish Software AS. This manual page was written by Dag-Erling Smørgrav ⟨h#jhubhÑ)ro}rp(h"X des@des.noh+}rq(UrefuriXmailto:des@des.noh0]h/]h-]h.]h2]uh#jhh]rrh>X des@des.nors…rt}ru(h"Uh#joubah)hÚubh>X⟩.rv…rw}rx(h"X⟩.h#jhubeubeubh)ry}rz(h"Uh#hBh$h'h)h*h+}r{(h-]h.]h/]h0]r|hah2]r}hauh4Kªh5hh]r~(h7)r}r€(h"X COPYRIGHTrh#jyh$h'h)h;h+}r‚(h-]h.]h/]h0]h2]uh4Kªh5hh]rƒh>X COPYRIGHTr„…r…}r†(h"jh#jubaubhl)r‡}rˆ(h"X\This document is licensed under the same licence as Varnish itself. See LICENCE for details.r‰h#jyh$h'h)hoh+}rŠ(h-]h.]h/]h0]h2]uh4K¬h5hh]r‹h>X\This document is licensed under the same licence as Varnish itself. See LICENCE for details.rŒ…r}rŽ(h"j‰h#j‡ubaubj)r}r(h"Uh#jyh$h'h)jh+}r‘(jX*h0]h/]h-]h.]h2]uh4K¯h5hh]r’(j)r“}r”(h"X"Copyright (c) 2006 Verdens Gang ASr•h#jh$h'h)j h+}r–(h-]h.]h/]h0]h2]uh4Nh5hh]r—hl)r˜}r™(h"j•h#j“h$h'h)hoh+}rš(h-]h.]h/]h0]h2]uh4K¯h]r›h>X"Copyright (c) 2006 Verdens Gang ASrœ…r}rž(h"j•h#j˜ubaubaubj)rŸ}r (h"X+Copyright (c) 2006-2011 Varnish Software ASr¡h#jh$h'h)j h+}r¢(h-]h.]h/]h0]h2]uh4Nh5hh]r£hl)r¤}r¥(h"j¡h#jŸh$h'h)hoh+}r¦(h-]h.]h/]h0]h2]uh4K°h]r§h>X+Copyright (c) 2006-2011 Varnish Software ASr¨…r©}rª(h"j¡h#j¤ubaubaubeubeubeubeubah"UU transformerr«NU footnote_refsr¬}r­Urefnamesr®}r¯Usymbol_footnotesr°]r±Uautofootnote_refsr²]r³Usymbol_footnote_refsr´]rµU citationsr¶]r·h5hU current_liner¸NUtransform_messagesr¹]rºUreporterr»NUid_startr¼KU autofootnotesr½]r¾U citation_refsr¿}rÀUindirect_targetsrÁ]rÂUsettingsrÃ(cdocutils.frontend Values rÄorÅ}rÆ(Ufootnote_backlinksrÇKUrecord_dependenciesrÈNU rfc_base_urlrÉUhttp://tools.ietf.org/html/rÊU tracebackrˈUpep_referencesrÌNUstrip_commentsrÍNU toc_backlinksrÎUentryrÏU language_coderÐUenrÑU datestamprÒNU report_levelrÓKU _destinationrÔNU halt_levelrÕKU strip_classesrÖNh;NUerror_encoding_error_handlerr×UbackslashreplacerØUdebugrÙNUembed_stylesheetrÚ‰Uoutput_encoding_error_handlerrÛUstrictrÜU sectnum_xformrÝKUdump_transformsrÞNU docinfo_xformrßKUwarning_streamràNUpep_file_url_templateráUpep-%04drâUexit_status_levelrãKUconfigräNUstrict_visitorråNUcloak_email_addressesræˆUtrim_footnote_reference_spacerç‰UenvrèNUdump_pseudo_xmlréNUexpose_internalsrêNUsectsubtitle_xformrë‰U source_linkrìNUrfc_referencesríNUoutput_encodingrîUutf-8rïU source_urlrðNUinput_encodingrñU utf-8-sigròU_disable_configróNU id_prefixrôUU tab_widthrõKUerror_encodingröUUTF-8r÷U_sourcerøU9/home/tfheen/varnish/doc/sphinx/reference/varnishncsa.rstrùUgettext_compactrúˆU generatorrûNUdump_internalsrüNU smart_quotesrý‰U pep_base_urlrþUhttp://www.python.org/dev/peps/rÿUsyntax_highlightrUlongrUinput_encoding_error_handlerrjÜUauto_id_prefixrUidrUdoctitle_xformr‰Ustrip_elements_with_classesrNU _config_filesr]rUfile_insertion_enabledr KU raw_enabledr KU dump_settingsr NubUsymbol_footnote_startr KUidsr }r(hhÞhjyhjhhBhh¼hh hjZuUsubstitution_namesr}rh)h5h+}r(h-]h0]h/]Usourceh'h.]h2]uU footnotesr]rUrefidsr}rub.varnish-3.0.5/doc/sphinx/=build/doctrees/reference/vmod.doctree0000644000175000017500000010410312247037213021446 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(Xvmod - varnish modulesqNXvcl and c data typesqNXthe vmod.vcc fileqNXprivate pointersq NuUsubstitution_defsq }q Uparse_messagesq ]q Ucurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hUvmod-varnish-modulesqhUvcl-and-c-data-typesqhUthe-vmod-vcc-fileqh Uprivate-pointersquUchildrenq]qcdocutils.nodes section q)q}q(U rawsourceqUUparentqhUsourceqcdocutils.nodes reprunicode qX2/home/tfheen/varnish/doc/sphinx/reference/vmod.rstq …q!}q"bUtagnameq#Usectionq$U attributesq%}q&(Udupnamesq']Uclassesq(]Ubackrefsq)]Uidsq*]q+haUnamesq,]q-hauUlineq.KUdocumentq/hh]q0(cdocutils.nodes title q1)q2}q3(hXVMOD - Varnish Modulesq4hhhh!h#Utitleq5h%}q6(h']h(]h)]h*]h,]uh.Kh/hh]q7cdocutils.nodes Text q8XVMOD - Varnish Modulesq9…q:}q;(hh4hh2ubaubcdocutils.nodes paragraph q<)q=}q>(hXú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.q?hhhh!h#U paragraphq@h%}qA(h']h(]h)]h*]h,]uh.Kh/hh]qBh8Xú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.qC…qD}qE(hh?hh=ubaubh<)qF}qG(hX€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.qHhhhh!h#h@h%}qI(h']h(]h)]h*]h,]uh.K h/hh]qJh8X€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.qK…qL}qM(hhHhhFubaubh<)qN}qO(hXFor instance::qPhhhh!h#h@h%}qQ(h']h(]h)]h*]h,]uh.Kh/hh]qRh8X For instance:qS…qT}qU(hX For instance:hhNubaubcdocutils.nodes literal_block qV)qW}qX(hXRimport std; sub vcl_deliver { set resp.http.foo = std.toupper(req.url); }hhhh!h#U literal_blockqYh%}qZ(U xml:spaceq[Upreserveq\h*]h)]h']h(]h,]uh.Kh/hh]q]h8XRimport std; sub vcl_deliver { set resp.http.foo = std.toupper(req.url); }q^…q_}q`(hUhhWubaubh<)qa}qb(hXà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(7).qchhhh!h#h@h%}qd(h']h(]h)]h*]h,]uh.Kh/hh]qeh8Xà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(7).qf…qg}qh(hhchhaubaubh<)qi}qj(hXíThis part of the manual is about how you go about writing your own VMOD, how the language interface between C and VCC works etc. This explanation will use the "std" VMOD as example, having a varnish source tree handy may be a good idea.qkhhhh!h#h@h%}ql(h']h(]h)]h*]h,]uh.Kh/hh]qmh8XíThis part of the manual is about how you go about writing your own VMOD, how the language interface between C and VCC works etc. This explanation will use the "std" VMOD as example, having a varnish source tree handy may be a good idea.qn…qo}qp(hhkhhiubaubh)qq}qr(hUhhhh!h#h$h%}qs(h']h(]h)]h*]qthah,]quhauh.K!h/hh]qv(h1)qw}qx(hXThe vmod.vcc fileqyhhqhh!h#h5h%}qz(h']h(]h)]h*]h,]uh.K!h/hh]q{h8XThe vmod.vcc fileq|…q}}q~(hhyhhwubaubh<)q}q€(hXö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 "vmod.py" turns into thaumathurgically challenged C data structures that does all the hard work.qhhqhh!h#h@h%}q‚(h']h(]h)]h*]h,]uh.K#h/hh]qƒh8Xö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 "vmod.py" turns into thaumathurgically challenged C data structures that does all the hard work.q„…q…}q†(hhhhubaubh<)q‡}qˆ(hX6The std VMODs vmod.vcc file looks somewhat like this::q‰hhqhh!h#h@h%}qŠ(h']h(]h)]h*]h,]uh.K(h/hh]q‹h8X5The std VMODs vmod.vcc file looks somewhat like this:qŒ…q}qŽ(hX5The std VMODs vmod.vcc file looks somewhat like this:hh‡ubaubhV)q}q(hXšModule std Init init_function Function STRING toupper(PRIV_CALL, STRING_LIST) Function STRING tolower(PRIV_VCL, STRING_LIST) Function VOID set_ip_tos(INT)hhqhh!h#hYh%}q‘(h[h\h*]h)]h']h(]h,]uh.K*h/hh]q’h8XšModule std Init init_function Function STRING toupper(PRIV_CALL, STRING_LIST) Function STRING tolower(PRIV_VCL, STRING_LIST) Function VOID set_ip_tos(INT)q“…q”}q•(hUhhubaubh<)q–}q—(hXCThe first line gives the name of the module, nothing special there.q˜hhqhh!h#h@h%}q™(h']h(]h)]h*]h,]uh.K0h/hh]qšh8XCThe first line gives the name of the module, nothing special there.q›…qœ}q(hh˜hh–ubaubh<)qž}qŸ(hXèThe second line specifies an optional "Init" function, which will be called whenever a VCL program which imports this VMOD is loaded. This gives a chance to initialize the module before any of the functions it implements are called.q hhqhh!h#h@h%}q¡(h']h(]h)]h*]h,]uh.K2h/hh]q¢h8XèThe second line specifies an optional "Init" function, which will be called whenever a VCL program which imports this VMOD is loaded. This gives a chance to initialize the module before any of the functions it implements are called.q£…q¤}q¥(hh hhžubaubh<)q¦}q§(hXÝThe next three lines specify two functions in the VMOD, along with the types of the arguments, and that is probably where the hardest bit of writing a VMOD is to be found, so we will talk about that at length in a moment.q¨hhqhh!h#h@h%}q©(h']h(]h)]h*]h,]uh.K7h/hh]qªh8XÝThe next three lines specify two functions in the VMOD, along with the types of the arguments, and that is probably where the hardest bit of writing a VMOD is to be found, so we will talk about that at length in a moment.q«…q¬}q­(hh¨hh¦ubaubh<)q®}q¯(hXNotice that the third function returns VOID, that makes it a "procedure" in VCL lingo, meaning that it cannot be used in expressions, right side of assignments and such places. Instead it can be used as a primary action, something functions which return a value can not::hhqhh!h#h@h%}q°(h']h(]h)]h*]h,]uh.KFor the std VMOD, the compiled vcc_if.h file looks like this::qÖhhqhh!h#h@h%}q×(h']h(]h)]h*]h,]uh.KPh/hh]qØh8X=For the std VMOD, the compiled vcc_if.h file looks like this:qÙ…qÚ}qÛ(hX=For the std VMOD, the compiled vcc_if.h file looks like this:hhÔubaubhV)qÜ}qÝ(hXôstruct sess; struct VCL_conf; const char * vmod_toupper(struct sess *, struct vmod_priv *, const char *, ...); const char * vmod_tolower(struct sess *, struct vmod_priv *, const char *, ...); int meta_function(void **, const struct VCL_conf *);hhqhh!h#hYh%}qÞ(h[h\h*]h)]h']h(]h,]uh.KRh/hh]qßh8Xôstruct sess; struct VCL_conf; const char * vmod_toupper(struct sess *, struct vmod_priv *, const char *, ...); const char * vmod_tolower(struct sess *, struct vmod_priv *, const char *, ...); int meta_function(void **, const struct VCL_conf *);qà…qá}qâ(hUhhÜubaubh<)qã}qä(hX~Those are your C prototypes. Notice the ``vmod_`` prefix on the function names and the C-types as return types and arguments.hhqhh!h#h@h%}qå(h']h(]h)]h*]h,]uh.KXh/hh]qæ(h8X)Those are your C prototypes. Notice the qç…qè}qé(hX)Those are your C prototypes. Notice the hhãubcdocutils.nodes literal qê)që}qì(hX ``vmod_``h%}qí(h']h(]h)]h*]h,]uhhãh]qîh8Xvmod_qï…qð}qñ(hUhhëubah#Uliteralqòubh8XL prefix on the function names and the C-types as return types and arguments.qó…qô}qõ(hXL prefix on the function names and the C-types as return types and arguments.hhãubeubeubh)qö}q÷(hUhhhh!h#h$h%}qø(h']h(]h)]h*]qùhah,]qúhauh.K\h/hh]qû(h1)qü}qý(hXVCL and C data typesqþhhöhh!h#h5h%}qÿ(h']h(]h)]h*]h,]uh.K\h/hh]rh8XVCL and C data typesr…r}r(hhþhhüubaubh<)r}r(hXÙ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, from simple to nasty.rhhöhh!h#h@h%}r(h']h(]h)]h*]h,]uh.K^h/hh]rh8XÙ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, from simple to nasty.r …r }r (hjhjubaubcdocutils.nodes definition_list r )r }r(hUhhöhh!h#Udefinition_listrh%}r(h']h(]h)]h*]h,]uh.Nh/hh]r(cdocutils.nodes definition_list_item r)r}r(hX:INT C-type: ``int`` An integer as we know and love them. hj hh!h#Udefinition_list_itemrh%}r(h']h(]h)]h*]h,]uh.Kfh]r(cdocutils.nodes term r)r}r(hXINTrhjhh!h#Utermrh%}r(h']h(]h)]h*]h,]uh.Kfh]rh8XINTr…r }r!(hjhjubaubcdocutils.nodes definition r")r#}r$(hUh%}r%(h']h(]h)]h*]h,]uhjh]r&(h<)r'}r((hXC-type: ``int``hj#hh!h#h@h%}r)(h']h(]h)]h*]h,]uh.Kdh]r*(h8XC-type: r+…r,}r-(hXC-type: hj'ubhê)r.}r/(hX``int``h%}r0(h']h(]h)]h*]h,]uhj'h]r1h8Xintr2…r3}r4(hUhj.ubah#hòubeubh<)r5}r6(hX$An integer as we know and love them.r7hj#hh!h#h@h%}r8(h']h(]h)]h*]h,]uh.Kfh]r9h8X$An integer as we know and love them.r:…r;}r<(hj7hj5ubaubeh#U definitionr=ubeubj)r>}r?(hX0REAL C-type: ``double`` A floating point value hj hh!h#jh%}r@(h']h(]h)]h*]h,]uh.Kkh/hh]rA(j)rB}rC(hXREALrDhj>hh!h#jh%}rE(h']h(]h)]h*]h,]uh.Kkh]rFh8XREALrG…rH}rI(hjDhjBubaubj")rJ}rK(hUh%}rL(h']h(]h)]h*]h,]uhj>h]rM(h<)rN}rO(hXC-type: ``double``hjJhh!h#h@h%}rP(h']h(]h)]h*]h,]uh.Kih]rQ(h8XC-type: rR…rS}rT(hXC-type: hjNubhê)rU}rV(hX ``double``h%}rW(h']h(]h)]h*]h,]uhjNh]rXh8XdoublerY…rZ}r[(hUhjUubah#hòubeubh<)r\}r](hXA floating point valuer^hjJhh!h#h@h%}r_(h']h(]h)]h*]h,]uh.Kkh]r`h8XA floating point valuera…rb}rc(hj^hj\ubaubeh#j=ubeubj)rd}re(hXRDURATION C-type: ``double`` Units: seconds A time interval, as in "25 minutes". hj hh!h#jh%}rf(h']h(]h)]h*]h,]uh.Krh/hh]rg(j)rh}ri(hXDURATIONrjhjdhh!h#jh%}rk(h']h(]h)]h*]h,]uh.Krh]rlh8XDURATIONrm…rn}ro(hjjhjhubaubj")rp}rq(hUh%}rr(h']h(]h)]h*]h,]uhjdh]rs(h<)rt}ru(hXC-type: ``double``hjphh!h#h@h%}rv(h']h(]h)]h*]h,]uh.Knh]rw(h8XC-type: rx…ry}rz(hXC-type: hjtubhê)r{}r|(hX ``double``h%}r}(h']h(]h)]h*]h,]uhjth]r~h8Xdoubler…r€}r(hUhj{ubah#hòubeubh<)r‚}rƒ(hXUnits: secondsr„hjphh!h#h@h%}r…(h']h(]h)]h*]h,]uh.Kph]r†h8XUnits: secondsr‡…rˆ}r‰(hj„hj‚ubaubh<)rŠ}r‹(hX$A time interval, as in "25 minutes".rŒhjphh!h#h@h%}r(h']h(]h)]h*]h,]uh.Krh]rŽh8X$A time interval, as in "25 minutes".r…r}r‘(hjŒhjŠubaubeh#j=ubeubj)r’}r“(hXrTIME C-type: ``double`` Units: seconds since UNIX epoch An absolute time, as in "Mon Sep 13 19:06:01 UTC 2010". hj hh!h#jh%}r”(h']h(]h)]h*]h,]uh.Kyh/hh]r•(j)r–}r—(hXTIMEr˜hj’hh!h#jh%}r™(h']h(]h)]h*]h,]uh.Kyh]ršh8XTIMEr›…rœ}r(hj˜hj–ubaubj")rž}rŸ(hUh%}r (h']h(]h)]h*]h,]uhj’h]r¡(h<)r¢}r£(hXC-type: ``double``hjžhh!h#h@h%}r¤(h']h(]h)]h*]h,]uh.Kuh]r¥(h8XC-type: r¦…r§}r¨(hXC-type: hj¢ubhê)r©}rª(hX ``double``h%}r«(h']h(]h)]h*]h,]uhj¢h]r¬h8Xdoubler­…r®}r¯(hUhj©ubah#hòubeubh<)r°}r±(hXUnits: seconds since UNIX epochr²hjžhh!h#h@h%}r³(h']h(]h)]h*]h,]uh.Kwh]r´h8XUnits: seconds since UNIX epochrµ…r¶}r·(hj²hj°ubaubh<)r¸}r¹(hX7An absolute time, as in "Mon Sep 13 19:06:01 UTC 2010".rºhjžhh!h#h@h%}r»(h']h(]h)]h*]h,]uh.Kyh]r¼h8X7An absolute time, as in "Mon Sep 13 19:06:01 UTC 2010".r½…r¾}r¿(hjºhj¸ubaubeh#j=ubeubj)rÀ}rÁ(hXÿSTRING C-type: ``const char *`` A NUL-terminated text-string. Can be NULL to indicate that the nonexistent string, for instance:: 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 session or worker workspaces. hj hh!h#jh%}rÂ(h']h(]h)]h*]h,]uh.KŒh/hh]rÃ(j)rÄ}rÅ(hXSTRINGrÆhjÀhh!h#jh%}rÇ(h']h(]h)]h*]h,]uh.KŒh]rÈh8XSTRINGrÉ…rÊ}rË(hjÆhjÄubaubj")rÌ}rÍ(hUh%}rÎ(h']h(]h)]h*]h,]uhjÀh]rÏ(h<)rÐ}rÑ(hXC-type: ``const char *``hjÌhh!h#h@h%}rÒ(h']h(]h)]h*]h,]uh.K|h]rÓ(h8XC-type: rÔ…rÕ}rÖ(hXC-type: hjÐubhê)r×}rØ(hX``const char *``h%}rÙ(h']h(]h)]h*]h,]uhjÐh]rÚh8X const char *rÛ…rÜ}rÝ(hUhj×ubah#hòubeubh<)rÞ}rß(hXA NUL-terminated text-string.ràhjÌhh!h#h@h%}rá(h']h(]h)]h*]h,]uh.K~h]râh8XA NUL-terminated text-string.rã…rä}rå(hjàhjÞubaubh<)ræ}rç(hXCCan be NULL to indicate that the nonexistent string, for instance::hjÌhh!h#h@h%}rè(h']h(]h)]h*]h,]uh.K€h]réh8XBCan be NULL to indicate that the nonexistent string, for instance:rê…rë}rì(hXBCan be NULL to indicate that the nonexistent string, for instance:hjæubaubhV)rí}rî(hXmymod.foo(req.http.foobar);hjÌh#hYh%}rï(h[h\h*]h)]h']h(]h,]uh.Kƒh]rðh8Xmymod.foo(req.http.foobar);rñ…rò}ró(hUhjíubaubh<)rô}rõ(hXjIf there were no "foobar" HTTP header, the vmod_foo() function would be passed a NULL pointer as argument.röhjÌhh!h#h@h%}r÷(h']h(]h)]h*]h,]uh.K…h]røh8XjIf there were no "foobar" HTTP header, the vmod_foo() function would be passed a NULL pointer as argument.rù…rú}rû(hjöhjôubaubh<)rü}rý(hXè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 session or worker workspaces.rþhjÌhh!h#h@h%}rÿ(h']h(]h)]h*]h,]uh.Kˆh]rh8Xè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 session or worker workspaces.r…r}r(hjþhjüubaubeh#j=ubeubj)r}r(hXNSTRING_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 do that, by not editing separate pieces of a sting together to one string, until we need to. Consider this contrived example:: set bereq.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 thread_pool_workspace param is big enough. hj hh!h#jh%}r(h']h(]h)]h*]h,]uh.K®h/hh]r(j)r}r (hX STRING_LISTr hjhh!h#jh%}r (h']h(]h)]h*]h,]uh.K®h]r h8X STRING_LISTr …r}r(hj hjubaubj")r}r(hUh%}r(h']h(]h)]h*]h,]uhjh]r(h<)r}r(hXC-type: ``const char *, ...``hjhh!h#h@h%}r(h']h(]h)]h*]h,]uh.Kh]r(h8XC-type: r…r}r(hXC-type: hjubhê)r}r(hX``const char *, ...``h%}r(h']h(]h)]h*]h,]uhjh]rh8Xconst char *, ...r…r }r!(hUhjubah#hòubeubh<)r"}r#(hXÏA multi-component text-string. We try very hard to avoid doing text-processing in Varnish, and this is one way we do that, by not editing separate pieces of a sting together to one string, until we need to.r$hjhh!h#h@h%}r%(h']h(]h)]h*]h,]uh.K‘h]r&h8XÏA multi-component text-string. We try very hard to avoid doing text-processing in Varnish, and this is one way we do that, by not editing separate pieces of a sting together to one string, until we need to.r'…r(}r)(hj$hj"ubaubh<)r*}r+(hX!Consider this contrived example::hjhh!h#h@h%}r,(h']h(]h)]h*]h,]uh.K–h]r-h8X Consider this contrived example:r.…r/}r0(hX Consider this contrived example:hj*ubaubhV)r1}r2(hX>set bereq.http.foo = std.toupper(req.http.foo + req.http.bar);hjh#hYh%}r3(h[h\h*]h)]h']h(]h,]uh.K˜h]r4h8X>set bereq.http.foo = std.toupper(req.http.foo + req.http.bar);r5…r6}r7(hUhj1ubaubh<)r8}r9(hXThe 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.hjhh!h#h@h%}r:(h']h(]h)]h*]h,]uh.Kšh]r;(h8XhThe usual way to do this, would be be to allocate memory for the concatenated string, then pass that to r<…r=}r>(hXhThe usual way to do this, would be be to allocate memory for the concatenated string, then pass that to hj8ubhê)r?}r@(hX ``toupper()``h%}rA(h']h(]h)]h*]h,]uhj8h]rBh8X toupper()rC…rD}rE(hUhj?ubah#hòubh8Xu which in turn would return another freshly allocated string with the modified result. Remember: strings in VCL are rF…rG}rH(hXu which in turn would return another freshly allocated string with the modified result. Remember: strings in VCL are hj8ubhê)rI}rJ(hX ``const``h%}rK(h']h(]h)]h*]h,]uhj8h]rLh8XconstrM…rN}rO(hUhjIubah#hòubh8X,, we cannot just modify the string in place.rP…rQ}rR(hX,, we cannot just modify the string in place.hj8ubeubh<)rS}rT(hXAWhat 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.hjhh!h#h@h%}rU(h']h(]h)]h*]h,]uh.K h]rV(h8X$What we do instead, is declare that rW…rX}rY(hX$What we do instead, is declare that hjSubhê)rZ}r[(hX ``toupper()``h%}r\(h']h(]h)]h*]h,]uhjSh]r]h8X toupper()r^…r_}r`(hUhjZubah#hòubh8XL takes a "STRING_LIST" as argument. This makes the C function implementing ra…rb}rc(hXL takes a "STRING_LIST" as argument. This makes the C function implementing hjSubhê)rd}re(hX ``toupper()``h%}rf(h']h(]h)]h*]h,]uhjSh]rgh8X toupper()rh…ri}rj(hUhjdubah#hòubh8XU a vararg function (see the prototype above) and responsible for considering all the rk…rl}rm(hXU a vararg function (see the prototype above) and responsible for considering all the hjSubhê)rn}ro(hX``const char *``h%}rp(h']h(]h)]h*]h,]uhjSh]rqh8X const char *rr…rs}rt(hUhjnubah#hòubh8XR arguments it finds, until the magic marker "vrt_magic_string_end" is encountered.ru…rv}rw(hXR arguments it finds, until the magic marker "vrt_magic_string_end" is encountered.hjSubeubh<)rx}ry(hX“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.rzhjhh!h#h@h%}r{(h']h(]h)]h*]h,]uh.K¦h]r|h8X“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.r}…r~}r(hjzhjxubaubh<)r€}r(hXpRight now we only support STRING_LIST being the last argument to a function, we may relax that at a latter time.r‚hjhh!h#h@h%}rƒ(h']h(]h)]h*]h,]uh.Kªh]r„h8XpRight now we only support STRING_LIST being the last argument to a function, we may relax that at a latter time.r……r†}r‡(hj‚hj€ubaubh<)rˆ}r‰(hX{If you don't want to bother with STRING_LIST, just use STRING and make sure your thread_pool_workspace param is big enough.rŠhjhh!h#h@h%}r‹(h']h(]h)]h*]h,]uh.K­h]rŒh8X{If you don't want to bother with STRING_LIST, just use STRING and make sure your thread_pool_workspace param is big enough.r…rŽ}r(hjŠhjˆubaubeh#j=ubeubj)r}r‘(hXPRIV_VCL See below hj hh!h#jh%}r’(h']h(]h)]h*]h,]uh.K±h/hh]r“(j)r”}r•(hXPRIV_VCLr–hjhh!h#jh%}r—(h']h(]h)]h*]h,]uh.K±h]r˜h8XPRIV_VCLr™…rš}r›(hj–hj”ubaubj")rœ}r(hUh%}rž(h']h(]h)]h*]h,]uhjh]rŸh<)r }r¡(hX See belowr¢hjœhh!h#h@h%}r£(h']h(]h)]h*]h,]uh.K±h]r¤h8X See belowr¥…r¦}r§(hj¢hj ubaubah#j=ubeubj)r¨}r©(hXPRIV_CALL See below hj hh!h#jh%}rª(h']h(]h)]h*]h,]uh.K´h/hh]r«(j)r¬}r­(hX PRIV_CALLr®hj¨hh!h#jh%}r¯(h']h(]h)]h*]h,]uh.K´h]r°h8X PRIV_CALLr±…r²}r³(hj®hj¬ubaubj")r´}rµ(hUh%}r¶(h']h(]h)]h*]h,]uhj¨h]r·h<)r¸}r¹(hX See belowrºhj´hh!h#h@h%}r»(h']h(]h)]h*]h,]uh.K´h]r¼h8X See belowr½…r¾}r¿(hjºhj¸ubaubah#j=ubeubj)rÀ}rÁ(hXdVOID C-type: ``void`` Can only be used for return-value, which makes the function a VCL procedure. hj hh!h#jh%}rÂ(h']h(]h)]h*]h,]uh.Kºh/hh]rÃ(j)rÄ}rÅ(hXVOIDrÆhjÀhh!h#jh%}rÇ(h']h(]h)]h*]h,]uh.Kºh]rÈh8XVOIDrÉ…rÊ}rË(hjÆhjÄubaubj")rÌ}rÍ(hUh%}rÎ(h']h(]h)]h*]h,]uhjÀh]rÏ(h<)rÐ}rÑ(hXC-type: ``void``hjÌhh!h#h@h%}rÒ(h']h(]h)]h*]h,]uh.K·h]rÓ(h8XC-type: rÔ…rÕ}rÖ(hXC-type: hjÐubhê)r×}rØ(hX``void``h%}rÙ(h']h(]h)]h*]h,]uhjÐh]rÚh8XvoidrÛ…rÜ}rÝ(hUhj×ubah#hòubeubh<)rÞ}rß(hXLCan only be used for return-value, which makes the function a VCL procedure.ràhjÌhh!h#h@h%}rá(h']h(]h)]h*]h,]uh.K¹h]râh8XLCan only be used for return-value, which makes the function a VCL procedure.rã…rä}rå(hjàhjÞubaubeh#j=ubeubj)ræ}rç(hX@HEADER C-type: ``enum gethdr_e, const char *`` XXX: explain me hj hh!h#jh%}rè(h']h(]h)]h*]h,]uh.K¿h/hh]ré(j)rê}rë(hXHEADERrìhjæhh!h#jh%}rí(h']h(]h)]h*]h,]uh.K¿h]rîh8XHEADERrï…rð}rñ(hjìhjêubaubj")rò}ró(hUh%}rô(h']h(]h)]h*]h,]uhjæh]rõ(h<)rö}r÷(hX'C-type: ``enum gethdr_e, const char *``hjòhh!h#h@h%}rø(h']h(]h)]h*]h,]uh.K½h]rù(h8XC-type: rú…rû}rü(hXC-type: hjöubhê)rý}rþ(hX``enum gethdr_e, const char *``h%}rÿ(h']h(]h)]h*]h,]uhjöh]rh8Xenum gethdr_e, const char *r…r}r(hUhjýubah#hòubeubh<)r}r(hXXXX: explain merhjòhh!h#h@h%}r(h']h(]h)]h*]h,]uh.K¿h]rh8XXXX: explain mer …r }r (hjhjubaubeh#j=ubeubj)r }r (hXBIP, BOOL XXX: these types are not released for use in vmods yet. hj hh!h#jh%}r(h']h(]h)]h*]h,]uh.KÃh/hh]r(j)r}r(hXIP, BOOLrhj hh!h#jh%}r(h']h(]h)]h*]h,]uh.KÃh]rh8XIP, BOOLr…r}r(hjhjubaubj")r}r(hUh%}r(h']h(]h)]h*]h,]uhj h]rh<)r}r(hX7XXX: these types are not released for use in vmods yet.rhjhh!h#h@h%}r(h']h(]h)]h*]h,]uh.KÂh]r h8X7XXX: these types are not released for use in vmods yet.r!…r"}r#(hjhjubaubah#j=ubeubeubeubh)r$}r%(hUhhhh!h#h$h%}r&(h']h(]h)]h*]r'hah,]r(h auh.KÆh/hh]r)(h1)r*}r+(hXPrivate Pointersr,hj$hh!h#h5h%}r-(h']h(]h)]h*]h,]uh.KÆh/hh]r.h8XPrivate Pointersr/…r0}r1(hj,hj*ubaubh<)r2}r3(hX£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.r4hj$hh!h#h@h%}r5(h']h(]h)]h*]h,]uh.KÈh/hh]r6h8X£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.r7…r8}r9(hj4hj2ubaubh<)r:}r;(hXRThe VCL compiler supports two levels of private pointers, "per call" and "per VCL"r<hj$hh!h#h@h%}r=(h']h(]h)]h*]h,]uh.KÌh/hh]r>h8XRThe VCL compiler supports two levels of private pointers, "per call" and "per VCL"r?…r@}rA(hj<hj:ubaubh<)rB}rC(hXõ"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.rDhj$hh!h#h@h%}rE(h']h(]h)]h*]h,]uh.KÏh/hh]rFh8Xõ"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.rG…rH}rI(hjDhjBubaubh<)rJ}rK(hXÇ"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.rLhj$hh!h#h@h%}rM(h']h(]h)]h*]h,]uh.KÔh/hh]rNh8XÇ"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.rO…rP}rQ(hjLhjJubaubh<)rR}rS(hX–The way it works in the vmod code, is that a ``struct vmod_priv *`` is passed to the functions where argument type PRIV_VCL or PRIV_CALL is specified.hj$hh!h#h@h%}rT(h']h(]h)]h*]h,]uh.KØh/hh]rU(h8X-The way it works in the vmod code, is that a rV…rW}rX(hX-The way it works in the vmod code, is that a hjRubhê)rY}rZ(hX``struct vmod_priv *``h%}r[(h']h(]h)]h*]h,]uhjRh]r\h8Xstruct vmod_priv *r]…r^}r_(hUhjYubah#hòubh8XS is passed to the functions where argument type PRIV_VCL or PRIV_CALL is specified.r`…ra}rb(hXS is passed to the functions where argument type PRIV_VCL or PRIV_CALL is specified.hjRubeubh<)rc}rd(hX%This structure contains two members::rehj$hh!h#h@h%}rf(h']h(]h)]h*]h,]uh.KÜh/hh]rgh8X$This structure contains two members:rh…ri}rj(hX$This structure contains two members:hjcubaubhV)rk}rl(hXŠtypedef void vmod_priv_free_f(void *); struct vmod_priv { void *priv; vmod_priv_free_f *free; };hj$hh!h#hYh%}rm(h[h\h*]h)]h']h(]h,]uh.KÞh/hh]rnh8XŠtypedef void vmod_priv_free_f(void *); struct vmod_priv { void *priv; vmod_priv_free_f *free; };ro…rp}rq(hUhjkubaubh<)rr}rs(hXmThe "priv" element can be used for whatever the vmod code wants to use it for, it defaults to a NULL pointer.rthj$hh!h#h@h%}ru(h']h(]h)]h*]h,]uh.Käh/hh]rvh8XmThe "priv" element can be used for whatever the vmod code wants to use it for, it defaults to a NULL pointer.rw…rx}ry(hjthjrubaubh<)rz}r{(hX¥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.r|hj$hh!h#h@h%}r}(h']h(]h)]h*]h,]uh.Kçh/hh]r~h8X¥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.r…r€}r(hj|hjzubaubh<)r‚}rƒ(hXWhen 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 only argument. The "per vcl" pointers is guaranteed to be the last one inspected.r„hj$hh!h#h@h%}r…(h']h(]h)]h*]h,]uh.Këh/hh]r†h8XWhen 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 only argument. The "per vcl" pointers is guaranteed to be the last one inspected.r‡…rˆ}r‰(hj„hj‚ubaubeubeubahUU transformerrŠNU footnote_refsr‹}rŒUrefnamesr}rŽUsymbol_footnotesr]rUautofootnote_refsr‘]r’Usymbol_footnote_refsr“]r”U citationsr•]r–h/hU current_liner—NUtransform_messagesr˜]r™UreporterršNUid_startr›KU autofootnotesrœ]rU citation_refsrž}rŸUindirect_targetsr ]r¡Usettingsr¢(cdocutils.frontend Values r£or¤}r¥(Ufootnote_backlinksr¦KUrecord_dependenciesr§NU rfc_base_urlr¨Uhttp://tools.ietf.org/html/r©U tracebackrªˆUpep_referencesr«NUstrip_commentsr¬NU toc_backlinksr­Uentryr®U language_coder¯Uenr°U datestampr±NU report_levelr²KU _destinationr³NU halt_levelr´KU strip_classesrµNh5NUerror_encoding_error_handlerr¶Ubackslashreplacer·Udebugr¸NUembed_stylesheetr¹‰Uoutput_encoding_error_handlerrºUstrictr»U sectnum_xformr¼KUdump_transformsr½NU docinfo_xformr¾KUwarning_streamr¿NUpep_file_url_templaterÀUpep-%04drÁUexit_status_levelrÂKUconfigrÃNUstrict_visitorrÄNUcloak_email_addressesrňUtrim_footnote_reference_spacerƉUenvrÇNUdump_pseudo_xmlrÈNUexpose_internalsrÉNUsectsubtitle_xformrʉU source_linkrËNUrfc_referencesrÌNUoutput_encodingrÍUutf-8rÎU source_urlrÏNUinput_encodingrÐU utf-8-sigrÑU_disable_configrÒNU id_prefixrÓUU tab_widthrÔKUerror_encodingrÕUUTF-8rÖU_sourcer×U2/home/tfheen/varnish/doc/sphinx/reference/vmod.rstrØUgettext_compactrÙˆU generatorrÚNUdump_internalsrÛNU smart_quotesr܉U pep_base_urlrÝUhttp://www.python.org/dev/peps/rÞUsyntax_highlightrßUlongràUinput_encoding_error_handlerráj»Uauto_id_prefixrâUidrãUdoctitle_xformrä‰Ustrip_elements_with_classesråNU _config_filesræ]Ufile_insertion_enabledrçKU raw_enabledrèKU dump_settingsréNubUsymbol_footnote_startrêKUidsrë}rì(hhhhöhj$hhquUsubstitution_namesrí}rîh#h/h%}rï(h']h*]h)]Usourceh!h(]h,]uU footnotesrð]rñUrefidsrò}róub.varnish-3.0.5/doc/sphinx/=build/doctrees/reference/varnishtest.doctree0000644000175000017500000005675112247037213023072 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(X descriptionqNX copyrightqNXtest program for varnishqNXsynopsisq NX varnishtestq NXscriptsq NXsee alsoq NXhistoryq NuUsubstitution_defsq}qUparse_messagesq]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hU descriptionqhU copyrightqhUtest-program-for-varnishqh Usynopsisqh U varnishtestqh Uscriptsqh Usee-alsoqh UhistoryquUchildrenq]q cdocutils.nodes section q!)q"}q#(U rawsourceq$UUparentq%hUsourceq&cdocutils.nodes reprunicode q'X9/home/tfheen/varnish/doc/sphinx/reference/varnishtest.rstq(…q)}q*bUtagnameq+Usectionq,U attributesq-}q.(Udupnamesq/]Uclassesq0]Ubackrefsq1]Uidsq2]q3haUnamesq4]q5h auUlineq6KUdocumentq7hh]q8(cdocutils.nodes title q9)q:}q;(h$X varnishtestq(h/]h0]h1]h2]h4]uh6Kh7hh]q?cdocutils.nodes Text q@X varnishtestqA…qB}qC(h$h(h$Uh%j8ubah+U option_stringr?ubah+Uoptionr@ubah+U option_grouprAubcdocutils.nodes description rB)rC}rD(h$XFind varnishd in build tree h-}rE(h/]h0]h1]h2]h4]uh%j'h]rFhn)rG}rH(h$XFind varnishd in build treerIh%jCh&h)h+hqh-}rJ(h/]h0]h1]h2]h4]uh6K$h]rKh@XFind varnishd in build treerL…rM}rN(h$jIh%jGubaubah+U descriptionrOubeubj&)rP}rQ(h$Uh%j!h&h)h+j)h-}rR(h/]h0]h1]h2]h4]uh6Nh7hh]rS(j,)rT}rU(h$Uh-}rV(h/]h0]h1]h2]h4]uh%jPh]rWj1)rX}rY(h$X-j jobsh-}rZ(h/]h0]h1]h2]h4]uh%jTh]r[(j7)r\}r](h$X-jh-}r^(h/]h0]h1]h2]h4]uh%jXh]r_h@X-jr`…ra}rb(h$Uh%j\ubah+j?ubcdocutils.nodes option_argument rc)rd}re(h$Xjobsh-}rf(h2]h1]h/]U delimiterU h0]h4]uh%jXh]rgh@Xjobsrh…ri}rj(h$Uh%jdubah+Uoption_argumentrkubeh+j@ubah+jAubjB)rl}rm(h$X Run this many tests in parallel h-}rn(h/]h0]h1]h2]h4]uh%jPh]rohn)rp}rq(h$XRun this many tests in parallelrrh%jlh&h)h+hqh-}rs(h/]h0]h1]h2]h4]uh6K&h]rth@XRun this many tests in parallelru…rv}rw(h$jrh%jpubaubah+jOubeubj&)rx}ry(h$Uh%j!h&h)h+j)h-}rz(h/]h0]h1]h2]h4]uh6Nh7hh]r{(j,)r|}r}(h$Uh-}r~(h/]h0]h1]h2]h4]uh%jxh]rj1)r€}r(h$X-kr‚h-}rƒ(h/]h0]h1]h2]h4]uh%j|h]r„j7)r…}r†(h$j‚h-}r‡(h/]h0]h1]h2]h4]uh%j€h]rˆh@X-kr‰…rŠ}r‹(h$Uh%j…ubah+j?ubah+j@ubah+jAubjB)rŒ}r(h$XContinue on test failure h-}rŽ(h/]h0]h1]h2]h4]uh%jxh]rhn)r}r‘(h$XContinue on test failurer’h%jŒh&h)h+hqh-}r“(h/]h0]h1]h2]h4]uh6K(h]r”h@XContinue on test failurer•…r–}r—(h$j’h%jubaubah+jOubeubj&)r˜}r™(h$Uh%j!h&h)h+j)h-}rš(h/]h0]h1]h2]h4]uh6Nh7hh]r›(j,)rœ}r(h$Uh-}rž(h/]h0]h1]h2]h4]uh%j˜h]rŸj1)r }r¡(h$X-lr¢h-}r£(h/]h0]h1]h2]h4]uh%jœh]r¤j7)r¥}r¦(h$j¢h-}r§(h/]h0]h1]h2]h4]uh%j h]r¨h@X-lr©…rª}r«(h$Uh%j¥ubah+j?ubah+j@ubah+jAubjB)r¬}r­(h$XLeave /tmp/vtc.* if test fails h-}r®(h/]h0]h1]h2]h4]uh%j˜h]r¯hn)r°}r±(h$XLeave /tmp/vtc.* if test failsr²h%j¬h&h)h+hqh-}r³(h/]h0]h1]h2]h4]uh6K*h]r´h@XLeave /tmp/vtc.* if test failsrµ…r¶}r·(h$j²h%j°ubaubah+jOubeubj&)r¸}r¹(h$Uh%j!h&h)h+j)h-}rº(h/]h0]h1]h2]h4]uh6Nh7hh]r»(j,)r¼}r½(h$Uh-}r¾(h/]h0]h1]h2]h4]uh%j¸h]r¿j1)rÀ}rÁ(h$X-LrÂh-}rÃ(h/]h0]h1]h2]h4]uh%j¼h]rÄj7)rÅ}rÆ(h$jÂh-}rÇ(h/]h0]h1]h2]h4]uh%jÀh]rÈh@X-LrÉ…rÊ}rË(h$Uh%jÅubah+j?ubah+j@ubah+jAubjB)rÌ}rÍ(h$XAlways leave /tmp/vtc.* h-}rÎ(h/]h0]h1]h2]h4]uh%j¸h]rÏhn)rÐ}rÑ(h$XAlways leave /tmp/vtc.*rÒh%jÌh&h)h+hqh-}rÓ(h/]h0]h1]h2]h4]uh6K,h]rÔh@XAlways leave /tmp/vtc.*rÕ…rÖ}r×(h$jÒh%jÐubaubah+jOubeubj&)rØ}rÙ(h$Uh%j!h&h)h+j)h-}rÚ(h/]h0]h1]h2]h4]uh6Nh7hh]rÛ(j,)rÜ}rÝ(h$Uh-}rÞ(h/]h0]h1]h2]h4]uh%jØh]rßj1)rà}rá(h$X -n iterationsh-}râ(h/]h0]h1]h2]h4]uh%jÜh]rã(j7)rä}rå(h$X-nh-}ræ(h/]h0]h1]h2]h4]uh%jàh]rçh@X-nrè…ré}rê(h$Uh%jäubah+j?ubjc)rë}rì(h$X iterationsh-}rí(h2]h1]h/]U delimiterU h0]h4]uh%jàh]rîh@X iterationsrï…rð}rñ(h$Uh%jëubah+jkubeh+j@ubah+jAubjB)rò}ró(h$XRun tests this many times h-}rô(h/]h0]h1]h2]h4]uh%jØh]rõhn)rö}r÷(h$XRun tests this many timesrøh%jòh&h)h+hqh-}rù(h/]h0]h1]h2]h4]uh6K.h]rúh@XRun tests this many timesrû…rü}rý(h$jøh%jöubaubah+jOubeubj&)rþ}rÿ(h$Uh%j!h&h)h+j)h-}r(h/]h0]h1]h2]h4]uh6Nh7hh]r(j,)r}r(h$Uh-}r(h/]h0]h1]h2]h4]uh%jþh]rj1)r}r(h$X-qrh-}r (h/]h0]h1]h2]h4]uh%jh]r j7)r }r (h$jh-}r (h/]h0]h1]h2]h4]uh%jh]rh@X-qr…r}r(h$Uh%j ubah+j?ubah+j@ubah+jAubjB)r}r(h$X!Quiet mode: report only failures h-}r(h/]h0]h1]h2]h4]uh%jþh]rhn)r}r(h$X Quiet mode: report only failuresrh%jh&h)h+hqh-}r(h/]h0]h1]h2]h4]uh6K0h]rh@X Quiet mode: report only failuresr…r}r(h$jh%jubaubah+jOubeubj&)r}r(h$Uh%j!h&h)h+j)h-}r (h/]h0]h1]h2]h4]uh6Nh7hh]r!(j,)r"}r#(h$Uh-}r$(h/]h0]h1]h2]h4]uh%jh]r%j1)r&}r'(h$X -t durationh-}r((h/]h0]h1]h2]h4]uh%j"h]r)(j7)r*}r+(h$X-th-}r,(h/]h0]h1]h2]h4]uh%j&h]r-h@X-tr.…r/}r0(h$Uh%j*ubah+j?ubjc)r1}r2(h$Xdurationh-}r3(h2]h1]h/]U delimiterU h0]h4]uh%j&h]r4h@Xdurationr5…r6}r7(h$Uh%j1ubah+jkubeh+j@ubah+jAubjB)r8}r9(h$XTime tests out after this long h-}r:(h/]h0]h1]h2]h4]uh%jh]r;hn)r<}r=(h$XTime tests out after this longr>h%j8h&h)h+hqh-}r?(h/]h0]h1]h2]h4]uh6K2h]r@h@XTime tests out after this longrA…rB}rC(h$j>h%j<ubaubah+jOubeubj&)rD}rE(h$Uh%j!h&h)h+j)h-}rF(h/]h0]h1]h2]h4]uh6Nh7hh]rG(j,)rH}rI(h$Uh-}rJ(h/]h0]h1]h2]h4]uh%jDh]rKj1)rL}rM(h$X-vrNh-}rO(h/]h0]h1]h2]h4]uh%jHh]rPj7)rQ}rR(h$jNh-}rS(h/]h0]h1]h2]h4]uh%jLh]rTh@X-vrU…rV}rW(h$Uh%jQubah+j?ubah+j@ubah+jAubjB)rX}rY(h$X%Verbose mode: always report test log h-}rZ(h/]h0]h1]h2]h4]uh%jDh]r[hn)r\}r](h$X$Verbose mode: always report test logr^h%jXh&h)h+hqh-}r_(h/]h0]h1]h2]h4]uh6K4h]r`h@X$Verbose mode: always report test logra…rb}rc(h$j^h%j\ubaubah+jOubeubj&)rd}re(h$Uh%j!h&h)h+j)h-}rf(h/]h0]h1]h2]h4]uh6Nh7hh]rg(j,)rh}ri(h$Uh-}rj(h/]h0]h1]h2]h4]uh%jdh]rkj1)rl}rm(h$X-hrnh-}ro(h/]h0]h1]h2]h4]uh%jhh]rpj7)rq}rr(h$jnh-}rs(h/]h0]h1]h2]h4]uh%jlh]rth@X-hru…rv}rw(h$Uh%jqubah+j?ubah+j@ubah+jAubjB)rx}ry(h$X Show help h-}rz(h/]h0]h1]h2]h4]uh%jdh]r{hn)r|}r}(h$X Show helpr~h%jxh&h)h+hqh-}r(h/]h0]h1]h2]h4]uh6K6h]r€h@X Show helpr…r‚}rƒ(h$j~h%j|ubaubah+jOubeubeubhn)r„}r…(h$X(file File to use as a scriptr†h%hòh&h)h+hqh-}r‡(h/]h0]h1]h2]h4]uh6K8h7hh]rˆh@X(file File to use as a scriptr‰…rŠ}r‹(h$j†h%j„ubaubhn)rŒ}r(h$X)Macro definitions that can be overridden.rŽh%hòh&h)h+hqh-}r(h/]h0]h1]h2]h4]uh6K;h7hh]rh@X)Macro definitions that can be overridden.r‘…r’}r“(h$jŽh%jŒubaubhn)r”}r•(h$X3varnishd Path to varnishd to use [varnishd]r–h%hòh&h)h+hqh-}r—(h/]h0]h1]h2]h4]uh6K=h7hh]r˜h@X3varnishd Path to varnishd to use [varnishd]r™…rš}r›(h$j–h%j”ubaubeubh!)rœ}r(h$Uh%hDh&h)h+h,h-}rž(h/]h0]h1]h2]rŸhah4]r h auh6KAh7hh]r¡(h9)r¢}r£(h$XSCRIPTSr¤h%jœh&h)h+h=h-}r¥(h/]h0]h1]h2]h4]uh6KAh7hh]r¦h@XSCRIPTSr§…r¨}r©(h$j¤h%j¢ubaubhn)rª}r«(h$X 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.h%jœh&h)h+hqh-}r¬(h/]h0]h1]h2]h4]uh6KCh7hh]r­(h@XÄ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 r®…r¯}r°(h$XÄ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 h%jªubcdocutils.nodes title_reference r±)r²}r³(h$X`bin/varnishtest/tests/`h-}r´(h/]h0]h1]h2]h4]uh%jªh]rµh@Xbin/varnishtest/tests/r¶…r·}r¸(h$Uh%j²ubah+Utitle_referencer¹ubh@X0, all the regression tests for Varnish are kept.rº…r»}r¼(h$X0, all the regression tests for Varnish are kept.h%jªubeubhn)r½}r¾(h$X An example::r¿h%jœh&h)h+hqh-}rÀ(h/]h0]h1]h2]h4]uh6KHh7hh]rÁh@X An example:rÂ…rÃ}rÄ(h$X An example:h%j½ubaubcdocutils.nodes literal_block rÅ)rÆ}rÇ(h$Xý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_fetch { set beresp.do_esi = true; if (req.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 } -runh%jœh&h)h+U literal_blockrÈh-}rÉ(U xml:spacerÊUpreserverËh2]h1]h/]h0]h4]uh6KJh7hh]rÌh@Xý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_fetch { set beresp.do_esi = true; if (req.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 } -runrÍ…rÎ}rÏ(h$Uh%jÆubaubhn)rÐ}rÑ(h$XWhen 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.rÒh%jœh&h)h+hqh-}rÓ(h/]h0]h1]h2]h4]uh6Kmh7hh]rÔh@XWhen 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.rÕ…rÖ}r×(h$jÒh%jÐubaubeubh!)rØ}rÙ(h$Uh%hDh&h)h+h,h-}rÚ(h/]h0]h1]h2]rÛhah4]rÜh auh6Ksh7hh]rÝ(h9)rÞ}rß(h$XSEE ALSOràh%jØh&h)h+h=h-}rá(h/]h0]h1]h2]h4]uh6Ksh7hh]râh@XSEE ALSOrã…rä}rå(h$jàh%jÞubaubcdocutils.nodes bullet_list ræ)rç}rè(h$Uh%jØh&h)h+U bullet_listréh-}rê(UbulletrëX*h2]h1]h/]h0]h4]uh6Kuh7hh]rì(cdocutils.nodes list_item rí)rî}rï(h$X-varnishtest source code repository with testsrðh%jçh&h)h+U list_itemrñh-}rò(h/]h0]h1]h2]h4]uh6Nh7hh]róhn)rô}rõ(h$jðh%jîh&h)h+hqh-}rö(h/]h0]h1]h2]h4]uh6Kuh]r÷h@X-varnishtest source code repository with testsrø…rù}rú(h$jðh%jôubaubaubjí)rû}rü(h$Xvarnishhist(1)rýh%jçh&h)h+jñh-}rþ(h/]h0]h1]h2]h4]uh6Nh7hh]rÿhn)r}r(h$jýh%jûh&h)h+hqh-}r(h/]h0]h1]h2]h4]uh6Kvh]rh@Xvarnishhist(1)r…r}r(h$jýh%jubaubaubjí)r}r(h$X varnishlog(1)r h%jçh&h)h+jñh-}r (h/]h0]h1]h2]h4]uh6Nh7hh]r hn)r }r (h$j h%jh&h)h+hqh-}r(h/]h0]h1]h2]h4]uh6Kwh]rh@X varnishlog(1)r…r}r(h$j h%j ubaubaubjí)r}r(h$Xvarnishncsa(1)rh%jçh&h)h+jñh-}r(h/]h0]h1]h2]h4]uh6Nh7hh]rhn)r}r(h$jh%jh&h)h+hqh-}r(h/]h0]h1]h2]h4]uh6Kxh]rh@Xvarnishncsa(1)r…r}r(h$jh%jubaubaubjí)r}r (h$Xvarnishstat(1)r!h%jçh&h)h+jñh-}r"(h/]h0]h1]h2]h4]uh6Nh7hh]r#hn)r$}r%(h$j!h%jh&h)h+hqh-}r&(h/]h0]h1]h2]h4]uh6Kyh]r'h@Xvarnishstat(1)r(…r)}r*(h$j!h%j$ubaubaubjí)r+}r,(h$X varnishtop(1)r-h%jçh&h)h+jñh-}r.(h/]h0]h1]h2]h4]uh6Nh7hh]r/hn)r0}r1(h$j-h%j+h&h)h+hqh-}r2(h/]h0]h1]h2]h4]uh6Kzh]r3h@X varnishtop(1)r4…r5}r6(h$j-h%j0ubaubaubjí)r7}r8(h$Xvcl(7) h%jçh&h)h+jñh-}r9(h/]h0]h1]h2]h4]uh6Nh7hh]r:hn)r;}r<(h$Xvcl(7)r=h%j7h&h)h+hqh-}r>(h/]h0]h1]h2]h4]uh6K{h]r?h@Xvcl(7)r@…rA}rB(h$j=h%j;ubaubaubeubeubh!)rC}rD(h$Uh%hDh&h)h+h,h-}rE(h/]h0]h1]h2]rFhah4]rGh auh6K~h7hh]rH(h9)rI}rJ(h$XHISTORYrKh%jCh&h)h+h=h-}rL(h/]h0]h1]h2]h4]uh6K~h7hh]rMh@XHISTORYrN…rO}rP(h$jKh%jIubaubhn)rQ}rR(h$XThe 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).h%jCh&h)h+hqh-}rS(h/]h0]h1]h2]h4]uh6K€h7hh]rT(h@X>The varnishtest program was developed by Poul-Henning Kamp ⟨rU…rV}rW(h$X>The varnishtest program was developed by Poul-Henning Kamp ⟨h%jQubcdocutils.nodes reference rX)rY}rZ(h$Xphk@phk.freebsd.dkh-}r[(UrefuriXmailto:phk@phk.freebsd.dkh2]h1]h/]h0]h4]uh%jQh]r\h@Xphk@phk.freebsd.dkr]…r^}r_(h$Uh%jYubah+U referencer`ubh@Xr⟩ in cooperation with Varnish Software AS. This manual page was originally written by Stig Sandbeck Mathisen ⟨ra…rb}rc(h$Xr⟩ in cooperation with Varnish Software AS. This manual page was originally written by Stig Sandbeck Mathisen ⟨h%jQubjX)rd}re(h$X ssm@linpro.noh-}rf(UrefuriXmailto:ssm@linpro.noh2]h1]h/]h0]h4]uh%jQh]rgh@X ssm@linpro.norh…ri}rj(h$Uh%jdubah+j`ubh@X'⟩ and updated by Kristian Lyngstøl (rk…rl}rm(h$X'⟩ and updated by Kristian Lyngstøl (h%jQubjX)rn}ro(h$Xkristian@varnish-cache.orgh-}rp(UrefuriX!mailto:kristian@varnish-cache.orgh2]h1]h/]h0]h4]uh%jQh]rqh@Xkristian@varnish-cache.orgrr…rs}rt(h$Uh%jnubah+j`ubh@X).ru…rv}rw(h$X).h%jQubeubeubh!)rx}ry(h$Uh%hDh&h)h+h,h-}rz(h/]h0]h1]h2]r{hah4]r|hauh6K‡h7hh]r}(h9)r~}r(h$X COPYRIGHTr€h%jxh&h)h+h=h-}r(h/]h0]h1]h2]h4]uh6K‡h7hh]r‚h@X COPYRIGHTrƒ…r„}r…(h$j€h%j~ubaubhn)r†}r‡(h$X\This document is licensed under the same licence as Varnish itself. See LICENCE for details.rˆh%jxh&h)h+hqh-}r‰(h/]h0]h1]h2]h4]uh6K‰h7hh]rŠh@X\This document is licensed under the same licence as Varnish itself. See LICENCE for details.r‹…rŒ}r(h$jˆh%j†ubaubjæ)rŽ}r(h$Uh%jxh&h)h+jéh-}r(jëX*h2]h1]h/]h0]h4]uh6KŒh7hh]r‘jí)r’}r“(h$X+Copyright (c) 2007-2011 Varnish Software ASr”h%jŽh&h)h+jñh-}r•(h/]h0]h1]h2]h4]uh6Nh7hh]r–hn)r—}r˜(h$j”h%j’h&h)h+hqh-}r™(h/]h0]h1]h2]h4]uh6KŒh]ršh@X+Copyright (c) 2007-2011 Varnish Software ASr›…rœ}r(h$j”h%j—ubaubaubaubeubeubeubah$UU transformerržNU footnote_refsrŸ}r Urefnamesr¡}r¢Usymbol_footnotesr£]r¤Uautofootnote_refsr¥]r¦Usymbol_footnote_refsr§]r¨U citationsr©]rªh7hU current_liner«NUtransform_messagesr¬]r­Ureporterr®NUid_startr¯KU autofootnotesr°]r±U citation_refsr²}r³Uindirect_targetsr´]rµUsettingsr¶(cdocutils.frontend Values r·or¸}r¹(Ufootnote_backlinksrºKUrecord_dependenciesr»NU rfc_base_urlr¼Uhttp://tools.ietf.org/html/r½U tracebackr¾ˆUpep_referencesr¿NUstrip_commentsrÀNU toc_backlinksrÁUentryrÂU language_coderÃUenrÄU datestamprÅNU report_levelrÆKU _destinationrÇNU halt_levelrÈKU strip_classesrÉNh=NUerror_encoding_error_handlerrÊUbackslashreplacerËUdebugrÌNUembed_stylesheetr͉Uoutput_encoding_error_handlerrÎUstrictrÏU sectnum_xformrÐKUdump_transformsrÑNU docinfo_xformrÒKUwarning_streamrÓNUpep_file_url_templaterÔUpep-%04drÕUexit_status_levelrÖKUconfigr×NUstrict_visitorrØNUcloak_email_addressesrÙˆUtrim_footnote_reference_spacerÚ‰UenvrÛNUdump_pseudo_xmlrÜNUexpose_internalsrÝNUsectsubtitle_xformrÞ‰U source_linkrßNUrfc_referencesràNUoutput_encodingráUutf-8râU source_urlrãNUinput_encodingräU utf-8-sigråU_disable_configræNU id_prefixrçUU tab_widthrèKUerror_encodingréUUTF-8rêU_sourcerëU9/home/tfheen/varnish/doc/sphinx/reference/varnishtest.rstrìUgettext_compactríˆU generatorrîNUdump_internalsrïNU smart_quotesrð‰U pep_base_urlrñUhttp://www.python.org/dev/peps/ròUsyntax_highlightróUlongrôUinput_encoding_error_handlerrõjÏUauto_id_prefixröUidr÷Udoctitle_xformrø‰Ustrip_elements_with_classesrùNU _config_filesrú]rûUfile_insertion_enabledrüKU raw_enabledrýKU dump_settingsrþNubUsymbol_footnote_startrÿKUidsr}r(hhDhhòhjxhjØhhÖhh"hjœhjCuUsubstitution_namesr}rh+h7h-}r(h/]h2]h1]Usourceh)h0]h4]uU footnotesr]rUrefidsr}rub.varnish-3.0.5/doc/sphinx/=build/doctrees/reference/varnishhist.doctree0000644000175000017500000005610712247037213023055 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(X descriptionqNX copyrightqNX varnishhistqNXsynopsisq NXsee alsoq NXvarnish request histogramq NXhistoryq NuUsubstitution_defsq }qUparse_messagesq]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hU descriptionqhU copyrightqhU varnishhistqh Usynopsisqh Usee-alsoqh Uvarnish-request-histogramqh UhistoryquUchildrenq]qcdocutils.nodes section q)q }q!(U rawsourceq"UUparentq#hUsourceq$cdocutils.nodes reprunicode q%X9/home/tfheen/varnish/doc/sphinx/reference/varnishhist.rstq&…q'}q(bUtagnameq)Usectionq*U attributesq+}q,(Udupnamesq-]Uclassesq.]Ubackrefsq/]Uidsq0]q1haUnamesq2]q3hauUlineq4KUdocumentq5hh]q6(cdocutils.nodes title q7)q8}q9(h"X varnishhistq:h#h h$h'h)Utitleq;h+}q<(h-]h.]h/]h0]h2]uh4Kh5hh]q=cdocutils.nodes Text q>X varnishhistq?…q@}qA(h"h:h#h8ubaubh)qB}qC(h"Uh#h h$h'h)h*h+}qD(h-]h.]h/]h0]qEhah2]qFh auh4Kh5hh]qG(h7)qH}qI(h"XVarnish request histogramqJh#hBh$h'h)h;h+}qK(h-]h.]h/]h0]h2]uh4Kh5hh]qLh>XVarnish request histogramqM…qN}qO(h"hJh#hHubaubcdocutils.nodes field_list qP)qQ}qR(h"Uh#hBh$h'h)U field_listqSh+}qT(h-]h.]h/]h0]h2]uh4K h5hh]qU(cdocutils.nodes field qV)qW}qX(h"Uh#hQh$h'h)UfieldqYh+}qZ(h-]h.]h/]h0]h2]uh4K h5hh]q[(cdocutils.nodes field_name q\)q]}q^(h"XAuthorq_h+}q`(h-]h.]h/]h0]h2]uh#hWh]qah>XAuthorqb…qc}qd(h"h_h#h]ubah)U field_nameqeubcdocutils.nodes field_body qf)qg}qh(h"XDag-Erling Smørgravqih+}qj(h-]h.]h/]h0]h2]uh#hWh]qkcdocutils.nodes paragraph ql)qm}qn(h"hih#hgh$h'h)U paragraphqoh+}qp(h-]h.]h/]h0]h2]uh4K h]qqh>XDag-Erling Smørgravqr…qs}qt(h"hih#hmubaubah)U field_bodyquubeubhV)qv}qw(h"Uh#hQh$h'h)hYh+}qx(h-]h.]h/]h0]h2]uh4K h5hh]qy(h\)qz}q{(h"XDateq|h+}q}(h-]h.]h/]h0]h2]uh#hvh]q~h>XDateq…q€}q(h"h|h#hzubah)heubhf)q‚}qƒ(h"X 2010-05-31q„h+}q…(h-]h.]h/]h0]h2]uh#hvh]q†hl)q‡}qˆ(h"h„h#h‚h$h'h)hoh+}q‰(h-]h.]h/]h0]h2]uh4K h]qŠh>X 2010-05-31q‹…qŒ}q(h"h„h#h‡ubaubah)huubeubhV)qŽ}q(h"Uh#hQh$h'h)hYh+}q(h-]h.]h/]h0]h2]uh4K h5hh]q‘(h\)q’}q“(h"XVersionq”h+}q•(h-]h.]h/]h0]h2]uh#hŽh]q–h>XVersionq—…q˜}q™(h"h”h#h’ubah)heubhf)qš}q›(h"X1.0qœh+}q(h-]h.]h/]h0]h2]uh#hŽh]qžhl)qŸ}q (h"hœh#hšh$h'h)hoh+}q¡(h-]h.]h/]h0]h2]uh4K h]q¢h>X1.0q£…q¤}q¥(h"hœh#hŸubaubah)huubeubhV)q¦}q§(h"Uh#hQh$h'h)hYh+}q¨(h-]h.]h/]h0]h2]uh4K h5hh]q©(h\)qª}q«(h"XManual sectionq¬h+}q­(h-]h.]h/]h0]h2]uh#h¦h]q®h>XManual sectionq¯…q°}q±(h"h¬h#hªubah)heubhf)q²}q³(h"X1 h+}q´(h-]h.]h/]h0]h2]uh#h¦h]qµhl)q¶}q·(h"X1h#h²h$h'h)hoh+}q¸(h-]h.]h/]h0]h2]uh4K h]q¹h>X1…qº}q»(h"X1h#h¶ubaubah)huubeubeubh)q¼}q½(h"Uh#hBh$h'h)h*h+}q¾(h-]h.]h/]h0]q¿hah2]qÀh auh4Kh5hh]qÁ(h7)qÂ}qÃ(h"XSYNOPSISqÄh#h¼h$h'h)h;h+}qÅ(h-]h.]h/]h0]h2]uh4Kh5hh]qÆh>XSYNOPSISqÇ…qÈ}qÉ(h"hÄh#hÂubaubhl)qÊ}qË(h"X†varnishhist [-b] [-C] [-c] [-d] [-I regex] [-i tag] [-m tag:regex ...] [-n varnish_name] [-r file] [-V] [-w delay] [-X regex] [-x tag]h#h¼h$h'h)hoh+}qÌ(h-]h.]h/]h0]h2]uh4Kh5hh]qÍ(h>X8varnishhist [-b] [-C] [-c] [-d] [-I regex] [-i tag] [-m qÎ…qÏ}qÐ(h"X8varnishhist [-b] [-C] [-c] [-d] [-I regex] [-i tag] [-m h#hÊubcdocutils.nodes reference qÑ)qÒ}qÓ(h"X tag:regexqÔh+}qÕ(UrefurihÔh0]h/]h-]h.]h2]uh#hÊh]qÖh>X tag:regexq×…qØ}qÙ(h"Uh#hÒubah)U referenceqÚubh>XE ...] [-n varnish_name] [-r file] [-V] [-w delay] [-X regex] [-x tag]qÛ…qÜ}qÝ(h"XE ...] [-n varnish_name] [-r file] [-V] [-w delay] [-X regex] [-x tag]h#hÊubeubeubh)qÞ}qß(h"Uh#hBh$h'h)h*h+}qà(h-]h.]h/]h0]qáhah2]qâhauh4Kh5hh]qã(h7)qä}qå(h"X DESCRIPTIONqæh#hÞh$h'h)h;h+}qç(h-]h.]h/]h0]h2]uh4Kh5hh]qèh>X DESCRIPTIONqé…qê}që(h"hæh#häubaubhl)qì}qí(h"X‹The varnishhist utility reads varnishd(1) shared memory logs and presents a continuously updated histogram show†ing the distribution of the last N requests by their processing. The value of N and the vertical scale are dis†played in the top left corner. The horizontal scale is logarithmic. Hits are marked with a pipe character ("|"), and misses are marked with a hash character ("#").h#hÞh$h'h)hoh+}qî(h-]h.]h/]h0]h2]uh4Kh5hh]qïh>X‹The varnishhist utility reads varnishd(1) shared memory logs and presents a continuously updated histogram show†ing the distribution of the last N requests by their processing. The value of N and the vertical scale are dis†played in the top left corner. The horizontal scale is logarithmic. Hits are marked with a pipe character ("|"), and misses are marked with a hash character ("#").qð…qñ}qò(h"X‹The varnishhist utility reads varnishd(1) shared memory logs and presents a continuously updated histogram show†ing the distribution of the last N requests by their processing. The value of N and the vertical scale are dis†played in the top left corner. The horizontal scale is logarithmic. Hits are marked with a pipe character ("|"), and misses are marked with a hash character ("#").h#hìubaubhl)qó}qô(h"X$The following options are available:qõh#hÞh$h'h)hoh+}qö(h-]h.]h/]h0]h2]uh4Kh5hh]q÷h>X$The following options are available:qø…qù}qú(h"hõh#hóubaubcdocutils.nodes option_list qû)qü}qý(h"Uh#hÞh$h'h)U option_listqþh+}qÿ(h-]h.]h/]h0]h2]uh4Nh5hh]r(cdocutils.nodes option_list_item r)r}r(h"Uh#hüh$h'h)Uoption_list_itemrh+}r(h-]h.]h/]h0]h2]uh4Nh5hh]r(cdocutils.nodes option_group r)r}r (h"Uh+}r (h-]h.]h/]h0]h2]uh#jh]r cdocutils.nodes option r )r }r(h"X-brh+}r(h-]h.]h/]h0]h2]uh#jh]rcdocutils.nodes option_string r)r}r(h"jh+}r(h-]h.]h/]h0]h2]uh#j h]rh>X-br…r}r(h"Uh#jubah)U option_stringrubah)Uoptionrubah)U option_grouprubcdocutils.nodes description r)r}r(h"X–Include log entries which result from communication with a backend server. If neither -b nor -c is specified, varnishhist acts as if they both were. h+}r (h-]h.]h/]h0]h2]uh#jh]r!hl)r"}r#(h"X•Include log entries which result from communication with a backend server. If neither -b nor -c is specified, varnishhist acts as if they both were.r$h#jh$h'h)hoh+}r%(h-]h.]h/]h0]h2]uh4K!h]r&h>X•Include log entries which result from communication with a backend server. If neither -b nor -c is specified, varnishhist acts as if they both were.r'…r(}r)(h"j$h#j"ubaubah)U descriptionr*ubeubj)r+}r,(h"Uh#hüh$h'h)jh+}r-(h-]h.]h/]h0]h2]uh4Nh5hh]r.(j)r/}r0(h"Uh+}r1(h-]h.]h/]h0]h2]uh#j+h]r2j )r3}r4(h"X-Cr5h+}r6(h-]h.]h/]h0]h2]uh#j/h]r7j)r8}r9(h"j5h+}r:(h-]h.]h/]h0]h2]uh#j3h]r;h>X-Cr<…r=}r>(h"Uh#j8ubah)jubah)jubah)jubj)r?}r@(h"X/Ignore case when matching regular expressions. h+}rA(h-]h.]h/]h0]h2]uh#j+h]rBhl)rC}rD(h"X.Ignore case when matching regular expressions.rEh#j?h$h'h)hoh+}rF(h-]h.]h/]h0]h2]uh4K%h]rGh>X.Ignore case when matching regular expressions.rH…rI}rJ(h"jEh#jCubaubah)j*ubeubj)rK}rL(h"Uh#hüh$h'h)jh+}rM(h-]h.]h/]h0]h2]uh4Nh5hh]rN(j)rO}rP(h"Uh+}rQ(h-]h.]h/]h0]h2]uh#jKh]rRj )rS}rT(h"X-crUh+}rV(h-]h.]h/]h0]h2]uh#jOh]rWj)rX}rY(h"jUh+}rZ(h-]h.]h/]h0]h2]uh#jSh]r[h>X-cr\…r]}r^(h"Uh#jXubah)jubah)jubah)jubj)r_}r`(h"XŽInclude log entries which result from communication with a client. If neither -b nor -c is specified, varnishhist acts as if they both were. h+}ra(h-]h.]h/]h0]h2]uh#jKh]rbhl)rc}rd(h"XInclude log entries which result from communication with a client. If neither -b nor -c is specified, varnishhist acts as if they both were.reh#j_h$h'h)hoh+}rf(h-]h.]h/]h0]h2]uh4K'h]rgh>XInclude log entries which result from communication with a client. If neither -b nor -c is specified, varnishhist acts as if they both were.rh…ri}rj(h"jeh#jcubaubah)j*ubeubj)rk}rl(h"Uh#hüh$h'h)jh+}rm(h-]h.]h/]h0]h2]uh4Nh5hh]rn(j)ro}rp(h"Uh+}rq(h-]h.]h/]h0]h2]uh#jkh]rrj )rs}rt(h"X-druh+}rv(h-]h.]h/]h0]h2]uh#joh]rwj)rx}ry(h"juh+}rz(h-]h.]h/]h0]h2]uh#jsh]r{h>X-dr|…r}}r~(h"Uh#jxubah)jubah)jubah)jubj)r}r€(h"XƒProcess old log entries on startup. Normally, varnishhist will only process entries which are written to the log after it starts. h+}r(h-]h.]h/]h0]h2]uh#jkh]r‚hl)rƒ}r„(h"X‚Process old log entries on startup. Normally, varnishhist will only process entries which are written to the log after it starts.r…h#jh$h'h)hoh+}r†(h-]h.]h/]h0]h2]uh4K+h]r‡h>X‚Process old log entries on startup. Normally, varnishhist will only process entries which are written to the log after it starts.rˆ…r‰}rŠ(h"j…h#jƒubaubah)j*ubeubj)r‹}rŒ(h"Uh#hüh$h'h)jh+}r(h-]h.]h/]h0]h2]uh4Nh5hh]rŽ(j)r}r(h"Uh+}r‘(h-]h.]h/]h0]h2]uh#j‹h]r’j )r“}r”(h"X-I regexh+}r•(h-]h.]h/]h0]h2]uh#jh]r–(j)r—}r˜(h"X-Ih+}r™(h-]h.]h/]h0]h2]uh#j“h]ršh>X-Ir›…rœ}r(h"Uh#j—ubah)jubcdocutils.nodes option_argument rž)rŸ}r (h"Xregexh+}r¡(h0]h/]h-]U delimiterU h.]h2]uh#j“h]r¢h>Xregexr£…r¤}r¥(h"Uh#jŸubah)Uoption_argumentr¦ubeh)jubah)jubj)r§}r¨(h"X„Include log entries which match the specified regular expression. If neither -I nor -i is specified, all log entries are included. h+}r©(h-]h.]h/]h0]h2]uh#j‹h]rªhl)r«}r¬(h"XƒInclude log entries which match the specified regular expression. If neither -I nor -i is specified, all log entries are included.r­h#j§h$h'h)hoh+}r®(h-]h.]h/]h0]h2]uh4K/h]r¯h>XƒInclude log entries which match the specified regular expression. If neither -I nor -i is specified, all log entries are included.r°…r±}r²(h"j­h#j«ubaubah)j*ubeubj)r³}r´(h"Uh#hüh$h'h)jh+}rµ(h-]h.]h/]h0]h2]uh4Nh5hh]r¶(j)r·}r¸(h"Uh+}r¹(h-]h.]h/]h0]h2]uh#j³h]rºj )r»}r¼(h"X-i tagh+}r½(h-]h.]h/]h0]h2]uh#j·h]r¾(j)r¿}rÀ(h"X-ih+}rÁ(h-]h.]h/]h0]h2]uh#j»h]rÂh>X-irÃ…rÄ}rÅ(h"Uh#j¿ubah)jubjž)rÆ}rÇ(h"Xtagh+}rÈ(h0]h/]h-]U delimiterU h.]h2]uh#j»h]rÉh>XtagrÊ…rË}rÌ(h"Uh#jÆubah)j¦ubeh)jubah)jubj)rÍ}rÎ(h"XnInclude log entries with the specified tag. If neither -I nor -i is specified, all log entries are included. h+}rÏ(h-]h.]h/]h0]h2]uh#j³h]rÐhl)rÑ}rÒ(h"XmInclude log entries with the specified tag. If neither -I nor -i is specified, all log entries are included.rÓh#jÍh$h'h)hoh+}rÔ(h-]h.]h/]h0]h2]uh4K3h]rÕh>XmInclude log entries with the specified tag. If neither -I nor -i is specified, all log entries are included.rÖ…r×}rØ(h"jÓh#jÑubaubah)j*ubeubeubcdocutils.nodes definition_list rÙ)rÚ}rÛ(h"Uh#hÞh$h'h)Udefinition_listrÜh+}rÝ(h-]h.]h/]h0]h2]uh4Nh5hh]rÞcdocutils.nodes definition_list_item rß)rà}rá(h"Xg-m tag:regex only count transactions where tag matches regex. Multiple -m options are AND-ed together. h#jÚh$h'h)Udefinition_list_itemrâh+}rã(h-]h.]h/]h0]h2]uh4K7h]rä(cdocutils.nodes term rå)ræ}rç(h"XF-m tag:regex only count transactions where tag matches regex. Multiplerèh#jàh$h'h)Utermréh+}rê(h-]h.]h/]h0]h2]uh4K7h]rë(h>X-m rì…rí}rî(h"X-m h#jæubhÑ)rï}rð(h"X tag:regexrñh+}rò(Urefurijñh0]h/]h-]h.]h2]uh#jæh]róh>X tag:regexrô…rõ}rö(h"Uh#jïubah)hÚubh>X: only count transactions where tag matches regex. Multipler÷…rø}rù(h"X: only count transactions where tag matches regex. Multipleh#jæubeubcdocutils.nodes definition rú)rû}rü(h"Uh+}rý(h-]h.]h/]h0]h2]uh#jàh]rþhl)rÿ}r(h"X-m options are AND-ed together.rh#jûh$h'h)hoh+}r(h-]h.]h/]h0]h2]uh4K7h]rh>X-m options are AND-ed together.r…r}r(h"jh#jÿubaubah)U definitionrubeubaubhû)r}r (h"Uh#hÞh$h'h)hþh+}r (h-]h.]h/]h0]h2]uh4Nh5hh]r (j)r }r (h"Uh#jh$h'h)jh+}r(h-]h.]h/]h0]h2]uh4Nh5hh]r(j)r}r(h"Uh+}r(h-]h.]h/]h0]h2]uh#j h]rj )r}r(h"X-nrh+}r(h-]h.]h/]h0]h2]uh#jh]rj)r}r(h"jh+}r(h-]h.]h/]h0]h2]uh#jh]rh>X-nr…r}r(h"Uh#jubah)jubah)jubah)jubj)r }r!(h"XnSpecifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used. h+}r"(h-]h.]h/]h0]h2]uh#j h]r#hl)r$}r%(h"XmSpecifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used.r&h#j h$h'h)hoh+}r'(h-]h.]h/]h0]h2]uh4K9h]r(h>XmSpecifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used.r)…r*}r+(h"j&h#j$ubaubah)j*ubeubj)r,}r-(h"Uh#jh$h'h)jh+}r.(h-]h.]h/]h0]h2]uh4Nh5hh]r/(j)r0}r1(h"Uh+}r2(h-]h.]h/]h0]h2]uh#j,h]r3j )r4}r5(h"X-r fileh+}r6(h-]h.]h/]h0]h2]uh#j0h]r7(j)r8}r9(h"X-rh+}r:(h-]h.]h/]h0]h2]uh#j4h]r;h>X-rr<…r=}r>(h"Uh#j8ubah)jubjž)r?}r@(h"Xfileh+}rA(h0]h/]h-]U delimiterU h.]h2]uh#j4h]rBh>XfilerC…rD}rE(h"Uh#j?ubah)j¦ubeh)jubah)jubj)rF}rG(h"X5Read log entries from file instead of shared memory. h+}rH(h-]h.]h/]h0]h2]uh#j,h]rIhl)rJ}rK(h"X4Read log entries from file instead of shared memory.rLh#jFh$h'h)hoh+}rM(h-]h.]h/]h0]h2]uh4KX4Read log entries from file instead of shared memory.rO…rP}rQ(h"jLh#jJubaubah)j*ubeubj)rR}rS(h"Uh#jh$h'h)jh+}rT(h-]h.]h/]h0]h2]uh4Nh5hh]rU(j)rV}rW(h"Uh+}rX(h-]h.]h/]h0]h2]uh#jRh]rYj )rZ}r[(h"X-Vr\h+}r](h-]h.]h/]h0]h2]uh#jVh]r^j)r_}r`(h"j\h+}ra(h-]h.]h/]h0]h2]uh#jZh]rbh>X-Vrc…rd}re(h"Uh#j_ubah)jubah)jubah)jubj)rf}rg(h"X%Display the version number and exit. h+}rh(h-]h.]h/]h0]h2]uh#jRh]rihl)rj}rk(h"X$Display the version number and exit.rlh#jfh$h'h)hoh+}rm(h-]h.]h/]h0]h2]uh4K>h]rnh>X$Display the version number and exit.ro…rp}rq(h"jlh#jjubaubah)j*ubeubj)rr}rs(h"Uh#jh$h'h)jh+}rt(h-]h.]h/]h0]h2]uh4Nh5hh]ru(j)rv}rw(h"Uh+}rx(h-]h.]h/]h0]h2]uh#jrh]ryj )rz}r{(h"X-w delayh+}r|(h-]h.]h/]h0]h2]uh#jvh]r}(j)r~}r(h"X-wh+}r€(h-]h.]h/]h0]h2]uh#jzh]rh>X-wr‚…rƒ}r„(h"Uh#j~ubah)jubjž)r…}r†(h"Xdelayh+}r‡(h0]h/]h-]U delimiterU h.]h2]uh#jzh]rˆh>Xdelayr‰…rŠ}r‹(h"Uh#j…ubah)j¦ubeh)jubah)jubj)rŒ}r(h"X¨Wait at least delay seconds between each update. The default is 1. file instead of displaying them. The file will be overwritten unless the -a option was specified. h+}rŽ(h-]h.]h/]h0]h2]uh#jrh]rhl)r}r‘(h"X§Wait at least delay seconds between each update. The default is 1. file instead of displaying them. The file will be overwritten unless the -a option was specified.r’h#jŒh$h'h)hoh+}r“(h-]h.]h/]h0]h2]uh4K@h]r”h>X§Wait at least delay seconds between each update. The default is 1. file instead of displaying them. The file will be overwritten unless the -a option was specified.r•…r–}r—(h"j’h#jubaubah)j*ubeubj)r˜}r™(h"Uh#jh$h'h)jh+}rš(h-]h.]h/]h0]h2]uh4Nh5hh]r›(j)rœ}r(h"Uh+}rž(h-]h.]h/]h0]h2]uh#j˜h]rŸj )r }r¡(h"X-X regexh+}r¢(h-]h.]h/]h0]h2]uh#jœh]r£(j)r¤}r¥(h"X-Xh+}r¦(h-]h.]h/]h0]h2]uh#j h]r§h>X-Xr¨…r©}rª(h"Uh#j¤ubah)jubjž)r«}r¬(h"Xregexh+}r­(h0]h/]h-]U delimiterU h.]h2]uh#j h]r®h>Xregexr¯…r°}r±(h"Uh#j«ubah)j¦ubeh)jubah)jubj)r²}r³(h"XBExclude log entries which match the specified regular expression. h+}r´(h-]h.]h/]h0]h2]uh#j˜h]rµhl)r¶}r·(h"XAExclude log entries which match the specified regular expression.r¸h#j²h$h'h)hoh+}r¹(h-]h.]h/]h0]h2]uh4KDh]rºh>XAExclude log entries which match the specified regular expression.r»…r¼}r½(h"j¸h#j¶ubaubah)j*ubeubj)r¾}r¿(h"Uh#jh$h'h)jh+}rÀ(h-]h.]h/]h0]h2]uh4Nh5hh]rÁ(j)rÂ}rÃ(h"Uh+}rÄ(h-]h.]h/]h0]h2]uh#j¾h]rÅj )rÆ}rÇ(h"X-x tagh+}rÈ(h-]h.]h/]h0]h2]uh#jÂh]rÉ(j)rÊ}rË(h"X-xh+}rÌ(h-]h.]h/]h0]h2]uh#jÆh]rÍh>X-xrÎ…rÏ}rÐ(h"Uh#jÊubah)jubjž)rÑ}rÒ(h"Xtagh+}rÓ(h0]h/]h-]U delimiterU h.]h2]uh#jÆh]rÔh>XtagrÕ…rÖ}r×(h"Uh#jÑubah)j¦ubeh)jubah)jubj)rØ}rÙ(h"X,Exclude log entries with the specified tag. h+}rÚ(h-]h.]h/]h0]h2]uh#j¾h]rÛhl)rÜ}rÝ(h"X+Exclude log entries with the specified tag.rÞh#jØh$h'h)hoh+}rß(h-]h.]h/]h0]h2]uh4KFh]ràh>X+Exclude log entries with the specified tag.rá…râ}rã(h"jÞh#jÜubaubah)j*ubeubeubeubh)rä}rå(h"Uh#hBh$h'h)h*h+}ræ(h-]h.]h/]h0]rçhah2]rèh auh4KIh5hh]ré(h7)rê}rë(h"XSEE ALSOrìh#jäh$h'h)h;h+}rí(h-]h.]h/]h0]h2]uh4KIh5hh]rîh>XSEE ALSOrï…rð}rñ(h"jìh#jêubaubcdocutils.nodes bullet_list rò)ró}rô(h"Uh#jäh$h'h)U bullet_listrõh+}rö(Ubulletr÷X*h0]h/]h-]h.]h2]uh4KKh5hh]rø(cdocutils.nodes list_item rù)rú}rû(h"X varnishd(1)rüh#jóh$h'h)U list_itemrýh+}rþ(h-]h.]h/]h0]h2]uh4Nh5hh]rÿhl)r}r(h"jüh#júh$h'h)hoh+}r(h-]h.]h/]h0]h2]uh4KKh]rh>X varnishd(1)r…r}r(h"jüh#jubaubaubjù)r}r(h"X varnishlog(1)r h#jóh$h'h)jýh+}r (h-]h.]h/]h0]h2]uh4Nh5hh]r hl)r }r (h"j h#jh$h'h)hoh+}r(h-]h.]h/]h0]h2]uh4KLh]rh>X varnishlog(1)r…r}r(h"j h#j ubaubaubjù)r}r(h"Xvarnishncsa(1)rh#jóh$h'h)jýh+}r(h-]h.]h/]h0]h2]uh4Nh5hh]rhl)r}r(h"jh#jh$h'h)hoh+}r(h-]h.]h/]h0]h2]uh4KMh]rh>Xvarnishncsa(1)r…r}r(h"jh#jubaubaubjù)r}r (h"Xvarnishstat(1)r!h#jóh$h'h)jýh+}r"(h-]h.]h/]h0]h2]uh4Nh5hh]r#hl)r$}r%(h"j!h#jh$h'h)hoh+}r&(h-]h.]h/]h0]h2]uh4KNh]r'h>Xvarnishstat(1)r(…r)}r*(h"j!h#j$ubaubaubjù)r+}r,(h"Xvarnishtop(1) h#jóh$h'h)jýh+}r-(h-]h.]h/]h0]h2]uh4Nh5hh]r.hl)r/}r0(h"X varnishtop(1)r1h#j+h$h'h)hoh+}r2(h-]h.]h/]h0]h2]uh4KOh]r3h>X varnishtop(1)r4…r5}r6(h"j1h#j/ubaubaubeubeubh)r7}r8(h"Uh#hBh$h'h)h*h+}r9(h-]h.]h/]h0]r:hah2]r;h auh4KRh5hh]r<(h7)r=}r>(h"XHISTORYr?h#j7h$h'h)h;h+}r@(h-]h.]h/]h0]h2]uh4KRh5hh]rAh>XHISTORYrB…rC}rD(h"j?h#j=ubaubhl)rE}rF(h"X®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.rGh#j7h$h'h)hoh+}rH(h-]h.]h/]h0]h2]uh4KSh5hh]rIh>X®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.rJ…rK}rL(h"jGh#jEubaubeubh)rM}rN(h"Uh#hBh$h'h)h*h+}rO(h-]h.]h/]h0]rPhah2]rQhauh4KWh5hh]rR(h7)rS}rT(h"X COPYRIGHTrUh#jMh$h'h)h;h+}rV(h-]h.]h/]h0]h2]uh4KWh5hh]rWh>X COPYRIGHTrX…rY}rZ(h"jUh#jSubaubhl)r[}r\(h"X\This document is licensed under the same licence as Varnish itself. See LICENCE for details.r]h#jMh$h'h)hoh+}r^(h-]h.]h/]h0]h2]uh4KYh5hh]r_h>X\This document is licensed under the same licence as Varnish itself. See LICENCE for details.r`…ra}rb(h"j]h#j[ubaubjò)rc}rd(h"Uh#jMh$h'h)jõh+}re(j÷X*h0]h/]h-]h.]h2]uh4K\h5hh]rf(jù)rg}rh(h"X"Copyright (c) 2006 Verdens Gang ASrih#jch$h'h)jýh+}rj(h-]h.]h/]h0]h2]uh4Nh5hh]rkhl)rl}rm(h"jih#jgh$h'h)hoh+}rn(h-]h.]h/]h0]h2]uh4K\h]roh>X"Copyright (c) 2006 Verdens Gang ASrp…rq}rr(h"jih#jlubaubaubjù)rs}rt(h"X+Copyright (c) 2006-2011 Varnish Software ASruh#jch$h'h)jýh+}rv(h-]h.]h/]h0]h2]uh4Nh5hh]rwhl)rx}ry(h"juh#jsh$h'h)hoh+}rz(h-]h.]h/]h0]h2]uh4K]h]r{h>X+Copyright (c) 2006-2011 Varnish Software ASr|…r}}r~(h"juh#jxubaubaubeubeubeubeubah"UU transformerrNU footnote_refsr€}rUrefnamesr‚}rƒUsymbol_footnotesr„]r…Uautofootnote_refsr†]r‡Usymbol_footnote_refsrˆ]r‰U citationsrŠ]r‹h5hU current_linerŒNUtransform_messagesr]rŽUreporterrNUid_startrKU autofootnotesr‘]r’U citation_refsr“}r”Uindirect_targetsr•]r–Usettingsr—(cdocutils.frontend Values r˜or™}rš(Ufootnote_backlinksr›KUrecord_dependenciesrœNU rfc_base_urlrUhttp://tools.ietf.org/html/ržU tracebackrŸˆUpep_referencesr NUstrip_commentsr¡NU toc_backlinksr¢Uentryr£U language_coder¤Uenr¥U datestampr¦NU report_levelr§KU _destinationr¨NU halt_levelr©KU strip_classesrªNh;NUerror_encoding_error_handlerr«Ubackslashreplacer¬Udebugr­NUembed_stylesheetr®‰Uoutput_encoding_error_handlerr¯Ustrictr°U sectnum_xformr±KUdump_transformsr²NU docinfo_xformr³KUwarning_streamr´NUpep_file_url_templaterµUpep-%04dr¶Uexit_status_levelr·KUconfigr¸NUstrict_visitorr¹NUcloak_email_addressesrºˆUtrim_footnote_reference_spacer»‰Uenvr¼NUdump_pseudo_xmlr½NUexpose_internalsr¾NUsectsubtitle_xformr¿‰U source_linkrÀNUrfc_referencesrÁNUoutput_encodingrÂUutf-8rÃU source_urlrÄNUinput_encodingrÅU utf-8-sigrÆU_disable_configrÇNU id_prefixrÈUU tab_widthrÉKUerror_encodingrÊUUTF-8rËU_sourcerÌU9/home/tfheen/varnish/doc/sphinx/reference/varnishhist.rstrÍUgettext_compactrΈU generatorrÏNUdump_internalsrÐNU smart_quotesrщU pep_base_urlrÒUhttp://www.python.org/dev/peps/rÓUsyntax_highlightrÔUlongrÕUinput_encoding_error_handlerrÖj°Uauto_id_prefixr×UidrØUdoctitle_xformrÙ‰Ustrip_elements_with_classesrÚNU _config_filesrÛ]Ufile_insertion_enabledrÜKU raw_enabledrÝKU dump_settingsrÞNubUsymbol_footnote_startrßKUidsrà}rá(hhBhhÞhjMhh hjähh¼hj7uUsubstitution_namesrâ}rãh)h5h+}rä(h-]h0]h/]Usourceh'h.]h2]uU footnotesrå]ræUrefidsrç}rèub.varnish-3.0.5/doc/sphinx/=build/doctrees/reference/vcl.doctree0000644000175000017500000053171112247037213021276 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(Xmultiple subroutinesqNXthe fallback directorqNX variablesqNXsyntaxq NXexamplesq NX functionsq NX copyrightq NXvclq NXthe random directorqNXthe hash directorqNX subroutinesqNXaclsqNXsee alsoqNXbackend probesqNX descriptionqNXthe round-robin directorqNXthe dns directorqNXbackend declarationsqNXthe client directorqNX reference-vclqˆXregular expressionsqNXgrace and saint modeqNXthe family of random directorsqNX directorsqNXvarnish configuration languageqNXhistoryqNuUsubstitution_defsq }q!Uparse_messagesq"]q#(cdocutils.nodes system_message q$)q%}q&(U rawsourceq'UUparentq(cdocutils.nodes section q))q*}q+(h'Uh(h))q,}q-(h'Uh(h))q.}q/(h'Uh(h))q0}q1(h'Uh(hUsourceq2cdocutils.nodes reprunicode q3X1/home/tfheen/varnish/doc/sphinx/reference/vcl.rstq4…q5}q6bUexpect_referenced_by_nameq7}q8hcdocutils.nodes target q9)q:}q;(h'X.. _reference-vcl:h(hh2h5Utagnameq}q?(Uidsq@]UbackrefsqA]UdupnamesqB]UclassesqC]UnamesqD]UrefidqEU reference-vclqFuUlineqGKUdocumentqHhUchildrenqI]ubsh}qK(hB]hC]hA]h@]qL(UvclqMhFehD]qN(h heuhGKhHhUexpect_referenced_by_idqO}qPhFh:shI]qQ(cdocutils.nodes title qR)qS}qT(h'XVCLqUh(h0h2h5h}qW(hB]hC]hA]h@]hD]uhGKhHhhI]qXcdocutils.nodes Text qYXVCLqZ…q[}q\(h'hUh(hSubaubh.eubh2h5h}q](hB]hC]hA]h@]q^Uvarnish-configuration-languageq_ahD]q`hauhGK hHhhI]qa(hR)qb}qc(h'XVarnish Configuration Languageqdh(h.h2h5h}qe(hB]hC]hA]h@]hD]uhGK hHhhI]qfhYXVarnish Configuration Languageqg…qh}qi(h'hdh(hbubaubcdocutils.nodes field_list qj)qk}ql(h'Uh(h.h2h5h}qn(hB]hC]hA]h@]hD]uhGK hHhhI]qo(cdocutils.nodes field qp)qq}qr(h'Uh(hkh2h5h}qt(hB]hC]hA]h@]hD]uhGK hHhhI]qu(cdocutils.nodes field_name qv)qw}qx(h'XAuthorqyh>}qz(hB]hC]hA]h@]hD]uh(hqhI]q{hYXAuthorq|…q}}q~(h'hyh(hwubah}q„(hB]hC]hA]h@]hD]uh(hqhI]q…cdocutils.nodes paragraph q†)q‡}qˆ(h'hƒh(hh2h5h}qŠ(hB]hC]hA]h@]hD]uhGK hI]q‹hYXDag-Erling SmørgravqŒ…q}qŽ(h'hƒh(h‡ubaubah}q’(hB]hC]hA]h@]hD]uhGK hHhhI]q“(hv)q”}q•(h'XAuthorq–h>}q—(hB]hC]hA]h@]hD]uh(hhI]q˜hYXAuthorq™…qš}q›(h'h–h(h”ubah}qŸ(hB]hC]hA]h@]hD]uh(hhI]q h†)q¡}q¢(h'hžh(hœh2h5h}q£(hB]hC]hA]h@]hD]uhGK hI]q¤hYXPoul-Henning Kampq¥…q¦}q§(h'hžh(h¡ubaubah}qª(hB]hC]hA]h@]hD]uhGK hHhhI]q«(hv)q¬}q­(h'XAuthorq®h>}q¯(hB]hC]hA]h@]hD]uh(h¨hI]q°hYXAuthorq±…q²}q³(h'h®h(h¬ubah}q·(hB]hC]hA]h@]hD]uh(h¨hI]q¸h†)q¹}qº(h'h¶h(h´h2h5h}q»(hB]hC]hA]h@]hD]uhGK hI]q¼hYXKristian Lyngstølq½…q¾}q¿(h'h¶h(h¹ubaubah}qÂ(hB]hC]hA]h@]hD]uhGKhHhhI]qÃ(hv)qÄ}qÅ(h'XAuthorqÆh>}qÇ(hB]hC]hA]h@]hD]uh(hÀhI]qÈhYXAuthorqÉ…qÊ}qË(h'hÆh(hÄubah}qÏ(hB]hC]hA]h@]hD]uh(hÀhI]qÐh†)qÑ}qÒ(h'hÎh(hÌh2h5h}qÓ(hB]hC]hA]h@]hD]uhGKhI]qÔhYXPer BuerqÕ…qÖ}q×(h'hÎh(hÑubaubah}qÚ(hB]hC]hA]h@]hD]uhGKhHhhI]qÛ(hv)qÜ}qÝ(h'XDateqÞh>}qß(hB]hC]hA]h@]hD]uh(hØhI]qàhYXDateqá…qâ}qã(h'hÞh(hÜubah}qç(hB]hC]hA]h@]hD]uh(hØhI]qèh†)qé}qê(h'hæh(häh2h5h}që(hB]hC]hA]h@]hD]uhGKhI]qìhYX 2010-06-02qí…qî}qï(h'hæh(héubaubah}qò(hB]hC]hA]h@]hD]uhGKhHhhI]qó(hv)qô}qõ(h'XVersionqöh>}q÷(hB]hC]hA]h@]hD]uh(hðhI]qøhYXVersionqù…qú}qû(h'höh(hôubah}qÿ(hB]hC]hA]h@]hD]uh(hðhI]rh†)r}r(h'hþh(hüh2h5h}r(hB]hC]hA]h@]hD]uhGKhI]rhYX1.0r…r}r(h'hþh(jubaubah}r (hB]hC]hA]h@]hD]uhGKhHhhI]r (hv)r }r (h'XManual sectionrh>}r(hB]hC]hA]h@]hD]uh(jhI]rhYXManual sectionr…r}r(h'jh(j ubah}r(hB]hC]hA]h@]hD]uh(jhI]rh†)r}r(h'X7h(jh2h5h}r(hB]hC]hA]h@]hD]uhGKhI]rhYX7…r}r(h'X7h(jubaubah}r (hB]hC]hA]h@]r!U descriptionr"ahD]r#hauhGKhHhhI]r$(hR)r%}r&(h'X DESCRIPTIONr'h(jh2h5h}r((hB]hC]hA]h@]hD]uhGKhHhhI]r)hYX DESCRIPTIONr*…r+}r,(h'j'h(j%ubaubh†)r-}r.(h'X”The VCL language is a small domain-specific language designed to be used to define request handling and document caching policies for Varnish Cache.r/h(jh2h5h}r0(hB]hC]hA]h@]hD]uhGKhHhhI]r1hYX”The VCL language is a small domain-specific language designed to be used to define request handling and document caching policies for Varnish Cache.r2…r3}r4(h'j/h(j-ubaubh†)r5}r6(h'X½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 dynamically linked into the server process.r7h(jh2h5h}r8(hB]hC]hA]h@]hD]uhGKhHhhI]r9hYX½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 dynamically linked into the server process.r:…r;}r<(h'j7h(j5ubaubeubh,h))r=}r>(h'Uh(h.h2h5h}r?(hB]hC]hA]h@]r@UexamplesrAahD]rBh auhGM¼hHhhI]rC(hR)rD}rE(h'XEXAMPLESrFh(j=h2h5h}rG(hB]hC]hA]h@]hD]uhGM¼hHhhI]rHhYXEXAMPLESrI…rJ}rK(h'jFh(jDubaubh†)rL}rM(h'X™The following code is the equivalent of the default configuration with the backend address set to "backend.example.com" and no backend port specified: ::h(j=h2h5h}rN(hB]hC]hA]h@]hD]uhGM¾hHhhI]rOhYX–The following code is the equivalent of the default configuration with the backend address set to "backend.example.com" and no backend port specified:rP…rQ}rR(h'X–The following code is the equivalent of the default configuration with the backend address set to "backend.example.com" and no backend port specified:h(jLubaubcdocutils.nodes literal_block rS)rT}rU(h'XDbackend default { .host = "backend.example.com"; .port = "http"; }h(j=h2h5h}rW(U xml:spacerXUpreserverYh@]hA]hB]hC]hD]uhGMÃhHhhI]rZhYXDbackend default { .host = "backend.example.com"; .port = "http"; }r[…r\}r](h'Uh(jTubaubjS)r^}r_(h'XÃ/*- * 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 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. */ sub vcl_recv { if (req.restarts == 0) { if (req.http.x-forwarded-for) { set req.http.X-Forwarded-For = req.http.X-Forwarded-For + ", " + client.ip; } else { set req.http.X-Forwarded-For = client.ip; } } if (req.request != "GET" && req.request != "HEAD" && req.request != "PUT" && req.request != "POST" && req.request != "TRACE" && req.request != "OPTIONS" && req.request != "DELETE") { /* Non-RFC2616 or CONNECT which is weird. */ return (pipe); } if (req.request != "GET" && req.request != "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 (lookup); } sub vcl_pipe { # Note that only the first request to the backend will have # X-Forwarded-For set. If you use X-Forwarded-For and want to # have it set for all requests, make sure to have: # set bereq.http.connection = "close"; # here. It is not set by default as it might break some broken web # applications, like IIS with NTLM authentication. return (pipe); } sub vcl_pass { return (pass); } sub vcl_hash { hash_data(req.url); if (req.http.host) { hash_data(req.http.host); } else { hash_data(server.ip); } return (hash); } sub vcl_hit { return (deliver); } sub vcl_miss { return (fetch); } sub vcl_fetch { if (beresp.ttl <= 0s || beresp.http.Set-Cookie || beresp.http.Vary == "*") { /* * Mark as "Hit-For-Pass" for the next 2 minutes */ set beresp.ttl = 120 s; return (hit_for_pass); } return (deliver); } sub vcl_deliver { return (deliver); } sub vcl_error { set obj.http.Content-Type = "text/html; charset=utf-8"; set obj.http.Retry-After = "5"; synthetic {" "} + obj.status + " " + obj.response + {"

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

    "} + obj.response + {"

    Guru Meditation:

    XID: "} + req.xid + {"


    Varnish cache server

    "}; return (deliver); } sub vcl_init { return (ok); } sub vcl_fini { return (ok); } h(j=h2h5h}r`(hB]jXjYh@]hA]Usourceh3X../../bin/varnishd/default.vclra…rb}rcbhC]hD]uhGKhHhhI]rdhYXH/*- * 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 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. */ sub vcl_recv { if (req.restarts == 0) { if (req.http.x-forwarded-for) { set req.http.X-Forwarded-For = req.http.X-Forwarded-For + ", " + client.ip; } else { set req.http.X-Forwarded-For = client.ip; } } if (req.request != "GET" && req.request != "HEAD" && req.request != "PUT" && req.request != "POST" && req.request != "TRACE" && req.request != "OPTIONS" && req.request != "DELETE") { /* Non-RFC2616 or CONNECT which is weird. */ return (pipe); } if (req.request != "GET" && req.request != "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 (lookup); } sub vcl_pipe { # Note that only the first request to the backend will have # X-Forwarded-For set. If you use X-Forwarded-For and want to # have it set for all requests, make sure to have: # set bereq.http.connection = "close"; # here. It is not set by default as it might break some broken web # applications, like IIS with NTLM authentication. return (pipe); } sub vcl_pass { return (pass); } sub vcl_hash { hash_data(req.url); if (req.http.host) { hash_data(req.http.host); } else { hash_data(server.ip); } return (hash); } sub vcl_hit { return (deliver); } sub vcl_miss { return (fetch); } sub vcl_fetch { if (beresp.ttl <= 0s || beresp.http.Set-Cookie || beresp.http.Vary == "*") { /* * Mark as "Hit-For-Pass" for the next 2 minutes */ set beresp.ttl = 120 s; return (hit_for_pass); } return (deliver); } sub vcl_deliver { return (deliver); } sub vcl_error { set obj.http.Content-Type = "text/html; charset=utf-8"; set obj.http.Retry-After = "5"; synthetic {" "} + obj.status + " " + obj.response + {"

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

    "} + obj.response + {"

    Guru Meditation:

    XID: "} + req.xid + {"


    Varnish cache server

    "}; return (deliver); } sub vcl_init { return (ok); } sub vcl_fini { return (ok); } re…rf}rg(h'XH/*- * 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 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. */ sub vcl_recv { if (req.restarts == 0) { if (req.http.x-forwarded-for) { set req.http.X-Forwarded-For = req.http.X-Forwarded-For + ", " + client.ip; } else { set req.http.X-Forwarded-For = client.ip; } } if (req.request != "GET" && req.request != "HEAD" && req.request != "PUT" && req.request != "POST" && req.request != "TRACE" && req.request != "OPTIONS" && req.request != "DELETE") { /* Non-RFC2616 or CONNECT which is weird. */ return (pipe); } if (req.request != "GET" && req.request != "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 (lookup); } sub vcl_pipe { # Note that only the first request to the backend will have # X-Forwarded-For set. If you use X-Forwarded-For and want to # have it set for all requests, make sure to have: # set bereq.http.connection = "close"; # here. It is not set by default as it might break some broken web # applications, like IIS with NTLM authentication. return (pipe); } sub vcl_pass { return (pass); } sub vcl_hash { hash_data(req.url); if (req.http.host) { hash_data(req.http.host); } else { hash_data(server.ip); } return (hash); } sub vcl_hit { return (deliver); } sub vcl_miss { return (fetch); } sub vcl_fetch { if (beresp.ttl <= 0s || beresp.http.Set-Cookie || beresp.http.Vary == "*") { /* * Mark as "Hit-For-Pass" for the next 2 minutes */ set beresp.ttl = 120 s; return (hit_for_pass); } return (deliver); } sub vcl_deliver { return (deliver); } sub vcl_error { set obj.http.Content-Type = "text/html; charset=utf-8"; set obj.http.Retry-After = "5"; synthetic {" "} + obj.status + " " + obj.response + {"

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

    "} + obj.response + {"

    Guru Meditation:

    XID: "} + req.xid + {"


    Varnish cache server

    "}; return (deliver); } sub vcl_init { return (ok); } sub vcl_fini { return (ok); } h(j^ubaubh†)rh}ri(h'X§The following example shows how to support multiple sites running on separate backends in the same Varnish instance, by selecting backends based on the request URL: ::h(j=h2h5h}rj(hB]hC]hA]h@]hD]uhGMËhHhhI]rkhYX¤The following example shows how to support multiple sites running on separate backends in the same Varnish instance, by selecting backends based on the request URL:rl…rm}rn(h'X¤The following example shows how to support multiple sites running on separate backends in the same Varnish instance, by selecting backends based on the request URL:h(jhubaubjS)ro}rp(h'X˜backend www { .host = "www.example.com"; .port = "80"; } backend images { .host = "images.example.com"; .port = "80"; } sub vcl_recv { if (req.http.host ~ "(?i)^(www.)?example.com$") { set req.http.host = "www.example.com"; set req.backend = www; } elsif (req.http.host ~ "(?i)^images.example.com$") { set req.backend = images; } else { error 404 "Unknown virtual host"; } }h(j=h2h5h}rq(jXjYh@]hA]hB]hC]hD]uhGMÐhHhhI]rrhYX˜backend www { .host = "www.example.com"; .port = "80"; } backend images { .host = "images.example.com"; .port = "80"; } sub vcl_recv { if (req.http.host ~ "(?i)^(www.)?example.com$") { set req.http.host = "www.example.com"; set req.backend = www; } elsif (req.http.host ~ "(?i)^images.example.com$") { set req.backend = images; } else { error 404 "Unknown virtual host"; } }rs…rt}ru(h'Uh(joubaubh†)rv}rw(h'XíThe following snippet demonstrates how to force a minimum TTL for all documents. Note that this is not the same as setting the default_ttl run-time parameter, as that only affects document for which the backend did not specify a TTL: ::h(j=h2h5h}rx(hB]hC]hA]h@]hD]uhGMåhHhhI]ryhYXêThe following snippet demonstrates how to force a minimum TTL for all documents. Note that this is not the same as setting the default_ttl run-time parameter, as that only affects document for which the backend did not specify a TTL:rz…r{}r|(h'XêThe following snippet demonstrates how to force a minimum TTL for all documents. Note that this is not the same as setting the default_ttl run-time parameter, as that only affects document for which the backend did not specify a TTL:h(jvubaubjS)r}}r~(h'X‹import std; # needed for std.log sub vcl_fetch { if (beresp.ttl < 120s) { std.log("Adjusting TTL"); set beresp.ttl = 120s; } }h(j=h2h5h}r(jXjYh@]hA]hB]hC]hD]uhGMëhHhhI]r€hYX‹import std; # needed for std.log sub vcl_fetch { if (beresp.ttl < 120s) { std.log("Adjusting TTL"); set beresp.ttl = 120s; } }r…r‚}rƒ(h'Uh(j}ubaubh†)r„}r…(h'XlThe following snippet demonstrates how to force Varnish to cache documents even when cookies are present: ::h(j=h2h5h}r†(hB]hC]hA]h@]hD]uhGMôhHhhI]r‡hYXiThe following snippet demonstrates how to force Varnish to cache documents even when cookies are present:rˆ…r‰}rŠ(h'XiThe following snippet demonstrates how to force Varnish to cache documents even when cookies are present:h(j„ubaubjS)r‹}rŒ(h'X¦sub vcl_recv { if (req.request == "GET" && req.http.cookie) { return(lookup); } } sub vcl_fetch { if (beresp.http.Set-Cookie) { return(deliver); } }h(j=h2h5h}r(jXjYh@]hA]hB]hC]hD]uhGMøhHhhI]rŽhYX¦sub vcl_recv { if (req.request == "GET" && req.http.cookie) { return(lookup); } } sub vcl_fetch { if (beresp.http.Set-Cookie) { return(deliver); } }r…r}r‘(h'Uh(j‹ubaubh†)r’}r“(h'X`The following code implements the HTTP PURGE method as used by Squid for object invalidation: ::h(j=h2h5h}r”(hB]hC]hA]h@]hD]uhGMhHhhI]r•hYX]The following code implements the HTTP PURGE method as used by Squid for object invalidation:r–…r—}r˜(h'X]The following code implements the HTTP PURGE method as used by Squid for object invalidation:h(j’ubaubjS)r™}rš(h'Xoacl purge { "localhost"; "192.0.2.1"/24; } sub vcl_recv { if (req.request == "PURGE") { if (!client.ip ~ purge) { error 405 "Not allowed."; } return(lookup); } } sub vcl_hit { if (req.request == "PURGE") { purge; error 200 "Purged."; } } sub vcl_miss { if (req.request == "PURGE") { purge; error 200 "Purged."; } }h(j=h2h5h}r›(jXjYh@]hA]hB]hC]hD]uhGMhHhhI]rœhYXoacl purge { "localhost"; "192.0.2.1"/24; } sub vcl_recv { if (req.request == "PURGE") { if (!client.ip ~ purge) { error 405 "Not allowed."; } return(lookup); } } sub vcl_hit { if (req.request == "PURGE") { purge; error 200 "Purged."; } } sub vcl_miss { if (req.request == "PURGE") { purge; error 200 "Purged."; } }r…rž}rŸ(h'Uh(j™ubaubeubh))r }r¡(h'Uh(h.h2h5h}r¢(hB]hC]hA]h@]r£Usee-alsor¤ahD]r¥hauhGM%hHhhI]r¦(hR)r§}r¨(h'XSEE ALSOr©h(j h2h5h}rª(hB]hC]hA]h@]hD]uhGM%hHhhI]r«hYXSEE ALSOr¬…r­}r®(h'j©h(j§ubaubcdocutils.nodes bullet_list r¯)r°}r±(h'Uh(j h2h5h}r³(Ubulletr´X*h@]hA]hB]hC]hD]uhGM'hHhhI]rµ(cdocutils.nodes list_item r¶)r·}r¸(h'X varnishd(1)r¹h(j°h2h5h}r»(hB]hC]hA]h@]hD]uhGNhHhhI]r¼h†)r½}r¾(h'j¹h(j·h2h5h}r¿(hB]hC]hA]h@]hD]uhGM'hI]rÀhYX varnishd(1)rÁ…rÂ}rÃ(h'j¹h(j½ubaubaubj¶)rÄ}rÅ(h'X vmod_std(7) h(j°h2h5h}rÆ(hB]hC]hA]h@]hD]uhGNhHhhI]rÇh†)rÈ}rÉ(h'X vmod_std(7)rÊh(jÄh2h5h}rË(hB]hC]hA]h@]hD]uhGM(hI]rÌhYX vmod_std(7)rÍ…rÎ}rÏ(h'jÊh(jÈubaubaubeubeubh))rÐ}rÑ(h'Uh(h.h2h5h}rÒ(hB]hC]hA]h@]rÓUhistoryrÔahD]rÕhauhGM+hHhhI]rÖ(hR)r×}rØ(h'XHISTORYrÙh(jÐh2h5h}rÚ(hB]hC]hA]h@]hD]uhGM+hHhhI]rÛhYXHISTORYrÜ…rÝ}rÞ(h'jÙh(j×ubaubh†)rß}rà(h'XÚVCL was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS, Redpill Linpro and Varnish Software. This manual page was written by Dag-Erling Smørgrav and later edited by Poul-Henning Kamp and Per Buer.ráh(jÐh2h5h}râ(hB]hC]hA]h@]hD]uhGM-hHhhI]rãhYXÚVCL was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS, Redpill Linpro and Varnish Software. This manual page was written by Dag-Erling Smørgrav and later edited by Poul-Henning Kamp and Per Buer.rä…rå}ræ(h'jáh(jßubaubeubh))rç}rè(h'Uh(h.h2h5h}ré(hB]hC]hA]h@]rêU copyrightrëahD]rìh auhGM3hHhhI]rí(hR)rî}rï(h'X COPYRIGHTrðh(jçh2h5h}rñ(hB]hC]hA]h@]hD]uhGM3hHhhI]ròhYX COPYRIGHTró…rô}rõ(h'jðh(jîubaubh†)rö}r÷(h'X\This document is licensed under the same license as Varnish itself. See LICENSE for details.røh(jçh2h5h}rù(hB]hC]hA]h@]hD]uhGM5hHhhI]rúhYX\This document is licensed under the same license as Varnish itself. See LICENSE for details.rû…rü}rý(h'jøh(jöubaubj¯)rþ}rÿ(h'Uh(jçh2h5h}r(j´X*h@]hA]hB]hC]hD]uhGM8hHhhI]r(j¶)r}r(h'X"Copyright (c) 2006 Verdens Gang ASrh(jþh2h5h}r(hB]hC]hA]h@]hD]uhGNhHhhI]rh†)r}r(h'jh(jh2h5h}r (hB]hC]hA]h@]hD]uhGM8hI]r hYX"Copyright (c) 2006 Verdens Gang ASr …r }r (h'jh(jubaubaubj¶)r}r(h'X+Copyright (c) 2006-2011 Varnish Software ASrh(jþh2h5h}r(hB]hC]hA]h@]hD]uhGNhHhhI]rh†)r}r(h'jh(jh2h5h}r(hB]hC]hA]h@]hD]uhGM9hI]rhYX+Copyright (c) 2006-2011 Varnish Software ASr…r}r(h'jh(jubaubaubeubeubeubh2h5h}r(hB]hC]hA]h@]rUsyntaxrahD]rh auhGKhHhhI]r(hR)r}r (h'XSYNTAXr!h(h,h2h5h}r"(hB]hC]hA]h@]hD]uhGKhHhhI]r#hYXSYNTAXr$…r%}r&(h'j!h(jubaubh†)r'}r((h'XàThe VCL syntax is very simple, and deliberately similar to C and 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.r)h(h,h2h5h}r*(hB]hC]hA]h@]hD]uhGK!hHhhI]r+hYXàThe VCL syntax is very simple, and deliberately similar to C and 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.r,…r-}r.(h'j)h(j'ubaubh†)r/}r0(h'X½In addition to the C-like assignment (=), comparison (==, !=) and boolean (!, && and \|\|) operators, VCL supports both regular expression and ACL matching using the ~ and the !~ operators.h(h,h2h5h}r1(hB]hC]hA]h@]hD]uhGK&hHhhI]r2hYX»In addition to the C-like assignment (=), comparison (==, !=) and boolean (!, && and ||) operators, VCL supports both regular expression and ACL matching using the ~ and the !~ operators.r3…r4}r5(h'X½In addition to the C-like assignment (=), comparison (==, !=) and boolean (!, && and \|\|) operators, VCL supports both regular expression and ACL matching using the ~ and the !~ operators.h(j/ubaubh†)r6}r7(h'XDBasic strings are enclosed in " ... ", and may not contain newlines.r8h(h,h2h5h}r9(hB]hC]hA]h@]hD]uhGK*hHhhI]r:hYXDBasic strings are enclosed in " ... ", and may not contain newlines.r;…r<}r=(h'j8h(j6ubaubh†)r>}r?(h'XLong strings are enclosed in {" ... "}. They may contain any character including ", newline and other control characters except for the NUL (0x00) character.r@h(h,h2h5h}rA(hB]hC]hA]h@]hD]uhGK,hHhhI]rBhYXLong strings are enclosed in {" ... "}. They may contain any character including ", newline and other control characters except for the NUL (0x00) character.rC…rD}rE(h'j@h(j>ubaubh†)rF}rG(h'XšUnlike C and Perl, the backslash (\) character has no special meaning in strings in VCL, so it can be freely used in regular expressions without doubling.h(h,h2h5h}rH(hB]hC]hA]h@]hD]uhGK0hHhhI]rIhYX™Unlike C and Perl, the backslash () character has no special meaning in strings in VCL, so it can be freely used in regular expressions without doubling.rJ…rK}rL(h'XšUnlike C and Perl, the backslash (\) character has no special meaning in strings in VCL, so it can be freely used in regular expressions without doubling.h(jFubaubh†)rM}rN(h'X0Strings are concatenated using the '+' operator.rOh(h,h2h5h}rP(hB]hC]hA]h@]hD]uhGK4hHhhI]rQhYX0Strings are concatenated using the '+' operator.rR…rS}rT(h'jOh(jMubaubh†)rU}rV(h'XAssignments are introduced with the *set* keyword. There are no user-defined variables; values can only be assigned to variables attached to backend, request or document objects. Most of these are typed, and the values assigned to them must have a compatible unit suffix.h(h,h2h5h}rW(hB]hC]hA]h@]hD]uhGK6hHhhI]rX(hYX$Assignments are introduced with the rY…rZ}r[(h'X$Assignments are introduced with the h(jUubcdocutils.nodes emphasis r\)r]}r^(h'X*set*h>}r_(hB]hC]hA]h@]hD]uh(jUhI]r`hYXsetra…rb}rc(h'Uh(j]ubah}rj(hB]hC]hA]h@]hD]uhGK}rq(hB]hC]hA]h@]hD]uh(jhhI]rrhYXsetrs…rt}ru(h'Uh(joubah}r{(hB]hC]hA]h@]hD]uh(jhhI]r|hYXremover}…r~}r(h'Uh(jyubah}r…(hB]hC]hA]h@]hD]uh(jhhI]r†hYXunsetr‡…rˆ}r‰(h'Uh(jƒubah}r(hB]hC]hA]h@]hD]uhGK@hHhhI]r(hYXYou can use the r‘…r’}r“(h'XYou can use the h(jubj\)r”}r•(h'X *rollback*h>}r–(hB]hC]hA]h@]hD]uh(jhI]r—hYXrollbackr˜…r™}rš(h'Uh(j”ubah}r (hB]hC]hA]h@]hD]uhGKChHhhI]r¡(hYXThe r¢…r£}r¤(h'XThe h(jžubj\)r¥}r¦(h'X *synthetic*h>}r§(hB]hC]hA]h@]hD]uh(jžhI]r¨hYX syntheticr©…rª}r«(h'Uh(j¥ubah}r±(hB]hC]hA]h@]hD]uhGKFhHhhI]r²(hYX5You can force a crash of the client process with the r³…r´}rµ(h'X5You can force a crash of the client process with the h(j¯ubj\)r¶}r·(h'X*panic*h>}r¸(hB]hC]hA]h@]hD]uh(j¯hI]r¹hYXpanicrº…r»}r¼(h'Uh(j¶ubah}rÂ(hB]hC]hA]h@]hD]uh(j¯hI]rÃhYXpanicrÄ…rÅ}rÆ(h'Uh(jÀubah}rÌ(hB]hC]hA]h@]hD]uhGKIhHhhI]rÍ(hYXThe rÎ…rÏ}rÐ(h'XThe h(jÊubcdocutils.nodes literal rÑ)rÒ}rÓ(h'X``return(action)``h>}rÔ(hB]hC]hA]h@]hD]uh(jÊhI]rÕhYXreturn(action)rÖ…r×}rØ(h'Uh(jÒubah}rß(hB]hC]hA]h@]hD]uh(jÊhI]ràhYXactionrá…râ}rã(h'Uh(jÝubah}ré(j´X*h@]hA]hB]hC]hD]uhGKLhHhhI]rê(j¶)rë}rì(h'Xdeliverríh(jçh2h5h}rî(hB]hC]hA]h@]hD]uhGNhHhhI]rïh†)rð}rñ(h'jíh(jëh2h5h}rò(hB]hC]hA]h@]hD]uhGKLhI]róhYXdeliverrô…rõ}rö(h'jíh(jðubaubaubj¶)r÷}rø(h'Xerrorrùh(jçh2h5h}rú(hB]hC]hA]h@]hD]uhGNhHhhI]rûh†)rü}rý(h'jùh(j÷h2h5h}rþ(hB]hC]hA]h@]hD]uhGKMhI]rÿhYXerrorr…r}r(h'jùh(jüubaubaubj¶)r}r(h'Xfetchrh(jçh2h5h}r(hB]hC]hA]h@]hD]uhGNhHhhI]rh†)r}r (h'jh(jh2h5h}r (hB]hC]hA]h@]hD]uhGKNhI]r hYXfetchr …r }r(h'jh(jubaubaubj¶)r}r(h'Xhashrh(jçh2h5h}r(hB]hC]hA]h@]hD]uhGNhHhhI]rh†)r}r(h'jh(jh2h5h}r(hB]hC]hA]h@]hD]uhGKOhI]rhYXhashr…r}r(h'jh(jubaubaubj¶)r}r(h'X hit_for_passrh(jçh2h5h}r(hB]hC]hA]h@]hD]uhGNhHhhI]rh†)r }r!(h'jh(jh2h5h}r"(hB]hC]hA]h@]hD]uhGKPhI]r#hYX hit_for_passr$…r%}r&(h'jh(j ubaubaubj¶)r'}r((h'Xlookupr)h(jçh2h5h}r*(hB]hC]hA]h@]hD]uhGNhHhhI]r+h†)r,}r-(h'j)h(j'h2h5h}r.(hB]hC]hA]h@]hD]uhGKQhI]r/hYXlookupr0…r1}r2(h'j)h(j,ubaubaubj¶)r3}r4(h'Xokr5h(jçh2h5h}r6(hB]hC]hA]h@]hD]uhGNhHhhI]r7h†)r8}r9(h'j5h(j3h2h5h}r:(hB]hC]hA]h@]hD]uhGKRhI]r;hYXokr<…r=}r>(h'j5h(j8ubaubaubj¶)r?}r@(h'XpassrAh(jçh2h5h}rB(hB]hC]hA]h@]hD]uhGNhHhhI]rCh†)rD}rE(h'jAh(j?h2h5h}rF(hB]hC]hA]h@]hD]uhGKShI]rGhYXpassrH…rI}rJ(h'jAh(jDubaubaubj¶)rK}rL(h'XpiperMh(jçh2h5h}rN(hB]hC]hA]h@]hD]uhGNhHhhI]rOh†)rP}rQ(h'jMh(jKh2h5h}rR(hB]hC]hA]h@]hD]uhGKThI]rShYXpiperT…rU}rV(h'jMh(jPubaubaubj¶)rW}rX(h'Xrestart h(jçh2h5h}rY(hB]hC]hA]h@]hD]uhGNhHhhI]rZh†)r[}r\(h'Xrestartr]h(jWh2h5h}r^(hB]hC]hA]h@]hD]uhGKUhI]r_hYXrestartr`…ra}rb(h'j]h(j[ubaubaubeubh†)rc}rd(h'XRPlease see the list of subroutines to see what return actions are available where.reh(h,h2h5h}rf(hB]hC]hA]h@]hD]uhGKWhHhhI]rghYXRPlease see the list of subroutines to see what return actions are available where.rh…ri}rj(h'jeh(jcubaubh†)rk}rl(h'XVCL has if tests, but no loops.rmh(h,h2h5h}rn(hB]hC]hA]h@]hD]uhGKZhHhhI]rohYXVCL has if tests, but no loops.rp…rq}rr(h'jmh(jkubaubh†)rs}rt(h'X£The contents of another VCL file may be inserted at any point in the code by using the *include* keyword followed by the name of the other file as a quoted string.h(h,h2h5h}ru(hB]hC]hA]h@]hD]uhGK\hHhhI]rv(hYXWThe contents of another VCL file may be inserted at any point in the code by using the rw…rx}ry(h'XWThe contents of another VCL file may be inserted at any point in the code by using the h(jsubj\)rz}r{(h'X *include*h>}r|(hB]hC]hA]h@]hD]uh(jshI]r}hYXincluder~…r}r€(h'Uh(jzubah}r†(hB]hC]hA]h@]r‡U directorsrˆahD]r‰hauhGKhHhhI]rŠ(hR)r‹}rŒ(h'X Directorsrh(j„h2h5h}rŽ(hB]hC]hA]h@]hD]uhGKhHhhI]rhYX Directorsr…r‘}r’(h'jh(j‹ubaubh†)r“}r”(h'XÓA director is a logical group of backend servers clustered together for redundancy. The basic role of the director is to let Varnish choose a backend server amongst several so if one is down another can be used.r•h(j„h2h5h}r–(hB]hC]hA]h@]hD]uhGKhHhhI]r—hYXÓA director is a logical group of backend servers clustered together for redundancy. The basic role of the director is to let Varnish choose a backend server amongst several so if one is down another can be used.r˜…r™}rš(h'j•h(j“ubaubh†)r›}rœ(h'X{There are several types of directors. The different director types use different algorithms to choose which backend to use.rh(j„h2h5h}rž(hB]hC]hA]h@]hD]uhGK”hHhhI]rŸhYX{There are several types of directors. The different director types use different algorithms to choose which backend to use.r …r¡}r¢(h'jh(j›ubaubh†)r£}r¤(h'X-Configuring a director may look like this: ::h(j„h2h5h}r¥(hB]hC]hA]h@]hD]uhGK—hHhhI]r¦hYX*Configuring a director may look like this:r§…r¨}r©(h'X*Configuring a director may look like this:h(j£ubaubjS)rª}r«(h'Xâdirector b2 random { .retries = 5; { // We can refer to named backends .backend = b1; .weight = 7; } { // Or define them inline .backend = { .host = "fs2"; } .weight = 3; } }h(j„h2h5h}r¬(jXjYh@]hA]hB]hC]hD]uhGKšhHhhI]r­hYXâdirector b2 random { .retries = 5; { // We can refer to named backends .backend = b1; .weight = 7; } { // Or define them inline .backend = { .host = "fs2"; } .weight = 3; } }r®…r¯}r°(h'Uh(jªubaubh))r±}r²(h'Uh(j„h2h5h}r³(hB]hC]hA]h@]r´Uthe-family-of-random-directorsrµahD]r¶hauhGK«hHhhI]r·(hR)r¸}r¹(h'XThe family of random directorsrºh(j±h2h5h}r»(hB]hC]hA]h@]hD]uhGK«hHhhI]r¼hYXThe family of random directorsr½…r¾}r¿(h'jºh(j¸ubaubh†)rÀ}rÁ(h'XUThere are three directors that share the same logic, called the random director, client director and hash director. They each distribute traffic among the backends assigned to it using a random distribution seeded with either the client identity, a random number or the cache hash (typically url). Beyond the initial seed, they act the same.rÂh(j±h2h5h}rÃ(hB]hC]hA]h@]hD]uhGK­hHhhI]rÄhYXUThere are three directors that share the same logic, called the random director, client director and hash director. They each distribute traffic among the backends assigned to it using a random distribution seeded with either the client identity, a random number or the cache hash (typically url). Beyond the initial seed, they act the same.rÅ…rÆ}rÇ(h'jÂh(jÀubaubh†)rÈ}rÉ(h'XçEach backend requires a .weight option which sets the amount of traffic each backend will get compared to the others. Equal weight means equal traffic. A backend with lower weight than an other will get proportionally less traffic.rÊh(j±h2h5h}rË(hB]hC]hA]h@]hD]uhGK³hHhhI]rÌhYXçEach backend requires a .weight option which sets the amount of traffic each backend will get compared to the others. Equal weight means equal traffic. A backend with lower weight than an other will get proportionally less traffic.rÍ…rÎ}rÏ(h'jÊh(jÈubaubh†)rÐ}rÑ(h'XâThe director has an optional .retries option which defaults to the number of backends the director has. The director will attempt .retries times to find a healthy backend if the first attempt fails. Each attempt re-uses the previous seed in an iterative manner. For the random director this detail is of no importance as it will give different results each time. For the hash and client director, this means the same URL or the same client will fail to the same server consistently.rÒh(j±h2h5h}rÓ(hB]hC]hA]h@]hD]uhGK¸hHhhI]rÔhYXâThe director has an optional .retries option which defaults to the number of backends the director has. The director will attempt .retries times to find a healthy backend if the first attempt fails. Each attempt re-uses the previous seed in an iterative manner. For the random director this detail is of no importance as it will give different results each time. For the hash and client director, this means the same URL or the same client will fail to the same server consistently.rÕ…rÖ}r×(h'jÒh(jÐubaubh))rØ}rÙ(h'Uh(j±h2h5h}rÚ(hB]hC]hA]h@]rÛUthe-random-directorrÜahD]rÝhauhGKÁhHhhI]rÞ(hR)rß}rà(h'XThe random directorráh(jØh2h5h}râ(hB]hC]hA]h@]hD]uhGKÁhHhhI]rãhYXThe random directorrä…rå}ræ(h'jáh(jßubaubh†)rç}rè(h'X8This uses a random number to seed the backend selection.réh(jØh2h5h}rê(hB]hC]hA]h@]hD]uhGKÃhHhhI]rëhYX8This uses a random number to seed the backend selection.rì…rí}rî(h'jéh(jçubaubeubh))rï}rð(h'Uh(j±h2h5h}rñ(hB]hC]hA]h@]ròUthe-client-directorróahD]rôhauhGKÆhHhhI]rõ(hR)rö}r÷(h'XThe client directorrøh(jïh2h5h}rù(hB]hC]hA]h@]hD]uhGKÆhHhhI]rúhYXThe client directorrû…rü}rý(h'jøh(jöubaubh†)rþ}rÿ(h'XÂThe client director picks a backend based on the clients *identity*. You can set the VCL variable *client.identity* to identify the client by picking up the value of a session cookie or similar.h(jïh2h5h}r(hB]hC]hA]h@]hD]uhGKÈhHhhI]r(hYX9The client director picks a backend based on the clients r…r}r(h'X9The client director picks a backend based on the clients h(jþubj\)r}r(h'X *identity*h>}r(hB]hC]hA]h@]hD]uh(jþhI]rhYXidentityr …r }r (h'Uh(jubah}r(hB]hC]hA]h@]hD]uh(jþhI]rhYXclient.identityr…r}r(h'Uh(jubah}r(hB]hC]hA]h@]rUthe-hash-directorrahD]rhauhGKÍhHhhI]r(hR)r }r!(h'XThe hash directorr"h(jh2h5h}r#(hB]hC]hA]h@]hD]uhGKÍhHhhI]r$hYXThe hash directorr%…r&}r'(h'j"h(j ubaubh†)r(}r)(h'XBThe hash director will pick a backend based on the URL hash value.r*h(jh2h5h}r+(hB]hC]hA]h@]hD]uhGKÏhHhhI]r,hYXBThe hash director will pick a backend based on the URL hash value.r-…r.}r/(h'j*h(j(ubaubh†)r0}r1(h'X This is useful is you are using Varnish to load balance in front of other Varnish caches or other web accelerators as objects won't be duplicated across caches.r2h(jh2h5h}r3(hB]hC]hA]h@]hD]uhGKÒhHhhI]r4hYX This is useful is you are using Varnish to load balance in front of other Varnish caches or other web accelerators as objects won't be duplicated across caches.r5…r6}r7(h'j2h(j0ubaubh†)r8}r9(h'XKIt will use the value of req.hash, just as the normal cache lookup methods.r:h(jh2h5h}r;(hB]hC]hA]h@]hD]uhGKÖhHhhI]r<hYXKIt will use the value of req.hash, just as the normal cache lookup methods.r=…r>}r?(h'j:h(j8ubaubeubeubh))r@}rA(h'Uh(j„h2h5h}rB(hB]hC]hA]h@]rCUthe-round-robin-directorrDahD]rEhauhGKÚhHhhI]rF(hR)rG}rH(h'XThe round-robin directorrIh(j@h2h5h}rJ(hB]hC]hA]h@]hD]uhGKÚhHhhI]rKhYXThe round-robin directorrL…rM}rN(h'jIh(jGubaubh†)rO}rP(h'X3The round-robin director does not take any options.rQh(j@h2h5h}rR(hB]hC]hA]h@]hD]uhGKÜhHhhI]rShYX3The round-robin director does not take any options.rT…rU}rV(h'jQh(jOubaubh†)rW}rX(h'XŸIt will use the first backend for the first request, the second backend for the second request and so on, and start from the top again when it gets to the end.rYh(j@h2h5h}rZ(hB]hC]hA]h@]hD]uhGKÞhHhhI]r[hYXŸIt will use the first backend for the first request, the second backend for the second request and so on, and start from the top again when it gets to the end.r\…r]}r^(h'jYh(jWubaubh†)r_}r`(h'X”If a backend is unhealthy or Varnish fails to connect, it will be skipped. The round-robin director will try all the backends once before giving up.rah(j@h2h5h}rb(hB]hC]hA]h@]hD]uhGKâhHhhI]rchYX”If a backend is unhealthy or Varnish fails to connect, it will be skipped. The round-robin director will try all the backends once before giving up.rd…re}rf(h'jah(j_ubaubeubh))rg}rh(h'Uh(j„h2h5h}ri(hB]hC]hA]h@]rjUthe-dns-directorrkahD]rlhauhGKæhHhhI]rm(hR)rn}ro(h'XThe DNS directorrph(jgh2h5h}rq(hB]hC]hA]h@]hD]uhGKæhHhhI]rrhYXThe DNS directorrs…rt}ru(h'jph(jnubaubh†)rv}rw(h'XzThe DNS director can use backends in two different ways. Either like the random or round-robin director or using .list: ::h(jgh2h5h}rx(hB]hC]hA]h@]hD]uhGKèhHhhI]ryhYXwThe DNS director can use backends in two different ways. Either like the random or round-robin director or using .list:rz…r{}r|(h'XwThe DNS director can use backends in two different ways. Either like the random or round-robin director or using .list:h(jvubaubjS)r}}r~(h'X7director directorname dns { .list = { .host_header = "www.example.com"; .port = "80"; .connect_timeout = 0.4s; "192.168.15.0"/24; "192.168.16.128"/25; } .ttl = 5m; .suffix = "internal.example.net"; }h(jgh2h5h}r(jXjYh@]hA]hB]hC]hD]uhGKìhHhhI]r€hYX7director directorname dns { .list = { .host_header = "www.example.com"; .port = "80"; .connect_timeout = 0.4s; "192.168.15.0"/24; "192.168.16.128"/25; } .ttl = 5m; .suffix = "internal.example.net"; }r…r‚}rƒ(h'Uh(j}ubaubh†)r„}r…(h'XGThis will specify 384 backends, all using port 80 and a connection timeout of 0.4s. Options must come before the list of IPs in the .list statement. The .list-method does not support IPv6. It is not a white-list, it is an actual list of backends that will be created internally in Varnish - the larger subnet the more overhead.r†h(jgh2h5h}r‡(hB]hC]hA]h@]hD]uhGKøhHhhI]rˆhYXGThis will specify 384 backends, all using port 80 and a connection timeout of 0.4s. Options must come before the list of IPs in the .list statement. The .list-method does not support IPv6. It is not a white-list, it is an actual list of backends that will be created internally in Varnish - the larger subnet the more overhead.r‰…rŠ}r‹(h'j†h(j„ubaubh†)rŒ}r(h'X7The .ttl defines the cache duration of the DNS lookups.rŽh(jgh2h5h}r(hB]hC]hA]h@]hD]uhGKþhHhhI]rhYX7The .ttl defines the cache duration of the DNS lookups.r‘…r’}r“(h'jŽh(jŒubaubh†)r”}r•(h'X™The above example will append "internal.example.net" to the incoming Host header supplied by the client, before looking it up. All settings are optional.r–h(jgh2h5h}r—(hB]hC]hA]h@]hD]uhGMhHhhI]r˜hYX™The above example will append "internal.example.net" to the incoming Host header supplied by the client, before looking it up. All settings are optional.r™…rš}r›(h'j–h(j”ubaubh†)rœ}r(h'X+Health checks are not thoroughly supported.ržh(jgh2h5h}rŸ(hB]hC]hA]h@]hD]uhGMhHhhI]r hYX+Health checks are not thoroughly supported.r¡…r¢}r£(h'jžh(jœubaubh†)r¤}r¥(h'X¦DNS round robin balancing is supported. If a hostname resolves to multiple backends, the director will divide the traffic between all of them in a round-robin manner.r¦h(jgh2h5h}r§(hB]hC]hA]h@]hD]uhGMhHhhI]r¨hYX¦DNS round robin balancing is supported. If a hostname resolves to multiple backends, the director will divide the traffic between all of them in a round-robin manner.r©…rª}r«(h'j¦h(j¤ubaubeubh))r¬}r­(h'Uh(j„h2h5h}r®(hB]hC]hA]h@]r¯Uthe-fallback-directorr°ahD]r±hauhGM hHhhI]r²(hR)r³}r´(h'XThe fallback directorrµh(j¬h2h5h}r¶(hB]hC]hA]h@]hD]uhGM hHhhI]r·hYXThe fallback directorr¸…r¹}rº(h'jµh(j³ubaubh†)r»}r¼(h'XThe fallback director will pick the first backend that is healthy. It considers them in the order in which they are listed in its definition.r½h(j¬h2h5h}r¾(hB]hC]hA]h@]hD]uhGM hHhhI]r¿hYXThe fallback director will pick the first backend that is healthy. It considers them in the order in which they are listed in its definition.rÀ…rÁ}rÂ(h'j½h(j»ubaubh†)rÃ}rÄ(h'X0The fallback director does not take any options.rÅh(j¬h2h5h}rÆ(hB]hC]hA]h@]hD]uhGMhHhhI]rÇhYX0The fallback director does not take any options.rÈ…rÉ}rÊ(h'jÅh(jÃubaubh†)rË}rÌ(h'X%An example of a fallback director: ::h(j¬h2h5h}rÍ(hB]hC]hA]h@]hD]uhGMhHhhI]rÎhYX"An example of a fallback director:rÏ…rÐ}rÑ(h'X"An example of a fallback director:h(jËubaubjS)rÒ}rÓ(h'XÜdirector b3 fallback { { .backend = www1; } { .backend = www2; } // will only be used if www1 is unhealthy. { .backend = www3; } // will only be used if both www1 and www2 // are unhealthy. }h(j¬h2h5h}rÔ(jXjYh@]hA]hB]hC]hD]uhGMhHhhI]rÕhYXÜdirector b3 fallback { { .backend = www1; } { .backend = www2; } // will only be used if www1 is unhealthy. { .backend = www3; } // will only be used if both www1 and www2 // are unhealthy. }rÖ…r×}rØ(h'Uh(jÒubaubeubeubh))rÙ}rÚ(h'Uh(h,h2h5h}rÛ(hB]hC]hA]h@]rÜUbackend-probesrÝahD]rÞhauhGMhHhhI]rß(hR)rà}rá(h'XBackend probesrâh(jÙh2h5h}rã(hB]hC]hA]h@]hD]uhGMhHhhI]rähYXBackend probesrå…ræ}rç(h'jâh(jàubaubh†)rè}ré(h'X”Backends can be probed to see whether they should be considered healthy or not. The return status can also be checked by using req.backend.healthy.rêh(jÙh2h5h}rë(hB]hC]hA]h@]hD]uhGMhHhhI]rìhYX”Backends can be probed to see whether they should be considered healthy or not. The return status can also be checked by using req.backend.healthy.rí…rî}rï(h'jêh(jèubaubh†)rð}rñ(h'X%Probes take the following parameters:ròh(jÙh2h5h}ró(hB]hC]hA]h@]hD]uhGM#hHhhI]rôhYX%Probes take the following parameters:rõ…rö}r÷(h'jòh(jðubaubcdocutils.nodes definition_list rø)rù}rú(h'Uh(jÙh2h5h}rü(hB]hC]hA]h@]hD]uhGNhHhhI]rý(cdocutils.nodes definition_list_item rþ)rÿ}r(h'X@.url Specify a URL to request from the backend. Defaults to "/".h(jùh2h5h}r(hB]hC]hA]h@]hD]uhGM&hI]r(cdocutils.nodes term r)r}r(h'X.urlrh(jÿh2h5h}r (hB]hC]hA]h@]hD]uhGM&hI]r hYX.urlr …r }r (h'jh(jubaubcdocutils.nodes definition r)r}r(h'Uh>}r(hB]hC]hA]h@]hD]uh(jÿhI]rh†)r}r(h'X;Specify a URL to request from the backend. Defaults to "/".rh(jh2h5h}r(hB]hC]hA]h@]hD]uhGM&hI]rhYX;Specify a URL to request from the backend. Defaults to "/".r…r}r(h'jh(jubaubah}r(hB]hC]hA]h@]hD]uhGM*hHhhI]r(j)r }r!(h'X.requestr"h(jh2h5h}r#(hB]hC]hA]h@]hD]uhGM*hI]r$hYX.requestr%…r&}r'(h'j"h(j ubaubj)r(}r)(h'Uh>}r*(hB]hC]hA]h@]hD]uh(jhI]r+h†)r,}r-(h'X¯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.h(j(h2h5h}r.(hB]hC]hA]h@]hD]uhGM)hI]r/hYX­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.r0…r1}r2(h'X¯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.h(j,ubaubah}r5(hB]hC]hA]h@]hD]uhGM-hHhhI]r6(j)r7}r8(h'X.windowr9h(j3h2h5h}r:(hB]hC]hA]h@]hD]uhGM-hI]r;hYX.windowr<…r=}r>(h'j9h(j7ubaubj)r?}r@(h'Uh>}rA(hB]hC]hA]h@]hD]uh(j3hI]rBh†)rC}rD(h'XSHow many of the latest polls we examine to determine backend health. Defaults to 8.rEh(j?h2h5h}rF(hB]hC]hA]h@]hD]uhGM-hI]rGhYXSHow many of the latest polls we examine to determine backend health. Defaults to 8.rH…rI}rJ(h'jEh(jCubaubah}rM(hB]hC]hA]h@]hD]uhGM1hHhhI]rN(j)rO}rP(h'X .thresholdrQh(jKh2h5h}rR(hB]hC]hA]h@]hD]uhGM1hI]rShYX .thresholdrT…rU}rV(h'jQh(jOubaubj)rW}rX(h'Uh>}rY(hB]hC]hA]h@]hD]uh(jKhI]rZh†)r[}r\(h'XkHow many of the polls in .window must have succeeded for us to consider the backend healthy. Defaults to 3.r]h(jWh2h5h}r^(hB]hC]hA]h@]hD]uhGM0hI]r_hYXkHow many of the polls in .window must have succeeded for us to consider the backend healthy. Defaults to 3.r`…ra}rb(h'j]h(j[ubaubah}re(hB]hC]hA]h@]hD]uhGM4hHhhI]rf(j)rg}rh(h'X.initialrih(jch2h5h}rj(hB]hC]hA]h@]hD]uhGM4hI]rkhYX.initialrl…rm}rn(h'jih(jgubaubj)ro}rp(h'Uh>}rq(hB]hC]hA]h@]hD]uh(jchI]rrh†)rs}rt(h'XmHow many of the probes are considered good when Varnish starts. Defaults to the same amount as the threshold.ruh(joh2h5h}rv(hB]hC]hA]h@]hD]uhGM4hI]rwhYXmHow many of the probes are considered good when Varnish starts. Defaults to the same amount as the threshold.rx…ry}rz(h'juh(jsubaubah}r}(hB]hC]hA]h@]hD]uhGM7hHhhI]r~(j)r}r€(h'X.expected_responserh(j{h2h5h}r‚(hB]hC]hA]h@]hD]uhGM7hI]rƒhYX.expected_responser„…r…}r†(h'jh(jubaubj)r‡}rˆ(h'Uh>}r‰(hB]hC]hA]h@]hD]uh(j{hI]rŠh†)r‹}rŒ(h'X9The expected backend HTTP response code. Defaults to 200.rh(j‡h2h5h}rŽ(hB]hC]hA]h@]hD]uhGM7hI]rhYX9The expected backend HTTP response code. Defaults to 200.r…r‘}r’(h'jh(j‹ubaubah}r•(hB]hC]hA]h@]hD]uhGM:hHhhI]r–(j)r—}r˜(h'X .intervalr™h(j“h2h5h}rš(hB]hC]hA]h@]hD]uhGM:hI]r›hYX .intervalrœ…r}rž(h'j™h(j—ubaubj)rŸ}r (h'Uh>}r¡(hB]hC]hA]h@]hD]uh(j“hI]r¢h†)r£}r¤(h'XQDefines how often the probe should check the backend. Default is every 5 seconds.r¥h(jŸh2h5h}r¦(hB]hC]hA]h@]hD]uhGM:hI]r§hYXQDefines how often the probe should check the backend. Default is every 5 seconds.r¨…r©}rª(h'j¥h(j£ubaubah.timeout How fast each probe times out. Default is 2 seconds. h(jùh2h5h}r­(hB]hC]hA]h@]hD]uhGM>hHhhI]r®(j)r¯}r°(h'X.timeoutr±h(j«h2h5h}r²(hB]hC]hA]h@]hD]uhGM>hI]r³hYX.timeoutr´…rµ}r¶(h'j±h(j¯ubaubj)r·}r¸(h'Uh>}r¹(hB]hC]hA]h@]hD]uh(j«hI]rºh†)r»}r¼(h'X4How fast each probe times out. Default is 2 seconds.r½h(j·h2h5h}r¾(hB]hC]hA]h@]hD]uhGM=hI]r¿hYX4How fast each probe times out. Default is 2 seconds.rÀ…rÁ}rÂ(h'j½h(j»ubaubah}rÅ(hB]hC]hA]h@]hD]uhGM@hHhhI]rÆhYXWA backend with a probe can be defined like this, together with the backend or director:rÇ…rÈ}rÉ(h'XWA backend with a probe can be defined like this, together with the backend or director:h(jÃubaubjS)rÊ}rË(h'X´backend www { .host = "www.example.com"; .port = "http"; .probe = { .url = "/test.jpg"; .timeout = 0.3 s; .window = 8; .threshold = 3; .initial = 3; } }h(jÙh2h5h}rÌ(jXjYh@]hA]hB]hC]hD]uhGMDhHhhI]rÍhYX´backend www { .host = "www.example.com"; .port = "http"; .probe = { .url = "/test.jpg"; .timeout = 0.3 s; .window = 8; .threshold = 3; .initial = 3; } }rÎ…rÏ}rÐ(h'Uh(jÊubaubh†)rÑ}rÒ(h'X7Or it can be defined separately and then referenced: ::h(jÙh2h5h}rÓ(hB]hC]hA]h@]hD]uhGMPhHhhI]rÔhYX4Or it can be defined separately and then referenced:rÕ…rÖ}r×(h'X4Or it can be defined separately and then referenced:h(jÑubaubjS)rØ}rÙ(h'Xprobe healthcheck { .url = "/status.cgi"; .interval = 60s; .timeout = 0.3 s; .window = 8; .threshold = 3; .initial = 3; .expected_response = 200; } backend www { .host = "www.example.com"; .port = "http"; .probe = healthcheck; }h(jÙh2h5h}rÚ(jXjYh@]hA]hB]hC]hD]uhGMShHhhI]rÛhYXprobe healthcheck { .url = "/status.cgi"; .interval = 60s; .timeout = 0.3 s; .window = 8; .threshold = 3; .initial = 3; .expected_response = 200; } backend www { .host = "www.example.com"; .port = "http"; .probe = healthcheck; }rÜ…rÝ}rÞ(h'Uh(jØubaubh†)rß}rà(h'X=If you have many backends this can simplify the config a lot.ráh(jÙh2h5h}râ(hB]hC]hA]h@]hD]uhGMchHhhI]rãhYX=If you have many backends this can simplify the config a lot.rä…rå}ræ(h'jáh(jßubaubh†)rç}rè(h'X7It is also possible to specify the raw HTTP request: ::h(jÙh2h5h}ré(hB]hC]hA]h@]hD]uhGMfhHhhI]rêhYX4It is also possible to specify the raw HTTP request:rë…rì}rí(h'X4It is also possible to specify the raw HTTP request:h(jçubaubjS)rî}rï(h'X¦probe rawprobe { # NB: \r\n automatically inserted after each string! .request = "GET / HTTP/1.1" "Host: www.foo.bar" "Connection: close"; }h(jÙh2h5h}rð(jXjYh@]hA]hB]hC]hD]uhGMihHhhI]rñhYX¦probe rawprobe { # NB: \r\n automatically inserted after each string! .request = "GET / HTTP/1.1" "Host: www.foo.bar" "Connection: close"; }rò…ró}rô(h'Uh(jîubaubeubh))rõ}rö(h'Uh(h,h2h5h}r÷(hB]hC]hA]h@]røUaclsrùahD]rúhauhGMrhHhhI]rû(hR)rü}rý(h'XACLsrþh(jõh2h5h}rÿ(hB]hC]hA]h@]hD]uhGMrhHhhI]rhYXACLsr…r}r(h'jþh(jüubaubh†)r}r(h'X|An ACL declaration creates and initializes a named access control list which can later be used to match client addresses: ::h(jõh2h5h}r(hB]hC]hA]h@]hD]uhGMthHhhI]rhYXyAn ACL declaration creates and initializes a named access control list which can later be used to match client addresses:r…r }r (h'XyAn ACL declaration creates and initializes a named access control list which can later be used to match client addresses:h(jubaubjS)r }r (h'X¡acl local { "localhost"; // myself "192.0.2.0"/24; // and everyone on the local network ! "192.0.2.23"; // except for the dialin router }h(jõh2h5h}r (jXjYh@]hA]hB]hC]hD]uhGMxhHhhI]rhYX¡acl local { "localhost"; // myself "192.0.2.0"/24; // and everyone on the local network ! "192.0.2.23"; // except for the dialin router }r…r}r(h'Uh(j ubaubh†)r}r(h'XKIf 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.rh(jõh2h5h}r(hB]hC]hA]h@]hD]uhGM~hHhhI]rhYXKIf 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.r…r}r(h'jh(jubaubh†)r}r(h'XHTo match an IP address against an ACL, simply use the match operator: ::h(jõh2h5h}r(hB]hC]hA]h@]hD]uhGM„hHhhI]rhYXETo match an IP address against an ACL, simply use the match operator:r…r}r (h'XETo match an IP address against an ACL, simply use the match operator:h(jubaubjS)r!}r"(h'X+if (client.ip ~ local) { return (pipe); }h(jõh2h5h}r#(jXjYh@]hA]hB]hC]hD]uhGM‡hHhhI]r$hYX+if (client.ip ~ local) { return (pipe); }r%…r&}r'(h'Uh(j!ubaubeubh))r(}r)(h'Uh(h,h2h5h}r*(hB]hC]hA]h@]r+Uregular-expressionsr,ahD]r-hauhGMŒhHhhI]r.(hR)r/}r0(h'XRegular Expressionsr1h(j(h2h5h}r2(hB]hC]hA]h@]hD]uhGMŒhHhhI]r3hYXRegular Expressionsr4…r5}r6(h'j1h(j/ubaubh†)r7}r8(h'X|Varnish uses PCRE - Perl-compatible regular expressions. For a complete description of PCRE please see the pcre(3) man page.r9h(j(h2h5h}r:(hB]hC]hA]h@]hD]uhGMŽhHhhI]r;hYX|Varnish uses PCRE - Perl-compatible regular expressions. For a complete description of PCRE please see the pcre(3) man page.r<…r=}r>(h'j9h(j7ubaubh†)r?}r@(h'XTo send flags to the PCRE engine, such as to turn on *case insensitivity* add the flag within parens following a question mark, like this: ::h(j(h2h5h}rA(hB]hC]hA]h@]hD]uhGM‘hHhhI]rB(hYX5To send flags to the PCRE engine, such as to turn on rC…rD}rE(h'X5To send flags to the PCRE engine, such as to turn on h(j?ubj\)rF}rG(h'X*case insensitivity*h>}rH(hB]hC]hA]h@]hD]uh(j?hI]rIhYXcase insensitivityrJ…rK}rL(h'Uh(jFubah}rR(jXjYh@]hA]hB]hC]hD]uhGM–hHhhI]rShYX[# If host is NOT example dot com.. if (req.http.host !~ "(?i)example.com$") { ... }rT…rU}rV(h'Uh(jPubaubeubh))rW}rX(h'Uh(h,h2h5h}rY(hB]hC]hA]h@]rZU functionsr[ahD]r\h auhGMhHhhI]r](hR)r^}r_(h'X Functionsr`h(jWh2h5h}ra(hB]hC]hA]h@]hD]uhGMhHhhI]rbhYX Functionsrc…rd}re(h'j`h(j^ubaubh†)rf}rg(h'X/The following built-in functions are available:rhh(jWh2h5h}ri(hB]hC]hA]h@]hD]uhGMŸhHhhI]rjhYX/The following built-in functions are available:rk…rl}rm(h'jhh(jfubaubjø)rn}ro(h'Uh(jWh2h5h}rp(hB]hC]hA]h@]hD]uhGNhHhhI]rq(jþ)rr}rs(h'X{hash_data(str) Adds a string to the hash input. In default.vcl hash_data() is called on the host and URL of the *request*. h(jnh2h5h}rt(hB]hC]hA]h@]hD]uhGM£hI]ru(j)rv}rw(h'Xhash_data(str)rxh(jrh2h5h}ry(hB]hC]hA]h@]hD]uhGM£hI]rzhYXhash_data(str)r{…r|}r}(h'jxh(jvubaubj)r~}r(h'Uh>}r€(hB]hC]hA]h@]hD]uh(jrhI]rh†)r‚}rƒ(h'XkAdds a string to the hash input. In default.vcl hash_data() is called on the host and URL of the *request*.h(j~h2h5h}r„(hB]hC]hA]h@]hD]uhGM¢hI]r…(hYXaAdds a string to the hash input. In default.vcl hash_data() is called on the host and URL of the r†…r‡}rˆ(h'XaAdds a string to the hash input. In default.vcl hash_data() is called on the host and URL of the h(j‚ubj\)r‰}rŠ(h'X *request*h>}r‹(hB]hC]hA]h@]hD]uh(j‚hI]rŒhYXrequestr…rŽ}r(h'Uh(j‰ubah}r”(hB]hC]hA]h@]hD]uhGMªhHhhI]r•(j)r–}r—(h'Xregsub(str, regex, sub)r˜h(j’h2h5h}r™(hB]hC]hA]h@]hD]uhGMªhI]ršhYXregsub(str, regex, sub)r›…rœ}r(h'j˜h(j–ubaubj)rž}rŸ(h'Uh>}r (hB]hC]hA]h@]hD]uh(j’hI]r¡h†)r¢}r£(h'X 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.h(jžh2h5h}r¤(hB]hC]hA]h@]hD]uhGM¦hI]r¥hYXReturns 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.r¦…r§}r¨(h'X 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.h(j¢ubaubah}r«(hB]hC]hA]h@]hD]uhGM­hHhhI]r¬(j)r­}r®(h'Xregsuball(str, regex, sub)r¯h(j©h2h5h}r°(hB]hC]hA]h@]hD]uhGM­hI]r±hYXregsuball(str, regex, sub)r²…r³}r´(h'j¯h(j­ubaubj)rµ}r¶(h'Uh>}r·(hB]hC]hA]h@]hD]uh(j©hI]r¸h†)r¹}rº(h'X1As regsuball() but this replaces all occurrences.r»h(jµh2h5h}r¼(hB]hC]hA]h@]hD]uhGM­hI]r½hYX1As regsuball() but this replaces all occurrences.r¾…r¿}rÀ(h'j»h(j¹ubaubah}rÃ(hB]hC]hA]h@]hD]uhGM°hHhhI]rÄ(j)rÅ}rÆ(h'Xban(ban expression)rÇh(jÁh2h5h}rÈ(hB]hC]hA]h@]hD]uhGM°hI]rÉhYXban(ban expression)rÊ…rË}rÌ(h'jÇh(jÅubaubj)rÍ}rÎ(h'Uh>}rÏ(hB]hC]hA]h@]hD]uh(jÁhI]rÐh†)rÑ}rÒ(h'X4Bans all objects in cache that match the expression.rÓh(jÍh2h5h}rÔ(hB]hC]hA]h@]hD]uhGM°hI]rÕhYX4Bans all objects in cache that match the expression.rÖ…r×}rØ(h'jÓh(jÑubaubah}rÛ(hB]hC]hA]h@]hD]uhGM³hHhhI]rÜ(j)rÝ}rÞ(h'Xban_url(regex)rßh(jÙh2h5h}rà(hB]hC]hA]h@]hD]uhGM³hI]ráhYXban_url(regex)râ…rã}rä(h'jßh(jÝubaubj)rå}ræ(h'Uh>}rç(hB]hC]hA]h@]hD]uh(jÙhI]rèh†)ré}rê(h'X1Bans all objects in cache whose URLs match regex.rëh(jåh2h5h}rì(hB]hC]hA]h@]hD]uhGM³hI]ríhYX1Bans all objects in cache whose URLs match regex.rî…rï}rð(h'jëh(jéubaubah}ró(hB]hC]hA]h@]rôU subroutinesrõahD]röhauhGM¶hHhhI]r÷(hR)rø}rù(h'X Subroutinesrúh(jñh2h5h}rû(hB]hC]hA]h@]hD]uhGM¶hHhhI]rühYX Subroutinesrý…rþ}rÿ(h'júh(jøubaubh†)r}r(h'XDA subroutine is used to group code for legibility or reusability: ::h(jñh2h5h}r(hB]hC]hA]h@]hD]uhGM¸hHhhI]rhYXAA subroutine is used to group code for legibility or reusability:r…r}r(h'XAA subroutine is used to group code for legibility or reusability:h(jubaubjS)r}r(h'XGsub pipe_if_local { if (client.ip ~ local) { return (pipe); } }h(jñh2h5h}r (jXjYh@]hA]hB]hC]hD]uhGM»hHhhI]r hYXGsub pipe_if_local { if (client.ip ~ local) { return (pipe); } }r …r }r (h'Uh(jubaubh†)r}r(h'XDSubroutines in VCL do not take arguments, nor do they return values.rh(jñh2h5h}r(hB]hC]hA]h@]hD]uhGMÁhHhhI]rhYXDSubroutines in VCL do not take arguments, nor do they return values.r…r}r(h'jh(jubaubh†)r}r(h'XMTo call a subroutine, use the call keyword followed by the subroutine's name:rh(jñh2h5h}r(hB]hC]hA]h@]hD]uhGMÃhHhhI]rhYXMTo call a subroutine, use the call keyword followed by the subroutine's name:r…r}r(h'jh(jubaubh†)r}r(h'Xcall pipe_if_local;r h(jñh2h5h}r!(hB]hC]hA]h@]hD]uhGMÅhHhhI]r"hYXcall pipe_if_local;r#…r$}r%(h'j h(jubaubh†)r&}r'(h'XeThere are a number of special subroutines which hook into the Varnish workflow. These subroutines may inspect and manipulate HTTP headers and various other aspects of each request, and to a certain extent decide how the request should be handled. Each subroutine terminates by calling one of a small number of keywords which indicates the desired outcome.r(h(jñh2h5h}r)(hB]hC]hA]h@]hD]uhGMÇhHhhI]r*hYXeThere are a number of special subroutines which hook into the Varnish workflow. These subroutines may inspect and manipulate HTTP headers and various other aspects of each request, and to a certain extent decide how the request should be handled. Each subroutine terminates by calling one of a small number of keywords which indicates the desired outcome.r+…r,}r-(h'j(h(j&ubaubjø)r.}r/(h'Uh(jñh2Nh}r0(hB]hC]hA]h@]hD]uhGNhHhhI]r1(jþ)r2}r3(h'X«vcl_init Called when VCL is loaded, before any requests pass through it. Typically used to initialize VMODs. return() values: ok Normal return, VCL continues loading. h(j.h2h5h}r4(hB]hC]hA]h@]hD]uhGMÕhI]r5(j)r6}r7(h'Xvcl_initr8h(j2h2h5h}r9(hB]hC]hA]h@]hD]uhGMÕhI]r:hYXvcl_initr;…r<}r=(h'j8h(j6ubaubj)r>}r?(h'Uh>}r@(hB]hC]hA]h@]hD]uh(j2hI]rA(h†)rB}rC(h'XcCalled when VCL is loaded, before any requests pass through it. Typically used to initialize VMODs.rDh(j>h2h5h}rE(hB]hC]hA]h@]hD]uhGMÏhI]rFhYXcCalled when VCL is loaded, before any requests pass through it. Typically used to initialize VMODs.rG…rH}rI(h'jDh(jBubaubh†)rJ}rK(h'Xreturn() values:rLh(j>h2h5h}rM(hB]hC]hA]h@]hD]uhGMÒhI]rNhYXreturn() values:rO…rP}rQ(h'jLh(jJubaubjø)rR}rS(h'Uh>}rT(hB]hC]hA]h@]hD]uh(j>hI]rUjþ)rV}rW(h'X)ok Normal return, VCL continues loading. h(jRh2h5h}rX(hB]hC]hA]h@]hD]uhGMÕhI]rY(j)rZ}r[(h'Xokr\h(jVh2h5h}r](hB]hC]hA]h@]hD]uhGMÕhI]r^hYXokr_…r`}ra(h'j\h(jZubaubj)rb}rc(h'Uh>}rd(hB]hC]hA]h@]hD]uh(jVhI]reh†)rf}rg(h'X%Normal return, VCL continues loading.rhh(jbh2h5h}ri(hB]hC]hA]h@]hD]uhGMÕhI]rjhYX%Normal return, VCL continues loading.rk…rl}rm(h'jhh(jfubaubah}rp(hB]hC]hA]h@]hD]uhGMíhHhhI]rq(j)rr}rs(h'Xvcl_recvrth(jnh2h5h}ru(hB]hC]hA]h@]hD]uhGMíhI]rvhYXvcl_recvrw…rx}ry(h'jth(jrubaubj)rz}r{(h'Uh>}r|(hB]hC]hA]h@]hD]uh(jnhI]r}(h†)r~}r(h'XÕCalled at the beginning of a request, after the complete request has been received and parsed. Its purpose is to decide whether or not to serve the request, how to do it, and, if applicable, which backend to use.r€h(jzh2h5h}r(hB]hC]hA]h@]hD]uhGMØhI]r‚hYXÕCalled at the beginning of a request, after the complete request has been received and parsed. Its purpose is to decide whether or not to serve the request, how to do it, and, if applicable, which backend to use.rƒ…r„}r…(h'j€h(j~ubaubh†)r†}r‡(h'X]The vcl_recv subroutine may terminate with calling return() on one of the following keywords:rˆh(jzh2h5h}r‰(hB]hC]hA]h@]hD]uhGMÝhI]rŠhYX]The vcl_recv subroutine may terminate with calling return() on one of the following keywords:r‹…rŒ}r(h'jˆh(j†ubaubjø)rŽ}r(h'Uh>}r(hB]hC]hA]h@]hD]uh(jzhI]r‘(jþ)r’}r“(h'X[error code [reason] Return the specified error code to the client and abandon the request. h(jŽh2h5h}r”(hB]hC]hA]h@]hD]uhGMáhI]r•(j)r–}r—(h'Xerror code [reason]r˜h(j’h2h5h}r™(hB]hC]hA]h@]hD]uhGMáhI]ršhYXerror code [reason]r›…rœ}r(h'j˜h(j–ubaubj)rž}rŸ(h'Uh>}r (hB]hC]hA]h@]hD]uh(j’hI]r¡h†)r¢}r£(h'XFReturn the specified error code to the client and abandon the request.r¤h(jžh2h5h}r¥(hB]hC]hA]h@]hD]uhGMáhI]r¦hYXFReturn the specified error code to the client and abandon the request.r§…r¨}r©(h'j¤h(j¢ubaubah}r¬(hB]hC]hA]h@]hD]uhGMähI]r­(j)r®}r¯(h'Xpassr°h(jªh2h5h}r±(hB]hC]hA]h@]hD]uhGMähI]r²hYXpassr³…r´}rµ(h'j°h(j®ubaubj)r¶}r·(h'Uh>}r¸(hB]hC]hA]h@]hD]uh(jªhI]r¹h†)rº}r»(h'X?Switch to pass mode. Control will eventually pass to vcl_pass.r¼h(j¶h2h5h}r½(hB]hC]hA]h@]hD]uhGMähI]r¾hYX?Switch to pass mode. Control will eventually pass to vcl_pass.r¿…rÀ}rÁ(h'j¼h(jºubaubah}rÄ(hB]hC]hA]h@]hD]uhGMçhI]rÅ(j)rÆ}rÇ(h'XpiperÈh(jÂh2h5h}rÉ(hB]hC]hA]h@]hD]uhGMçhI]rÊhYXpiperË…rÌ}rÍ(h'jÈh(jÆubaubj)rÎ}rÏ(h'Uh>}rÐ(hB]hC]hA]h@]hD]uh(jÂhI]rÑh†)rÒ}rÓ(h'X?Switch to pipe mode. Control will eventually pass to vcl_pipe.rÔh(jÎh2h5h}rÕ(hB]hC]hA]h@]hD]uhGMçhI]rÖhYX?Switch to pipe mode. Control will eventually pass to vcl_pipe.r×…rØ}rÙ(h'jÔh(jÒubaubah}rÜ(hB]hC]hA]h@]hD]uhGMíhI]rÝ(j)rÞ}rß(h'Xlookupràh(jÚh2h5h}rá(hB]hC]hA]h@]hD]uhGMíhI]râhYXlookuprã…rä}rå(h'jàh(jÞubaubj)ræ}rç(h'Uh>}rè(hB]hC]hA]h@]hD]uh(jÚhI]réh†)rê}rë(h'XñLook up the requested object in the cache. Control will eventually pass to vcl_hit or vcl_miss, depending on whether the object is in the cache. The ``bereq.request`` value will be set to ``GET`` regardless of the value of ``req.request``.h(jæh2h5h}rì(hB]hC]hA]h@]hD]uhGMêhI]rí(hYX—Look up the requested object in the cache. Control will eventually pass to vcl_hit or vcl_miss, depending on whether the object is in the cache. The rî…rï}rð(h'X—Look up the requested object in the cache. Control will eventually pass to vcl_hit or vcl_miss, depending on whether the object is in the cache. The h(jêubjÑ)rñ}rò(h'X``bereq.request``h>}ró(hB]hC]hA]h@]hD]uh(jêhI]rôhYX bereq.requestrõ…rö}r÷(h'Uh(jñubah}rý(hB]hC]hA]h@]hD]uh(jêhI]rþhYXGETrÿ…r}r(h'Uh(jûubah}r(hB]hC]hA]h@]hD]uh(jêhI]rhYX req.requestr …r }r (h'Uh(jubah}r(hB]hC]hA]h@]hD]uhGMühHhhI]r(j)r}r(h'Xvcl_piperh(jh2h5h}r(hB]hC]hA]h@]hD]uhGMühI]rhYXvcl_piper…r}r(h'jh(jubaubj)r}r(h'Uh>}r(hB]hC]hA]h@]hD]uh(jhI]r(h†)r}r(h'XÉCalled upon entering pipe mode. In this mode, the request is passed on to the backend, and any further data from either client or backend is passed on unaltered until either end closes the connection.r h(jh2h5h}r!(hB]hC]hA]h@]hD]uhGMðhI]r"hYXÉCalled upon entering pipe mode. In this mode, the request is passed on to the backend, and any further data from either client or backend is passed on unaltered until either end closes the connection.r#…r$}r%(h'j h(jubaubh†)r&}r'(h'X_The vcl_pipe subroutine may terminate with calling return() with one of the following keywords:r(h(jh2h5h}r)(hB]hC]hA]h@]hD]uhGMõhI]r*hYX_The vcl_pipe subroutine may terminate with calling return() with one of the following keywords:r+…r,}r-(h'j(h(j&ubaubjø)r.}r/(h'Uh>}r0(hB]hC]hA]h@]hD]uh(jhI]r1(jþ)r2}r3(h'X[error code [reason] Return the specified error code to the client and abandon the request. h(j.h2h5h}r4(hB]hC]hA]h@]hD]uhGMùhI]r5(j)r6}r7(h'Xerror code [reason]r8h(j2h2h5h}r9(hB]hC]hA]h@]hD]uhGMùhI]r:hYXerror code [reason]r;…r<}r=(h'j8h(j6ubaubj)r>}r?(h'Uh>}r@(hB]hC]hA]h@]hD]uh(j2hI]rAh†)rB}rC(h'XFReturn the specified error code to the client and abandon the request.rDh(j>h2h5h}rE(hB]hC]hA]h@]hD]uhGMùhI]rFhYXFReturn the specified error code to the client and abandon the request.rG…rH}rI(h'jDh(jBubaubah}rL(hB]hC]hA]h@]hD]uhGMühI]rM(j)rN}rO(h'XpiperPh(jJh2h5h}rQ(hB]hC]hA]h@]hD]uhGMühI]rRhYXpiperS…rT}rU(h'jPh(jNubaubj)rV}rW(h'Uh>}rX(hB]hC]hA]h@]hD]uh(jJhI]rYh†)rZ}r[(h'XProceed with pipe mode.r\h(jVh2h5h}r](hB]hC]hA]h@]hD]uhGMühI]r^hYXProceed with pipe mode.r_…r`}ra(h'j\h(jZubaubah}rd(hB]hC]hA]h@]hD]uhGMhHhhI]re(j)rf}rg(h'Xvcl_passrhh(jbh2h5h}ri(hB]hC]hA]h@]hD]uhGMhI]rjhYXvcl_passrk…rl}rm(h'jhh(jfubaubj)rn}ro(h'Uh>}rp(hB]hC]hA]h@]hD]uh(jbhI]rq(h†)rr}rs(h'XCalled 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.rth(jnh2h5h}ru(hB]hC]hA]h@]hD]uhGMÿhI]rvhYXCalled 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.rw…rx}ry(h'jth(jrubaubh†)rz}r{(h'X_The vcl_pass subroutine may terminate with calling return() with one of the following keywords:r|h(jnh2h5h}r}(hB]hC]hA]h@]hD]uhGMhI]r~hYX_The vcl_pass subroutine may terminate with calling return() with one of the following keywords:r…r€}r(h'j|h(jzubaubjø)r‚}rƒ(h'Uh>}r„(hB]hC]hA]h@]hD]uh(jnhI]r…(jþ)r†}r‡(h'X[error code [reason] Return the specified error code to the client and abandon the request. h(j‚h2h5h}rˆ(hB]hC]hA]h@]hD]uhGMhI]r‰(j)rŠ}r‹(h'Xerror code [reason]rŒh(j†h2h5h}r(hB]hC]hA]h@]hD]uhGMhI]rŽhYXerror code [reason]r…r}r‘(h'jŒh(jŠubaubj)r’}r“(h'Uh>}r”(hB]hC]hA]h@]hD]uh(j†hI]r•h†)r–}r—(h'XFReturn the specified error code to the client and abandon the request.r˜h(j’h2h5h}r™(hB]hC]hA]h@]hD]uhGMhI]ršhYXFReturn the specified error code to the client and abandon the request.r›…rœ}r(h'j˜h(j–ubaubah}r (hB]hC]hA]h@]hD]uhGM hI]r¡(j)r¢}r£(h'Xpassr¤h(jžh2h5h}r¥(hB]hC]hA]h@]hD]uhGM hI]r¦hYXpassr§…r¨}r©(h'j¤h(j¢ubaubj)rª}r«(h'Uh>}r¬(hB]hC]hA]h@]hD]uh(jžhI]r­h†)r®}r¯(h'XProceed with pass mode.r°h(jªh2h5h}r±(hB]hC]hA]h@]hD]uhGM hI]r²hYXProceed with pass mode.r³…r´}rµ(h'j°h(j®ubaubah}r¸(hB]hC]hA]h@]hD]uhGMhI]r¹(j)rº}r»(h'Xrestartr¼h(j¶h2h5h}r½(hB]hC]hA]h@]hD]uhGMhI]r¾hYXrestartr¿…rÀ}rÁ(h'j¼h(jºubaubj)rÂ}rÃ(h'Uh>}rÄ(hB]hC]hA]h@]hD]uh(j¶hI]rÅh†)rÆ}rÇ(h'X–Restart the transaction. Increases the restart counter. If the number of restarts is higher than *max_restarts* varnish emits a guru meditation error.h(jÂh2h5h}rÈ(hB]hC]hA]h@]hD]uhGMhI]rÉ(hYXaRestart the transaction. Increases the restart counter. If the number of restarts is higher than rÊ…rË}rÌ(h'XaRestart the transaction. Increases the restart counter. If the number of restarts is higher than h(jÆubj\)rÍ}rÎ(h'X*max_restarts*h>}rÏ(hB]hC]hA]h@]hD]uh(jÆhI]rÐhYX max_restartsrÑ…rÒ}rÓ(h'Uh(jÍubah}rÙ(hB]hC]hA]h@]hD]uhGMhHhhI]rÚ(j)rÛ}rÜ(h'Xvcl_hashrÝh(j×h2h5h}rÞ(hB]hC]hA]h@]hD]uhGMhI]rßhYXvcl_hashrà…rá}râ(h'jÝh(jÛubaubj)rã}rä(h'Uh>}rå(hB]hC]hA]h@]hD]uh(j×hI]ræ(h†)rç}rè(h'XGYou may call hash_data() on the data you would like to add to the hash.réh(jãh2h5h}rê(hB]hC]hA]h@]hD]uhGMhI]rëhYXGYou may call hash_data() on the data you would like to add to the hash.rì…rí}rî(h'jéh(jçubaubh†)rï}rð(h'X_The vcl_hash subroutine may terminate with calling return() with one of the following keywords:rñh(jãh2h5h}rò(hB]hC]hA]h@]hD]uhGMhI]róhYX_The vcl_hash subroutine may terminate with calling return() with one of the following keywords:rô…rõ}rö(h'jñh(jïubaubjø)r÷}rø(h'Uh>}rù(hB]hC]hA]h@]hD]uh(jãhI]rújþ)rû}rü(h'Xhash Proceed. h(j÷h2h5h}rý(hB]hC]hA]h@]hD]uhGMhI]rþ(j)rÿ}r (h'Xhashr h(jûh2h5h}r (hB]hC]hA]h@]hD]uhGMhI]r hYXhashr …r }r (h'j h(jÿubaubj)r }r (h'Uh>}r (hB]hC]hA]h@]hD]uh(jûhI]r h†)r }r (h'XProceed.r h(j h2h5h}r (hB]hC]hA]h@]hD]uhGMhI]r hYXProceed.r …r }r (h'j h(j ubaubah}r (hB]hC]hA]h@]hD]uhGM.hHhhI]r (j)r }r (h'Xvcl_hitr h(j h2h5h}r (hB]hC]hA]h@]hD]uhGM.hI]r hYXvcl_hitr …r }r (h'j h(j ubaubj)r }r (h'Uh>}r! (hB]hC]hA]h@]hD]uh(j hI]r" (h†)r# }r$ (h'XMCalled after a cache lookup if the requested document was found in the cache.r% h(j h2h5h}r& (hB]hC]hA]h@]hD]uhGMhI]r' hYXMCalled after a cache lookup if the requested document was found in the cache.r( …r) }r* (h'j% h(j# ubaubh†)r+ }r, (h'X^The vcl_hit subroutine may terminate with calling return() with one of the following keywords:r- h(j h2h5h}r. (hB]hC]hA]h@]hD]uhGMhI]r/ hYX^The vcl_hit subroutine may terminate with calling return() with one of the following keywords:r0 …r1 }r2 (h'j- h(j+ ubaubjø)r3 }r4 (h'Uh>}r5 (hB]hC]hA]h@]hD]uh(j hI]r6 (jþ)r7 }r8 (h'X_deliver Deliver the cached object to the client. Control will eventually pass to vcl_deliver. h(j3 h2h5h}r9 (hB]hC]hA]h@]hD]uhGM#hI]r: (j)r; }r< (h'Xdeliverr= h(j7 h2h5h}r> (hB]hC]hA]h@]hD]uhGM#hI]r? hYXdeliverr@ …rA }rB (h'j= h(j; ubaubj)rC }rD (h'Uh>}rE (hB]hC]hA]h@]hD]uh(j7 hI]rF h†)rG }rH (h'XVDeliver the cached object to the client. Control will eventually pass to vcl_deliver.rI h(jC h2h5h}rJ (hB]hC]hA]h@]hD]uhGM"hI]rK hYXVDeliver the cached object to the client. Control will eventually pass to vcl_deliver.rL …rM }rN (h'jI h(jG ubaubah}rQ (hB]hC]hA]h@]hD]uhGM&hI]rR (j)rS }rT (h'Xerror code [reason]rU h(jO h2h5h}rV (hB]hC]hA]h@]hD]uhGM&hI]rW hYXerror code [reason]rX …rY }rZ (h'jU h(jS ubaubj)r[ }r\ (h'Uh>}r] (hB]hC]hA]h@]hD]uh(jO hI]r^ h†)r_ }r` (h'XFReturn the specified error code to the client and abandon the request.ra h(j[ h2h5h}rb (hB]hC]hA]h@]hD]uhGM&hI]rc hYXFReturn the specified error code to the client and abandon the request.rd …re }rf (h'ja h(j_ ubaubah}ri (hB]hC]hA]h@]hD]uhGM)hI]rj (j)rk }rl (h'Xpassrm h(jg h2h5h}rn (hB]hC]hA]h@]hD]uhGM)hI]ro hYXpassrp …rq }rr (h'jm h(jk ubaubj)rs }rt (h'Uh>}ru (hB]hC]hA]h@]hD]uh(jg hI]rv h†)rw }rx (h'X?Switch to pass mode. Control will eventually pass to vcl_pass.ry h(js h2h5h}rz (hB]hC]hA]h@]hD]uhGM)hI]r{ hYX?Switch to pass mode. Control will eventually pass to vcl_pass.r| …r} }r~ (h'jy h(jw ubaubah}r (hB]hC]hA]h@]hD]uhGM.hI]r‚ (j)rƒ }r„ (h'Xrestartr… h(j h2h5h}r† (hB]hC]hA]h@]hD]uhGM.hI]r‡ hYXrestartrˆ …r‰ }rŠ (h'j… h(jƒ ubaubj)r‹ }rŒ (h'Uh>}r (hB]hC]hA]h@]hD]uh(j hI]rŽ h†)r }r (h'X–Restart the transaction. Increases the restart counter. If the number of restarts is higher than *max_restarts* varnish emits a guru meditation error.h(j‹ h2h5h}r‘ (hB]hC]hA]h@]hD]uhGM,hI]r’ (hYXaRestart the transaction. Increases the restart counter. If the number of restarts is higher than r“ …r” }r• (h'XaRestart the transaction. Increases the restart counter. If the number of restarts is higher than h(j ubj\)r– }r— (h'X*max_restarts*h>}r˜ (hB]hC]hA]h@]hD]uh(j hI]r™ hYX max_restartsrš …r› }rœ (h'Uh(j– ubah}r¢ (hB]hC]hA]h@]hD]uhGM@hHhhI]r£ (j)r¤ }r¥ (h'Xvcl_missr¦ h(j  h2h5h}r§ (hB]hC]hA]h@]hD]uhGM@hI]r¨ hYXvcl_missr© …rª }r« (h'j¦ h(j¤ ubaubj)r¬ }r­ (h'Uh>}r® (hB]hC]hA]h@]hD]uh(j  hI]r¯ (h†)r° }r± (h'XÊCalled after a cache lookup if the requested document was not found in the cache. Its purpose is to decide whether or not to attempt to retrieve the document from the backend, and which backend to use.r² h(j¬ h2h5h}r³ (hB]hC]hA]h@]hD]uhGM1hI]r´ hYXÊCalled after a cache lookup if the requested document was not found in the cache. Its purpose is to decide whether or not to attempt to retrieve the document from the backend, and which backend to use.rµ …r¶ }r· (h'j² h(j° ubaubh†)r¸ }r¹ (h'X_The vcl_miss subroutine may terminate with calling return() with one of the following keywords:rº h(j¬ h2h5h}r» (hB]hC]hA]h@]hD]uhGM5hI]r¼ hYX_The vcl_miss subroutine may terminate with calling return() with one of the following keywords:r½ …r¾ }r¿ (h'jº h(j¸ ubaubjø)rÀ }rÁ (h'Uh>}r (hB]hC]hA]h@]hD]uh(j¬ hI]rà (jþ)rÄ }rÅ (h'X[error code [reason] Return the specified error code to the client and abandon the request. h(jÀ h2h5h}rÆ (hB]hC]hA]h@]hD]uhGM9hI]rÇ (j)rÈ }rÉ (h'Xerror code [reason]rÊ h(jÄ h2h5h}rË (hB]hC]hA]h@]hD]uhGM9hI]rÌ hYXerror code [reason]rÍ …rÎ }rÏ (h'jÊ h(jÈ ubaubj)rÐ }rÑ (h'Uh>}rÒ (hB]hC]hA]h@]hD]uh(jÄ hI]rÓ h†)rÔ }rÕ (h'XFReturn the specified error code to the client and abandon the request.rÖ h(jÐ h2h5h}r× (hB]hC]hA]h@]hD]uhGM9hI]rØ hYXFReturn the specified error code to the client and abandon the request.rÙ …rÚ }rÛ (h'jÖ h(jÔ ubaubah}rÞ (hB]hC]hA]h@]hD]uhGM<hI]rß (j)rà }rá (h'Xpassrâ h(jÜ h2h5h}rã (hB]hC]hA]h@]hD]uhGM<hI]rä hYXpassrå …ræ }rç (h'jâ h(jà ubaubj)rè }ré (h'Uh>}rê (hB]hC]hA]h@]hD]uh(jÜ hI]rë h†)rì }rí (h'X?Switch to pass mode. Control will eventually pass to vcl_pass.rî h(jè h2h5h}rï (hB]hC]hA]h@]hD]uhGM<hI]rð hYX?Switch to pass mode. Control will eventually pass to vcl_pass.rñ …rò }ró (h'jî h(jì ubaubah}rö (hB]hC]hA]h@]hD]uhGM@hI]r÷ (j)rø }rù (h'Xfetchrú h(jô h2h5h}rû (hB]hC]hA]h@]hD]uhGM@hI]rü hYXfetchrý …rþ }rÿ (h'jú h(jø ubaubj)r }r (h'Uh>}r (hB]hC]hA]h@]hD]uh(jô hI]r h†)r }r (h'X[Retrieve the requested object from the backend. Control will eventually pass to vcl_fetch.r h(j h2h5h}r (hB]hC]hA]h@]hD]uhGM?hI]r hYX[Retrieve the requested object from the backend. Control will eventually pass to vcl_fetch.r …r }r (h'j h(j ubaubah}r (hB]hC]hA]h@]hD]uhGMYhHhhI]r (j)r }r (h'X vcl_fetchr h(j h2h5h}r (hB]hC]hA]h@]hD]uhGMYhI]r hYX vcl_fetchr …r }r (h'j h(j ubaubj)r }r (h'Uh>}r (hB]hC]hA]h@]hD]uh(j hI]r (h†)r }r (h'XICalled after a document has been successfully retrieved from the backend.r h(j h2h5h}r (hB]hC]hA]h@]hD]uhGMChI]r hYXICalled after a document has been successfully retrieved from the backend.r! …r" }r# (h'j h(j ubaubh†)r$ }r% (h'X`The vcl_fetch subroutine may terminate with calling return() with one of the following keywords:r& h(j h2h5h}r' (hB]hC]hA]h@]hD]uhGMEhI]r( hYX`The vcl_fetch subroutine may terminate with calling return() with one of the following keywords:r) …r* }r+ (h'j& h(j$ ubaubjø)r, }r- (h'Uh>}r. (hB]hC]hA]h@]hD]uh(j hI]r/ (jþ)r0 }r1 (h'X€deliver Possibly insert the object into the cache, then deliver it to the client. Control will eventually pass to vcl_deliver. h(j, h2h5h}r2 (hB]hC]hA]h@]hD]uhGMJhI]r3 (j)r4 }r5 (h'Xdeliverr6 h(j0 h2h5h}r7 (hB]hC]hA]h@]hD]uhGMJhI]r8 hYXdeliverr9 …r: }r; (h'j6 h(j4 ubaubj)r< }r= (h'Uh>}r> (hB]hC]hA]h@]hD]uh(j0 hI]r? h†)r@ }rA (h'XwPossibly insert the object into the cache, then deliver it to the client. Control will eventually pass to vcl_deliver.rB h(j< h2h5h}rC (hB]hC]hA]h@]hD]uhGMIhI]rD hYXwPossibly insert the object into the cache, then deliver it to the client. Control will eventually pass to vcl_deliver.rE …rF }rG (h'jB h(j@ ubaubah}rJ (hB]hC]hA]h@]hD]uhGMMhI]rK (j)rL }rM (h'Xerror code [reason]rN h(jH h2h5h}rO (hB]hC]hA]h@]hD]uhGMMhI]rP hYXerror code [reason]rQ …rR }rS (h'jN h(jL ubaubj)rT }rU (h'Uh>}rV (hB]hC]hA]h@]hD]uh(jH hI]rW h†)rX }rY (h'XFReturn the specified error code to the client and abandon the request.rZ h(jT h2h5h}r[ (hB]hC]hA]h@]hD]uhGMMhI]r\ hYXFReturn the specified error code to the client and abandon the request.r] …r^ }r_ (h'jZ h(jX ubaubah}rb (hB]hC]hA]h@]hD]uhGMThI]rc (j)rd }re (h'X hit_for_passrf h(j` h2h5h}rg (hB]hC]hA]h@]hD]uhGMThI]rh hYX hit_for_passri …rj }rk (h'jf h(jd ubaubj)rl }rm (h'Uh>}rn (hB]hC]hA]h@]hD]uh(j` hI]ro h†)rp }rq (h'X/Pass in fetch. This will create a hit_for_pass object. Note that the TTL for the hit_for_pass object will be set to what the current value of beresp.ttl. Control will be handled to vcl_deliver on the current request, but subsequent requests will go directly to vcl_pass based on the hit_for_pass object.rr h(jl h2h5h}rs (hB]hC]hA]h@]hD]uhGMPhI]rt hYX/Pass in fetch. This will create a hit_for_pass object. Note that the TTL for the hit_for_pass object will be set to what the current value of beresp.ttl. Control will be handled to vcl_deliver on the current request, but subsequent requests will go directly to vcl_pass based on the hit_for_pass object.ru …rv }rw (h'jr h(jp ubaubah}rz (hB]hC]hA]h@]hD]uhGMYhI]r{ (j)r| }r} (h'Xrestartr~ h(jx h2h5h}r (hB]hC]hA]h@]hD]uhGMYhI]r€ hYXrestartr …r‚ }rƒ (h'j~ h(j| ubaubj)r„ }r… (h'Uh>}r† (hB]hC]hA]h@]hD]uh(jx hI]r‡ h†)rˆ }r‰ (h'X–Restart the transaction. Increases the restart counter. If the number of restarts is higher than *max_restarts* varnish emits a guru meditation error.h(j„ h2h5h}rŠ (hB]hC]hA]h@]hD]uhGMWhI]r‹ (hYXaRestart the transaction. Increases the restart counter. If the number of restarts is higher than rŒ …r }rŽ (h'XaRestart the transaction. Increases the restart counter. If the number of restarts is higher than h(jˆ ubj\)r }r (h'X*max_restarts*h>}r‘ (hB]hC]hA]h@]hD]uh(jˆ hI]r’ hYX max_restartsr“ …r” }r• (h'Uh(j ubah}r› (hB]hC]hA]h@]hD]uhGMghHhhI]rœ (j)r }rž (h'X vcl_deliverrŸ h(j™ h2h5h}r  (hB]hC]hA]h@]hD]uhGMghI]r¡ hYX vcl_deliverr¢ …r£ }r¤ (h'jŸ h(j ubaubj)r¥ }r¦ (h'Uh>}r§ (hB]hC]hA]h@]hD]uh(j™ hI]r¨ (h†)r© }rª (h'X9Called before a cached object is delivered to the client.r« h(j¥ h2h5h}r¬ (hB]hC]hA]h@]hD]uhGM\hI]r­ hYX9Called before a cached object is delivered to the client.r® …r¯ }r° (h'j« h(j© ubaubh†)r± }r² (h'XLThe vcl_deliver subroutine may terminate with one of the following keywords:r³ h(j¥ h2h5h}r´ (hB]hC]hA]h@]hD]uhGM^hI]rµ hYXLThe vcl_deliver subroutine may terminate with one of the following keywords:r¶ …r· }r¸ (h'j³ h(j± ubaubjø)r¹ }rº (h'Uh>}r» (hB]hC]hA]h@]hD]uh(j¥ hI]r¼ (jþ)r½ }r¾ (h'X*deliver Deliver the object to the client. h(j¹ h2h5h}r¿ (hB]hC]hA]h@]hD]uhGMbhI]rÀ (j)rÁ }r (h'Xdeliverrà h(j½ h2h5h}rÄ (hB]hC]hA]h@]hD]uhGMbhI]rÅ hYXdeliverrÆ …rÇ }rÈ (h'jà h(jÁ ubaubj)rÉ }rÊ (h'Uh>}rË (hB]hC]hA]h@]hD]uh(j½ hI]rÌ h†)rÍ }rÎ (h'X!Deliver the object to the client.rÏ h(jÉ h2h5h}rÐ (hB]hC]hA]h@]hD]uhGMbhI]rÑ hYX!Deliver the object to the client.rÒ …rÓ }rÔ (h'jÏ h(jÍ ubaubah}r× (hB]hC]hA]h@]hD]uhGMghI]rØ (j)rÙ }rÚ (h'XrestartrÛ h(jÕ h2h5h}rÜ (hB]hC]hA]h@]hD]uhGMghI]rÝ hYXrestartrÞ …rß }rà (h'jÛ h(jÙ ubaubj)rá }râ (h'Uh>}rã (hB]hC]hA]h@]hD]uh(jÕ hI]rä h†)rå }ræ (h'X–Restart the transaction. Increases the restart counter. If the number of restarts is higher than *max_restarts* varnish emits a guru meditation error.h(já h2h5h}rç (hB]hC]hA]h@]hD]uhGMehI]rè (hYXaRestart the transaction. Increases the restart counter. If the number of restarts is higher than ré …rê }rë (h'XaRestart the transaction. Increases the restart counter. If the number of restarts is higher than h(jå ubj\)rì }rí (h'X*max_restarts*h>}rî (hB]hC]hA]h@]hD]uh(jå hI]rï hYX max_restartsrð …rñ }rò (h'Uh(jì ubah}rø (hB]hC]hA]h@]hD]uhGMvhHhhI]rù (j)rú }rû (h'X vcl_errorrü h(jö h2h5h}rý (hB]hC]hA]h@]hD]uhGMvhI]rþ hYX vcl_errorrÿ …r }r (h'jü h(jú ubaubj)r }r (h'Uh>}r (hB]hC]hA]h@]hD]uh(jö hI]r (h†)r }r (h'X_Called when we hit an error, either explicitly or implicitly due to backend or internal errors.r h(j h2h5h}r (hB]hC]hA]h@]hD]uhGMjhI]r hYX_Called when we hit an error, either explicitly or implicitly due to backend or internal errors.r …r }r (h'j h(j ubaubh†)r }r (h'X\The vcl_error subroutine may terminate by calling return with one of the following keywords:r h(j h2h5h}r (hB]hC]hA]h@]hD]uhGMmhI]r hYX\The vcl_error subroutine may terminate by calling return with one of the following keywords:r …r }r (h'j h(j ubaubjø)r }r (h'Uh>}r (hB]hC]hA]h@]hD]uh(j hI]r (jþ)r }r (h'X0deliver Deliver the error object to the client. h(j h2h5h}r (hB]hC]hA]h@]hD]uhGMqhI]r (j)r }r (h'Xdeliverr h(j h2h5h}r! (hB]hC]hA]h@]hD]uhGMqhI]r" hYXdeliverr# …r$ }r% (h'j h(j ubaubj)r& }r' (h'Uh>}r( (hB]hC]hA]h@]hD]uh(j hI]r) h†)r* }r+ (h'X'Deliver the error object to the client.r, h(j& h2h5h}r- (hB]hC]hA]h@]hD]uhGMqhI]r. hYX'Deliver the error object to the client.r/ …r0 }r1 (h'j, h(j* ubaubah}r4 (hB]hC]hA]h@]hD]uhGMvhI]r5 (j)r6 }r7 (h'Xrestartr8 h(j2 h2h5h}r9 (hB]hC]hA]h@]hD]uhGMvhI]r: hYXrestartr; …r< }r= (h'j8 h(j6 ubaubj)r> }r? (h'Uh>}r@ (hB]hC]hA]h@]hD]uh(j2 hI]rA h†)rB }rC (h'X–Restart the transaction. Increases the restart counter. If the number of restarts is higher than *max_restarts* varnish emits a guru meditation error.h(j> h2h5h}rD (hB]hC]hA]h@]hD]uhGMthI]rE (hYXaRestart the transaction. Increases the restart counter. If the number of restarts is higher than rF …rG }rH (h'XaRestart the transaction. Increases the restart counter. If the number of restarts is higher than h(jB ubj\)rI }rJ (h'X*max_restarts*h>}rK (hB]hC]hA]h@]hD]uh(jB hI]rL hYX max_restartsrM …rN }rO (h'Uh(jI ubah}rU (hB]hC]hA]h@]hD]uhGM€hHhhI]rV (j)rW }rX (h'Xvcl_finirY h(jS h2h5h}rZ (hB]hC]hA]h@]hD]uhGM€hI]r[ hYXvcl_finir\ …r] }r^ (h'jY h(jW ubaubj)r_ }r` (h'Uh>}ra (hB]hC]hA]h@]hD]uh(jS hI]rb (h†)rc }rd (h'XkCalled when VCL is discarded only after all requests have exited the VCL. Typically used to clean up VMODs.re h(j_ h2h5h}rf (hB]hC]hA]h@]hD]uhGMyhI]rg hYXkCalled when VCL is discarded only after all requests have exited the VCL. Typically used to clean up VMODs.rh …ri }rj (h'je h(jc ubaubh†)rk }rl (h'Xreturn() values:rm h(j_ h2h5h}rn (hB]hC]hA]h@]hD]uhGM|hI]ro hYXreturn() values:rp …rq }rr (h'jm h(jk ubaubjø)rs }rt (h'Uh>}ru (hB]hC]hA]h@]hD]uh(j_ hI]rv jþ)rw }rx (h'X*ok Normal return, VCL will be discarded. h(js h2h5h}ry (hB]hC]hA]h@]hD]uhGM€hI]rz (j)r{ }r| (h'Xokr} h(jw h2h5h}r~ (hB]hC]hA]h@]hD]uhGM€hI]r hYXokr€ …r }r‚ (h'j} h(j{ ubaubj)rƒ }r„ (h'Uh>}r… (hB]hC]hA]h@]hD]uh(jw hI]r† h†)r‡ }rˆ (h'X%Normal return, VCL will be discarded.r‰ h(jƒ h2h5h}rŠ (hB]hC]hA]h@]hD]uhGMhI]r‹ hYX%Normal return, VCL will be discarded.rŒ …r }rŽ (h'j‰ h(j‡ ubaubah}r’ (hB]hC]hA]h@]hD]uhGM‚hHhhI]r“ hYXÒIf one of these subroutines is left undefined or terminates without reaching a handling decision, control will be handed over to the builtin default. See the EXAMPLES section for a listing of the default code.r” …r• }r– (h'j‘ h(j ubaubeubh))r— }r˜ (h'Uh(jWh2h5h}r™ (hB]hC]hA]h@]rš Umultiple-subroutinesr› ahD]rœ hauhGMˆhHhhI]r (hR)rž }rŸ (h'XMultiple subroutinesr  h(j— h2h5h}r¡ (hB]hC]hA]h@]hD]uhGMˆhHhhI]r¢ hYXMultiple subroutinesr£ …r¤ }r¥ (h'j  h(jž ubaubh†)r¦ }r§ (h'XIf multiple subroutines with the the name of one of the builtin ones are defined, they are concatenated in the order in which they appear in the source. The default versions distributed with Varnish will be implicitly concatenated as a last resort at the end.r¨ h(j— h2h5h}r© (hB]hC]hA]h@]hD]uhGM‰hHhhI]rª hYXIf multiple subroutines with the the name of one of the builtin ones are defined, they are concatenated in the order in which they appear in the source. The default versions distributed with Varnish will be implicitly concatenated as a last resort at the end.r« …r¬ }r­ (h'j¨ h(j¦ ubaubh†)r® }r¯ (h'X Example: ::h(j— h2h5h}r° (hB]hC]hA]h@]hD]uhGMhHhhI]r± hYXExample:r² …r³ }r´ (h'XExample:h(j® ubaubjS)rµ }r¶ (h'X™# in file "main.vcl" include "backends.vcl"; include "ban.vcl"; # in file "backends.vcl" sub vcl_recv { if (req.http.host ~ "(?i)example.com") { set req.backend = foo; } elsif (req.http.host ~ "(?i)example.org") { set req.backend = bar; } } # in file "ban.vcl" sub vcl_recv { if (client.ip ~ admin_network) { if (req.http.Cache-Control ~ "no-cache") { ban_url(req.url); } } }h(j— h2h5h}r· (jXjYh@]hA]hB]hC]hD]uhGM’hHhhI]r¸ hYX™# in file "main.vcl" include "backends.vcl"; include "ban.vcl"; # in file "backends.vcl" sub vcl_recv { if (req.http.host ~ "(?i)example.com") { set req.backend = foo; } elsif (req.http.host ~ "(?i)example.org") { set req.backend = bar; } } # in file "ban.vcl" sub vcl_recv { if (client.ip ~ admin_network) { if (req.http.Cache-Control ~ "no-cache") { ban_url(req.url); } } }r¹ …rº }r» (h'Uh(jµ ubaubeubh))r¼ }r½ (h'Uh(jWh2h5h}r¾ (hB]hC]hA]h@]r¿ U variablesrÀ ahD]rÁ hauhGM©hHhhI]r (hR)rà }rÄ (h'X VariablesrÅ h(j¼ h2h5h}rÆ (hB]hC]hA]h@]hD]uhGM©hHhhI]rÇ hYX VariablesrÈ …rÉ }rÊ (h'jÅ h(jà ubaubh†)rË }rÌ (h'XˆAlthough subroutines take no arguments, the necessary information is made available to the handler subroutines through global variables.rÍ h(j¼ h2h5h}rÎ (hB]hC]hA]h@]hD]uhGM«hHhhI]rÏ hYXˆAlthough subroutines take no arguments, the necessary information is made available to the handler subroutines through global variables.rÐ …rÑ }rÒ (h'jÍ h(jË ubaubh†)rÓ }rÔ (h'X-The following variables are always available:rÕ h(j¼ h2h5h}rÖ (hB]hC]hA]h@]hD]uhGM®hHhhI]r× hYX-The following variables are always available:rØ …rÙ }rÚ (h'jÕ h(jÓ ubaubjø)rÛ }rÜ (h'Uh(j¼ h2h5h}rÝ (hB]hC]hA]h@]hD]uhGNhHhhI]rÞ jþ)rß }rà (h'Xmnow The current time, in seconds since the epoch. When used in string context it returns a formatted string. h(jÛ h2h5h}rá (hB]hC]hA]h@]hD]uhGM²hI]râ (j)rã }rä (h'Xnowrå h(jß h2h5h}ræ (hB]hC]hA]h@]hD]uhGM²hI]rç hYXnowrè …ré }rê (h'jå h(jã ubaubj)rë }rì (h'Uh>}rí (hB]hC]hA]h@]hD]uh(jß hI]rî h†)rï }rð (h'XhThe current time, in seconds since the epoch. When used in string context it returns a formatted string.rñ h(jë h2h5h}rò (hB]hC]hA]h@]hD]uhGM±hI]ró hYXhThe current time, in seconds since the epoch. When used in string context it returns a formatted string.rô …rõ }rö (h'jñ h(jï ubaubahThe following variables are available in backend declarations:rù h(j¼ h2h5h}rú (hB]hC]hA]h@]hD]uhGM´hHhhI]rû hYX>The following variables are available in backend declarations:rü …rý }rþ (h'jù h(j÷ ubaubjø)rÿ }r (h'Uh(j¼ h2h5h}r (hB]hC]hA]h@]hD]uhGNhHhhI]r (jþ)r }r (h'X,.host Host name or IP address of a backend. h(jÿ h2h5h}r (hB]hC]hA]h@]hD]uhGM·hI]r (j)r }r (h'X.hostr h(j h2h5h}r (hB]hC]hA]h@]hD]uhGM·hI]r hYX.hostr …r }r (h'j h(j ubaubj)r }r (h'Uh>}r (hB]hC]hA]h@]hD]uh(j hI]r h†)r }r (h'X%Host name or IP address of a backend.r h(j h2h5h}r (hB]hC]hA]h@]hD]uhGM·hI]r hYX%Host name or IP address of a backend.r …r }r (h'j h(j ubaubah}r (hB]hC]hA]h@]hD]uhGMºhHhhI]r (j)r }r (h'X.portr! h(j h2h5h}r" (hB]hC]hA]h@]hD]uhGMºhI]r# hYX.portr$ …r% }r& (h'j! h(j ubaubj)r' }r( (h'Uh>}r) (hB]hC]hA]h@]hD]uh(j hI]r* h†)r+ }r, (h'X)Service name or port number of a backend.r- h(j' h2h5h}r. (hB]hC]hA]h@]hD]uhGMºhI]r/ hYX)Service name or port number of a backend.r0 …r1 }r2 (h'j- h(j+ ubaubah}r6 (hB]hC]hA]h@]hD]uhGM¼hHhhI]r7 hYXAThe following variables are available while processing a request:r8 …r9 }r: (h'j5 h(j3 ubaubjø)r; }r< (h'Uh(j¼ h2h5h}r= (hB]hC]hA]h@]hD]uhGNhHhhI]r> (jþ)r? }r@ (h'X#client.ip The client's IP address. h(j; h2h5h}rA (hB]hC]hA]h@]hD]uhGM¿hI]rB (j)rC }rD (h'X client.iprE h(j? h2h5h}rF (hB]hC]hA]h@]hD]uhGM¿hI]rG hYX client.iprH …rI }rJ (h'jE h(jC ubaubj)rK }rL (h'Uh>}rM (hB]hC]hA]h@]hD]uh(j? hI]rN h†)rO }rP (h'XThe client's IP address.rQ h(jK h2h5h}rR (hB]hC]hA]h@]hD]uhGM¿hI]rS hYXThe client's IP address.rT …rU }rV (h'jQ h(jO ubaubah}rY (hB]hC]hA]h@]hD]uhGMÂhHhhI]rZ (j)r[ }r\ (h'Xclient.identityr] h(jW h2h5h}r^ (hB]hC]hA]h@]hD]uhGMÂhI]r_ hYXclient.identityr` …ra }rb (h'j] h(j[ ubaubj)rc }rd (h'Uh>}re (hB]hC]hA]h@]hD]uh(jW hI]rf h†)rg }rh (h'XJIdentification of the client, used to load balance in the client director.ri h(jc h2h5h}rj (hB]hC]hA]h@]hD]uhGMÂhI]rk hYXJIdentification of the client, used to load balance in the client director.rl …rm }rn (h'ji h(jg ubaubah}rq (hB]hC]hA]h@]hD]uhGMÅhHhhI]rr (j)rs }rt (h'Xserver.hostnameru h(jo h2h5h}rv (hB]hC]hA]h@]hD]uhGMÅhI]rw hYXserver.hostnamerx …ry }rz (h'ju h(js ubaubj)r{ }r| (h'Uh>}r} (hB]hC]hA]h@]hD]uh(jo hI]r~ h†)r }r€ (h'XThe host name of the server.r h(j{ h2h5h}r‚ (hB]hC]hA]h@]hD]uhGMÅhI]rƒ hYXThe host name of the server.r„ …r… }r† (h'j h(j ubaubah}r‰ (hB]hC]hA]h@]hD]uhGMËhHhhI]rŠ (j)r‹ }rŒ (h'Xserver.identityr h(j‡ h2h5h}rŽ (hB]hC]hA]h@]hD]uhGMËhI]r hYXserver.identityr …r‘ }r’ (h'j h(j‹ ubaubj)r“ }r” (h'Uh>}r• (hB]hC]hA]h@]hD]uh(j‡ hI]r– h†)r— }r˜ (h'XÂ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.r™ h(j“ h2h5h}rš (hB]hC]hA]h@]hD]uhGMÈhI]r› hYXÂ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.rœ …r }rž (h'j™ h(j— ubaubah}r¡ (hB]hC]hA]h@]hD]uhGMÎhHhhI]r¢ (j)r£ }r¤ (h'X server.ipr¥ h(jŸ h2h5h}r¦ (hB]hC]hA]h@]hD]uhGMÎhI]r§ hYX server.ipr¨ …r© }rª (h'j¥ h(j£ ubaubj)r« }r¬ (h'Uh>}r­ (hB]hC]hA]h@]hD]uh(jŸ hI]r® h†)r¯ }r° (h'XIThe IP address of the socket on which the client connection was received.r± h(j« h2h5h}r² (hB]hC]hA]h@]hD]uhGMÎhI]r³ hYXIThe IP address of the socket on which the client connection was received.r´ …rµ }r¶ (h'j± h(j¯ ubaubah}r¹ (hB]hC]hA]h@]hD]uhGMÑhHhhI]rº (j)r» }r¼ (h'X server.portr½ h(j· h2h5h}r¾ (hB]hC]hA]h@]hD]uhGMÑhI]r¿ hYX server.portrÀ …rÁ }r (h'j½ h(j» ubaubj)rà }rÄ (h'Uh>}rÅ (hB]hC]hA]h@]hD]uh(j· hI]rÆ h†)rÇ }rÈ (h'XJThe port number of the socket on which the client connection was received.rÉ h(jà h2h5h}rÊ (hB]hC]hA]h@]hD]uhGMÑhI]rË hYXJThe port number of the socket on which the client connection was received.rÌ …rÍ }rÎ (h'jÉ h(jÇ ubaubah}rÑ (hB]hC]hA]h@]hD]uhGMÔhHhhI]rÒ (j)rÓ }rÔ (h'X req.requestrÕ h(jÏ h2h5h}rÖ (hB]hC]hA]h@]hD]uhGMÔhI]r× hYX req.requestrØ …rÙ }rÚ (h'jÕ h(jÓ ubaubj)rÛ }rÜ (h'Uh>}rÝ (hB]hC]hA]h@]hD]uh(jÏ hI]rÞ h†)rß }rà (h'X&The request type (e.g. "GET", "HEAD").rá h(jÛ h2h5h}râ (hB]hC]hA]h@]hD]uhGMÔhI]rã hYX&The request type (e.g. "GET", "HEAD").rä …rå }ræ (h'já h(jß ubaubah}ré (hB]hC]hA]h@]hD]uhGM×hHhhI]rê (j)rë }rì (h'Xreq.urlrí h(jç h2h5h}rî (hB]hC]hA]h@]hD]uhGM×hI]rï hYXreq.urlrð …rñ }rò (h'jí h(jë ubaubj)ró }rô (h'Uh>}rõ (hB]hC]hA]h@]hD]uh(jç hI]rö h†)r÷ }rø (h'XThe requested URL.rù h(jó h2h5h}rú (hB]hC]hA]h@]hD]uhGM×hI]rû hYXThe requested URL.rü …rý }rþ (h'jù h(j÷ ubaubah}r (hB]hC]hA]h@]hD]uhGMÚhHhhI]r (j)r }r (h'X req.protor h(jÿ h2h5h}r (hB]hC]hA]h@]hD]uhGMÚhI]r hYX req.protor …r }r (h'j h(j ubaubj)r }r (h'Uh>}r (hB]hC]hA]h@]hD]uh(jÿ hI]r h†)r }r (h'X-The HTTP protocol version used by the client.r h(j h2h5h}r (hB]hC]hA]h@]hD]uhGMÚhI]r hYX-The HTTP protocol version used by the client.r …r }r (h'j h(j ubaubah}r (hB]hC]hA]h@]hD]uhGMÝhHhhI]r (j)r }r (h'X req.backendr h(j h2h5h}r (hB]hC]hA]h@]hD]uhGMÝhI]r hYX req.backendr …r! }r" (h'j h(j ubaubj)r# }r$ (h'Uh>}r% (hB]hC]hA]h@]hD]uh(j hI]r& h†)r' }r( (h'X*The backend to use to service the request.r) h(j# h2h5h}r* (hB]hC]hA]h@]hD]uhGMÝhI]r+ hYX*The backend to use to service the request.r, …r- }r. (h'j) h(j' ubaubah}r1 (hB]hC]hA]h@]hD]uhGMáhHhhI]r2 (j)r3 }r4 (h'Xreq.backend.healthyr5 h(j/ h2h5h}r6 (hB]hC]hA]h@]hD]uhGMáhI]r7 hYXreq.backend.healthyr8 …r9 }r: (h'j5 h(j3 ubaubj)r; }r< (h'Uh>}r= (hB]hC]hA]h@]hD]uh(j/ hI]r> h†)r? }r@ (h'XYWhether the backend is healthy or not. Requires an active probe to be set on the backend.rA h(j; h2h5h}rB (hB]hC]hA]h@]hD]uhGMàhI]rC hYXYWhether the backend is healthy or not. Requires an active probe to be set on the backend.rD …rE }rF (h'jA h(j? ubaubah}rI (hB]hC]hA]h@]hD]uhGMähHhhI]rJ (j)rK }rL (h'Xreq.http.headerrM h(jG h2h5h}rN (hB]hC]hA]h@]hD]uhGMähI]rO hYXreq.http.headerrP …rQ }rR (h'jM h(jK ubaubj)rS }rT (h'Uh>}rU (hB]hC]hA]h@]hD]uh(jG hI]rV h†)rW }rX (h'XThe corresponding HTTP header.rY h(jS h2h5h}rZ (hB]hC]hA]h@]hD]uhGMähI]r[ hYXThe corresponding HTTP header.r\ …r] }r^ (h'jY h(jW ubaubah}ra (hB]hC]hA]h@]hD]uhGMèhHhhI]rb (j)rc }rd (h'Xreq.hash_always_missre h(j_ h2h5h}rf (hB]hC]hA]h@]hD]uhGMèhI]rg hYXreq.hash_always_missrh …ri }rj (h'je h(jc ubaubj)rk }rl (h'Uh>}rm (hB]hC]hA]h@]hD]uh(j_ hI]rn h†)ro }rp (h'X†Force a cache miss for this request. If set to true Varnish will disregard any existing objects and always (re)fetch from the backend.rq h(jk h2h5h}rr (hB]hC]hA]h@]hD]uhGMçhI]rs hYX†Force a cache miss for this request. If set to true Varnish will disregard any existing objects and always (re)fetch from the backend.rt …ru }rv (h'jq h(jo ubaubah}ry (hB]hC]hA]h@]hD]uhGMíhHhhI]rz (j)r{ }r| (h'Xreq.hash_ignore_busyr} h(jw h2h5h}r~ (hB]hC]hA]h@]hD]uhGMíhI]r hYXreq.hash_ignore_busyr€ …r }r‚ (h'j} h(j{ ubaubj)rƒ }r„ (h'Uh>}r… (hB]hC]hA]h@]hD]uh(jw hI]r† h†)r‡ }rˆ (h'XIgnore 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.r‰ h(jƒ h2h5h}rŠ (hB]hC]hA]h@]hD]uhGMëhI]r‹ hYXIgnore 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.rŒ …r }rŽ (h'j‰ h(j‡ ubaubah}r‘ (hB]hC]hA]h@]hD]uhGMðhHhhI]r’ (j)r“ }r” (h'X req.can_gzipr• h(j h2h5h}r– (hB]hC]hA]h@]hD]uhGMðhI]r— hYX req.can_gzipr˜ …r™ }rš (h'j• h(j“ ubaubj)r› }rœ (h'Uh>}r (hB]hC]hA]h@]hD]uh(j hI]rž h†)rŸ }r  (h'X2Does the client accept the gzip transfer encoding.r¡ h(j› h2h5h}r¢ (hB]hC]hA]h@]hD]uhGMðhI]r£ hYX2Does the client accept the gzip transfer encoding.r¤ …r¥ }r¦ (h'j¡ h(jŸ ubaubah}r© (hB]hC]hA]h@]hD]uhGMóhHhhI]rª (j)r« }r¬ (h'X req.restartsr­ h(j§ h2h5h}r® (hB]hC]hA]h@]hD]uhGMóhI]r¯ hYX req.restartsr° …r± }r² (h'j­ h(j« ubaubj)r³ }r´ (h'Uh>}rµ (hB]hC]hA]h@]hD]uh(j§ hI]r¶ h†)r· }r¸ (h'X:A count of how many times this request has been restarted.r¹ h(j³ h2h5h}rº (hB]hC]hA]h@]hD]uhGMóhI]r» hYX:A count of how many times this request has been restarted.r¼ …r½ }r¾ (h'j¹ h(j· ubaubah}rÁ (hB]hC]hA]h@]hD]uhGMøhHhhI]r (j)rà }rÄ (h'Xreq.esirÅ h(j¿ h2h5h}rÆ (hB]hC]hA]h@]hD]uhGMøhI]rÇ hYXreq.esirÈ …rÉ }rÊ (h'jÅ h(jà ubaubj)rË }rÌ (h'Uh>}rÍ (hB]hC]hA]h@]hD]uh(j¿ hI]rÎ h†)rÏ }rÐ (h'X½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.rÑ h(jË h2h5h}rÒ (hB]hC]hA]h@]hD]uhGMöhI]rÓ hYX½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.rÔ …rÕ }rÖ (h'jÑ h(jÏ ubaubah}rÙ (hB]hC]hA]h@]hD]uhGMûhHhhI]rÚ (j)rÛ }rÜ (h'X req.esi_levelrÝ h(j× h2h5h}rÞ (hB]hC]hA]h@]hD]uhGMûhI]rß hYX req.esi_levelrà …rá }râ (h'jÝ h(jÛ ubaubj)rã }rä (h'Uh>}rå (hB]hC]hA]h@]hD]uh(j× hI]ræ h†)rç }rè (h'X>A count of how many levels of ESI requests we're currently at.ré h(jã h2h5h}rê (hB]hC]hA]h@]hD]uhGMûhI]rë hYX>A count of how many levels of ESI requests we're currently at.rì …rí }rî (h'jé h(jç ubaubah}rñ (hB]hC]hA]h@]hD]uhGMþhHhhI]rò (j)ró }rô (h'X req.gracerõ h(jï h2h5h}rö (hB]hC]hA]h@]hD]uhGMþhI]r÷ hYX req.gracerø …rù }rú (h'jõ h(jó ubaubj)rû }rü (h'Uh>}rý (hB]hC]hA]h@]hD]uh(jï hI]rþ h†)rÿ }r(h'X Set to a period to enable grace.rh(jû h2h5h}r(hB]hC]hA]h@]hD]uhGMþhI]rhYX Set to a period to enable grace.r…r}r(h'jh(jÿ ubaubah}r (hB]hC]hA]h@]hD]uhGMhHhhI]r (j)r }r (h'Xreq.xidr h(jh2h5h}r(hB]hC]hA]h@]hD]uhGMhI]rhYXreq.xidr…r}r(h'j h(j ubaubj)r}r(h'Uh>}r(hB]hC]hA]h@]hD]uh(jhI]rh†)r}r(h'XUnique ID of this request.rh(jh2h5h}r(hB]hC]hA]h@]hD]uhGMhI]rhYXUnique ID of this request.r…r}r(h'jh(jubaubah}r"(hB]hC]hA]h@]hD]uhGMhHhhI]r#hYX{The following variables are available while preparing a backend request (either for a cache miss or for pass or pipe mode):r$…r%}r&(h'j!h(jubaubjø)r'}r((h'Uh(j¼ h2h5h}r)(hB]hC]hA]h@]hD]uhGNhHhhI]r*(jþ)r+}r,(h'X5bereq.request The request type (e.g. "GET", "HEAD"). h(j'h2h5h}r-(hB]hC]hA]h@]hD]uhGMhI]r.(j)r/}r0(h'X bereq.requestr1h(j+h2h5h}r2(hB]hC]hA]h@]hD]uhGMhI]r3hYX bereq.requestr4…r5}r6(h'j1h(j/ubaubj)r7}r8(h'Uh>}r9(hB]hC]hA]h@]hD]uh(j+hI]r:h†)r;}r<(h'X&The request type (e.g. "GET", "HEAD").r=h(j7h2h5h}r>(hB]hC]hA]h@]hD]uhGMhI]r?hYX&The request type (e.g. "GET", "HEAD").r@…rA}rB(h'j=h(j;ubaubah}rE(hB]hC]hA]h@]hD]uhGM hHhhI]rF(j)rG}rH(h'X bereq.urlrIh(jCh2h5h}rJ(hB]hC]hA]h@]hD]uhGM hI]rKhYX bereq.urlrL…rM}rN(h'jIh(jGubaubj)rO}rP(h'Uh>}rQ(hB]hC]hA]h@]hD]uh(jChI]rRh†)rS}rT(h'XThe requested URL.rUh(jOh2h5h}rV(hB]hC]hA]h@]hD]uhGM hI]rWhYXThe requested URL.rX…rY}rZ(h'jUh(jSubaubah}r](hB]hC]hA]h@]hD]uhGM hHhhI]r^(j)r_}r`(h'X bereq.protorah(j[h2h5h}rb(hB]hC]hA]h@]hD]uhGM hI]rchYX bereq.protord…re}rf(h'jah(j_ubaubj)rg}rh(h'Uh>}ri(hB]hC]hA]h@]hD]uh(j[hI]rjh†)rk}rl(h'X5The HTTP protocol version used to talk to the server.rmh(jgh2h5h}rn(hB]hC]hA]h@]hD]uhGM hI]rohYX5The HTTP protocol version used to talk to the server.rp…rq}rr(h'jmh(jkubaubah}ru(hB]hC]hA]h@]hD]uhGMhHhhI]rv(j)rw}rx(h'Xbereq.http.headerryh(jsh2h5h}rz(hB]hC]hA]h@]hD]uhGMhI]r{hYXbereq.http.headerr|…r}}r~(h'jyh(jwubaubj)r}r€(h'Uh>}r(hB]hC]hA]h@]hD]uh(jshI]r‚h†)rƒ}r„(h'XThe corresponding HTTP header.r…h(jh2h5h}r†(hB]hC]hA]h@]hD]uhGMhI]r‡hYXThe corresponding HTTP header.rˆ…r‰}rŠ(h'j…h(jƒubaubah}r(hB]hC]hA]h@]hD]uhGMhHhhI]rŽ(j)r}r(h'Xbereq.connect_timeoutr‘h(j‹h2h5h}r’(hB]hC]hA]h@]hD]uhGMhI]r“hYXbereq.connect_timeoutr”…r•}r–(h'j‘h(jubaubj)r—}r˜(h'Uh>}r™(hB]hC]hA]h@]hD]uh(j‹hI]ršh†)r›}rœ(h'X5The time in seconds to wait for a backend connection.rh(j—h2h5h}rž(hB]hC]hA]h@]hD]uhGMhI]rŸhYX5The time in seconds to wait for a backend connection.r …r¡}r¢(h'jh(j›ubaubah}r¥(hB]hC]hA]h@]hD]uhGMhHhhI]r¦(j)r§}r¨(h'Xbereq.first_byte_timeoutr©h(j£h2h5h}rª(hB]hC]hA]h@]hD]uhGMhI]r«hYXbereq.first_byte_timeoutr¬…r­}r®(h'j©h(j§ubaubj)r¯}r°(h'Uh>}r±(hB]hC]hA]h@]hD]uh(j£hI]r²h†)r³}r´(h'X]The time in seconds to wait for the first byte from the backend. Not available in pipe mode.rµh(j¯h2h5h}r¶(hB]hC]hA]h@]hD]uhGMhI]r·hYX]The time in seconds to wait for the first byte from the backend. Not available in pipe mode.r¸…r¹}rº(h'jµh(j³ubaubah}r½(hB]hC]hA]h@]hD]uhGMhHhhI]r¾(j)r¿}rÀ(h'Xbereq.between_bytes_timeoutrÁh(j»h2h5h}rÂ(hB]hC]hA]h@]hD]uhGMhI]rÃhYXbereq.between_bytes_timeoutrÄ…rÅ}rÆ(h'jÁh(j¿ubaubj)rÇ}rÈ(h'Uh>}rÉ(hB]hC]hA]h@]hD]uh(j»hI]rÊh†)rË}rÌ(h'XeThe time in seconds to wait between each received byte from the backend. Not available in pipe mode.rÍh(jÇh2h5h}rÎ(hB]hC]hA]h@]hD]uhGMhI]rÏhYXeThe time in seconds to wait between each received byte from the backend. Not available in pipe mode.rÐ…rÑ}rÒ(h'jÍh(jËubaubah}rÖ(hB]hC]hA]h@]hD]uhGMhHhhI]r×hYX»The following variables are available after the requested object has been retrieved from the backend, before it is entered into the cache. In other words, they are available in vcl_fetch:rØ…rÙ}rÚ(h'jÕh(jÓubaubjø)rÛ}rÜ(h'Uh(j¼ h2h5h}rÝ(hB]hC]hA]h@]hD]uhGNhHhhI]rÞ(jþ)rß}rà(h'Xberesp.do_stream Deliver the object to the client directly without fetching the whole object into varnish. If this request is pass'ed it will not be stored in memory. As of Varnish Cache 3.0 the object will marked as busy as it is delivered so only client can access the object. h(jÛh2h5h}rá(hB]hC]hA]h@]hD]uhGM%hI]râ(j)rã}rä(h'Xberesp.do_streamråh(jßh2h5h}ræ(hB]hC]hA]h@]hD]uhGM%hI]rçhYXberesp.do_streamrè…ré}rê(h'jåh(jãubaubj)rë}rì(h'Uh>}rí(hB]hC]hA]h@]hD]uh(jßhI]rîh†)rï}rð(h'XDeliver 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. As of Varnish Cache 3.0 the object will marked as busy as it is delivered so only client can access the object.rñh(jëh2h5h}rò(hB]hC]hA]h@]hD]uhGM"hI]róhYXDeliver 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. As of Varnish Cache 3.0 the object will marked as busy as it is delivered so only client can access the object.rô…rõ}rö(h'jñh(jïubaubah}rù(hB]hC]hA]h@]hD]uhGM*hHhhI]rú(j)rû}rü(h'X beresp.do_esirýh(j÷h2h5h}rþ(hB]hC]hA]h@]hD]uhGM*hI]rÿhYX beresp.do_esir…r}r(h'jýh(jûubaubj)r}r(h'Uh>}r(hB]hC]hA]h@]hD]uh(j÷hI]rh†)r}r(h'X¥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.r h(jh2h5h}r (hB]hC]hA]h@]hD]uhGM(hI]r hYX¥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.r …r }r(h'j h(jubaubah}r(hB]hC]hA]h@]hD]uhGM-hHhhI]r(j)r}r(h'Xberesp.do_gziprh(jh2h5h}r(hB]hC]hA]h@]hD]uhGM-hI]rhYXberesp.do_gzipr…r}r(h'jh(jubaubj)r}r(h'Uh>}r(hB]hC]hA]h@]hD]uh(jhI]rh†)r}r (h'X>Boolean. Gzip the object before storing it. Defaults to false.r!h(jh2h5h}r"(hB]hC]hA]h@]hD]uhGM-hI]r#hYX>Boolean. Gzip the object before storing it. Defaults to false.r$…r%}r&(h'j!h(jubaubah}r)(hB]hC]hA]h@]hD]uhGM1hHhhI]r*(j)r+}r,(h'Xberesp.do_gunzipr-h(j'h2h5h}r.(hB]hC]hA]h@]hD]uhGM1hI]r/hYXberesp.do_gunzipr0…r1}r2(h'j-h(j+ubaubj)r3}r4(h'Uh>}r5(hB]hC]hA]h@]hD]uh(j'hI]r6h†)r7}r8(h'XMBoolean. Unzip the object before storing it in the cache. Defaults to false.r9h(j3h2h5h}r:(hB]hC]hA]h@]hD]uhGM0hI]r;hYXMBoolean. Unzip the object before storing it in the cache. Defaults to false.r<…r=}r>(h'j9h(j7ubaubah}rA(hB]hC]hA]h@]hD]uhGM4hHhhI]rB(j)rC}rD(h'Xberesp.http.headerrEh(j?h2h5h}rF(hB]hC]hA]h@]hD]uhGM4hI]rGhYXberesp.http.headerrH…rI}rJ(h'jEh(jCubaubj)rK}rL(h'Uh>}rM(hB]hC]hA]h@]hD]uh(j?hI]rNh†)rO}rP(h'XThe corresponding HTTP header.rQh(jKh2h5h}rR(hB]hC]hA]h@]hD]uhGM4hI]rShYXThe corresponding HTTP header.rT…rU}rV(h'jQh(jOubaubah}rY(hB]hC]hA]h@]hD]uhGM7hHhhI]rZ(j)r[}r\(h'X beresp.protor]h(jWh2h5h}r^(hB]hC]hA]h@]hD]uhGM7hI]r_hYX beresp.protor`…ra}rb(h'j]h(j[ubaubj)rc}rd(h'Uh>}re(hB]hC]hA]h@]hD]uh(jWhI]rfh†)rg}rh(h'X8The HTTP protocol version used the backend replied with.rih(jch2h5h}rj(hB]hC]hA]h@]hD]uhGM7hI]rkhYX8The HTTP protocol version used the backend replied with.rl…rm}rn(h'jih(jgubaubah}rq(hB]hC]hA]h@]hD]uhGM:hHhhI]rr(j)rs}rt(h'X beresp.statusruh(joh2h5h}rv(hB]hC]hA]h@]hD]uhGM:hI]rwhYX beresp.statusrx…ry}rz(h'juh(jsubaubj)r{}r|(h'Uh>}r}(hB]hC]hA]h@]hD]uh(johI]r~h†)r}r€(h'X,The HTTP status code returned by the server.rh(j{h2h5h}r‚(hB]hC]hA]h@]hD]uhGM:hI]rƒhYX,The HTTP status code returned by the server.r„…r…}r†(h'jh(jubaubah}r‰(hB]hC]hA]h@]hD]uhGM=hHhhI]rŠ(j)r‹}rŒ(h'Xberesp.responserh(j‡h2h5h}rŽ(hB]hC]hA]h@]hD]uhGM=hI]rhYXberesp.responser…r‘}r’(h'jh(j‹ubaubj)r“}r”(h'Uh>}r•(hB]hC]hA]h@]hD]uh(j‡hI]r–h†)r—}r˜(h'X/The HTTP status message returned by the server.r™h(j“h2h5h}rš(hB]hC]hA]h@]hD]uhGM=hI]r›hYX/The HTTP status message returned by the server.rœ…r}rž(h'j™h(j—ubaubah}r¡(hB]hC]hA]h@]hD]uhGM@hHhhI]r¢(j)r£}r¤(h'X beresp.ttlr¥h(jŸh2h5h}r¦(hB]hC]hA]h@]hD]uhGM@hI]r§hYX beresp.ttlr¨…r©}rª(h'j¥h(j£ubaubj)r«}r¬(h'Uh>}r­(hB]hC]hA]h@]hD]uh(jŸhI]r®h†)r¯}r°(h'XHThe object's remaining time to live, in seconds. beresp.ttl is writable.r±h(j«h2h5h}r²(hB]hC]hA]h@]hD]uhGM@hI]r³hYXHThe object's remaining time to live, in seconds. beresp.ttl is writable.r´…rµ}r¶(h'j±h(j¯ubaubah}r¹(hB]hC]hA]h@]hD]uhGMChHhhI]rº(j)r»}r¼(h'X beresp.gracer½h(j·h2h5h}r¾(hB]hC]hA]h@]hD]uhGMChI]r¿hYX beresp.gracerÀ…rÁ}rÂ(h'j½h(j»ubaubj)rÃ}rÄ(h'Uh>}rÅ(hB]hC]hA]h@]hD]uh(j·hI]rÆh†)rÇ}rÈ(h'X Set to a period to enable grace.rÉh(jÃh2h5h}rÊ(hB]hC]hA]h@]hD]uhGMChI]rËhYX Set to a period to enable grace.rÌ…rÍ}rÎ(h'jÉh(jÇubaubah}rÑ(hB]hC]hA]h@]hD]uhGMFhHhhI]rÒ(j)rÓ}rÔ(h'Xberesp.saintmoderÕh(jÏh2h5h}rÖ(hB]hC]hA]h@]hD]uhGMFhI]r×hYXberesp.saintmoderØ…rÙ}rÚ(h'jÕh(jÓubaubj)rÛ}rÜ(h'Uh>}rÝ(hB]hC]hA]h@]hD]uh(jÏhI]rÞh†)rß}rà(h'X%Set to a period to enable saint mode.ráh(jÛh2h5h}râ(hB]hC]hA]h@]hD]uhGMFhI]rãhYX%Set to a period to enable saint mode.rä…rå}ræ(h'jáh(jßubaubah}ré(hB]hC]hA]h@]hD]uhGMIhHhhI]rê(j)rë}rì(h'Xberesp.backend.nameríh(jçh2h5h}rî(hB]hC]hA]h@]hD]uhGMIhI]rïhYXberesp.backend.namerð…rñ}rò(h'jíh(jëubaubj)ró}rô(h'Uh>}rõ(hB]hC]hA]h@]hD]uh(jçhI]röh†)r÷}rø(h'X3Name of the backend this response was fetched from.rùh(jóh2h5h}rú(hB]hC]hA]h@]hD]uhGMIhI]rûhYX3Name of the backend this response was fetched from.rü…rý}rþ(h'jùh(j÷ubaubah}r(hB]hC]hA]h@]hD]uhGMLhHhhI]r(j)r}r(h'Xberesp.backend.iprh(jÿh2h5h}r(hB]hC]hA]h@]hD]uhGMLhI]rhYXberesp.backend.ipr…r }r (h'jh(jubaubj)r }r (h'Uh>}r (hB]hC]hA]h@]hD]uh(jÿhI]rh†)r}r(h'X1IP of the backend this response was fetched from.rh(j h2h5h}r(hB]hC]hA]h@]hD]uhGMLhI]rhYX1IP of the backend this response was fetched from.r…r}r(h'jh(jubaubah}r(hB]hC]hA]h@]hD]uhGMOhHhhI]r(j)r}r(h'Xberesp.backend.portrh(jh2h5h}r(hB]hC]hA]h@]hD]uhGMOhI]rhYXberesp.backend.portr …r!}r"(h'jh(jubaubj)r#}r$(h'Uh>}r%(hB]hC]hA]h@]hD]uh(jhI]r&h†)r'}r((h'X3Port of the backend this response was fetched from.r)h(j#h2h5h}r*(hB]hC]hA]h@]hD]uhGMOhI]r+hYX3Port of the backend this response was fetched from.r,…r-}r.(h'j)h(j'ubaubah}r1(hB]hC]hA]h@]hD]uhGMShHhhI]r2(j)r3}r4(h'Xberesp.storager5h(j/h2h5h}r6(hB]hC]hA]h@]hD]uhGMShI]r7hYXberesp.storager8…r9}r:(h'j5h(j3ubaubj)r;}r<(h'Uh>}r=(hB]hC]hA]h@]hD]uh(j/hI]r>h†)r?}r@(h'XISet to force Varnish to save this object to a particular storage backend.rAh(j;h2h5h}rB(hB]hC]hA]h@]hD]uhGMRhI]rChYXISet to force Varnish to save this object to a particular storage backend.rD…rE}rF(h'jAh(j?ubaubah}rJ(hB]hC]hA]h@]hD]uhGMUhHhhI]rKhYXÚAfter the object is entered into the cache, the following (mostly read-only) variables are available when the object has been located in cache, typically in vcl_hit, or when constructing a synthetic reply in vcl_error:rL…rM}rN(h'jIh(jGubaubjø)rO}rP(h'Uh(j¼ h2h5h}rQ(hB]hC]hA]h@]hD]uhGNhHhhI]rR(jþ)rS}rT(h'XHobj.proto The HTTP protocol version used when the object was retrieved. h(jOh2h5h}rU(hB]hC]hA]h@]hD]uhGM[hI]rV(j)rW}rX(h'X obj.protorYh(jSh2h5h}rZ(hB]hC]hA]h@]hD]uhGM[hI]r[hYX obj.protor\…r]}r^(h'jYh(jWubaubj)r_}r`(h'Uh>}ra(hB]hC]hA]h@]hD]uh(jShI]rbh†)rc}rd(h'X=The HTTP protocol version used when the object was retrieved.reh(j_h2h5h}rf(hB]hC]hA]h@]hD]uhGM[hI]rghYX=The HTTP protocol version used when the object was retrieved.rh…ri}rj(h'jeh(jcubaubah}rm(hB]hC]hA]h@]hD]uhGM^hHhhI]rn(j)ro}rp(h'X obj.statusrqh(jkh2h5h}rr(hB]hC]hA]h@]hD]uhGM^hI]rshYX obj.statusrt…ru}rv(h'jqh(joubaubj)rw}rx(h'Uh>}ry(hB]hC]hA]h@]hD]uh(jkhI]rzh†)r{}r|(h'X,The HTTP status code returned by the server.r}h(jwh2h5h}r~(hB]hC]hA]h@]hD]uhGM^hI]rhYX,The HTTP status code returned by the server.r€…r}r‚(h'j}h(j{ubaubah}r…(hB]hC]hA]h@]hD]uhGMahHhhI]r†(j)r‡}rˆ(h'X obj.responser‰h(jƒh2h5h}rŠ(hB]hC]hA]h@]hD]uhGMahI]r‹hYX obj.responserŒ…r}rŽ(h'j‰h(j‡ubaubj)r}r(h'Uh>}r‘(hB]hC]hA]h@]hD]uh(jƒhI]r’h†)r“}r”(h'X/The HTTP status message returned by the server.r•h(jh2h5h}r–(hB]hC]hA]h@]hD]uhGMahI]r—hYX/The HTTP status message returned by the server.r˜…r™}rš(h'j•h(j“ubaubah}r(hB]hC]hA]h@]hD]uhGMdhHhhI]rž(j)rŸ}r (h'Xobj.ttlr¡h(j›h2h5h}r¢(hB]hC]hA]h@]hD]uhGMdhI]r£hYXobj.ttlr¤…r¥}r¦(h'j¡h(jŸubaubj)r§}r¨(h'Uh>}r©(hB]hC]hA]h@]hD]uh(j›hI]rªh†)r«}r¬(h'XEThe object's remaining time to live, in seconds. obj.ttl is writable.r­h(j§h2h5h}r®(hB]hC]hA]h@]hD]uhGMdhI]r¯hYXEThe object's remaining time to live, in seconds. obj.ttl is writable.r°…r±}r²(h'j­h(j«ubaubah}rµ(hB]hC]hA]h@]hD]uhGMhhHhhI]r¶(j)r·}r¸(h'X obj.lastuser¹h(j³h2h5h}rº(hB]hC]hA]h@]hD]uhGMhhI]r»hYX obj.lastuser¼…r½}r¾(h'j¹h(j·ubaubj)r¿}rÀ(h'Uh>}rÁ(hB]hC]hA]h@]hD]uh(j³hI]rÂh†)rÃ}rÄ(h'X|The approximate time elapsed since the object was last requests, in seconds. This variable is also available in vcl_deliver.rÅh(j¿h2h5h}rÆ(hB]hC]hA]h@]hD]uhGMghI]rÇhYX|The approximate time elapsed since the object was last requests, in seconds. This variable is also available in vcl_deliver.rÈ…rÉ}rÊ(h'jÅh(jÃubaubah}rÍ(hB]hC]hA]h@]hD]uhGMmhHhhI]rÎ(j)rÏ}rÐ(h'Xobj.hitsrÑh(jËh2h5h}rÒ(hB]hC]hA]h@]hD]uhGMmhI]rÓhYXobj.hitsrÔ…rÕ}rÖ(h'jÑh(jÏubaubj)r×}rØ(h'Uh>}rÙ(hB]hC]hA]h@]hD]uh(jËhI]rÚh†)rÛ}rÜ(h'X“The approximate number of times the object has been delivered. A value of 0 indicates a cache miss. This variable is also available in vcl_deliver.rÝh(j×h2h5h}rÞ(hB]hC]hA]h@]hD]uhGMkhI]rßhYX“The approximate number of times the object has been delivered. A value of 0 indicates a cache miss. This variable is also available in vcl_deliver.rà…rá}râ(h'jÝh(jÛubaubah}rå(hB]hC]hA]h@]hD]uhGMphHhhI]ræ(j)rç}rè(h'X obj.graceréh(jãh2h5h}rê(hB]hC]hA]h@]hD]uhGMphI]rëhYX obj.gracerì…rí}rî(h'jéh(jçubaubj)rï}rð(h'Uh>}rñ(hB]hC]hA]h@]hD]uh(jãhI]ròh†)ró}rô(h'X<The object's grace period in seconds. obj.grace is writable.rõh(jïh2h5h}rö(hB]hC]hA]h@]hD]uhGMphI]r÷hYX<The object's grace period in seconds. obj.grace is writable.rø…rù}rú(h'jõh(jóubaubah}rý(hB]hC]hA]h@]hD]uhGMshHhhI]rþ(j)rÿ}r(h'Xobj.http.headerrh(jûh2h5h}r(hB]hC]hA]h@]hD]uhGMshI]rhYXobj.http.headerr…r}r(h'jh(jÿubaubj)r}r(h'Uh>}r (hB]hC]hA]h@]hD]uh(jûhI]r h†)r }r (h'XThe corresponding HTTP header.r h(jh2h5h}r(hB]hC]hA]h@]hD]uhGMshI]rhYXThe corresponding HTTP header.r…r}r(h'j h(j ubaubah}r(hB]hC]hA]h@]hD]uhGMuhHhhI]rhYXRThe following variables are available while determining the hash key of an object:r…r}r(h'jh(jubaubjø)r}r(h'Uh(j¼ h2h5h}r(hB]hC]hA]h@]hD]uhGNhHhhI]rjþ)r}r (h'Xvreq.hash The hash key used to refer to an object in the cache. Used when both reading from and writing to the cache. h(jh2h5h}r!(hB]hC]hA]h@]hD]uhGMzhI]r"(j)r#}r$(h'Xreq.hashr%h(jh2h5h}r&(hB]hC]hA]h@]hD]uhGMzhI]r'hYXreq.hashr(…r)}r*(h'j%h(j#ubaubj)r+}r,(h'Uh>}r-(hB]hC]hA]h@]hD]uh(jhI]r.h†)r/}r0(h'XlThe hash key used to refer to an object in the cache. Used when both reading from and writing to the cache.r1h(j+h2h5h}r2(hB]hC]hA]h@]hD]uhGMyhI]r3hYXlThe hash key used to refer to an object in the cache. Used when both reading from and writing to the cache.r4…r5}r6(h'j1h(j/ubaubah}r:(hB]hC]hA]h@]hD]uhGM|hHhhI]r;hYXOThe following variables are available while preparing a response to the client:r<…r=}r>(h'j9h(j7ubaubjø)r?}r@(h'Uh(j¼ h2h5h}rA(hB]hC]hA]h@]hD]uhGNhHhhI]rB(jþ)rC}rD(h'X>resp.proto The HTTP protocol version to use for the response. h(j?h2h5h}rE(hB]hC]hA]h@]hD]uhGMhI]rF(j)rG}rH(h'X resp.protorIh(jCh2h5h}rJ(hB]hC]hA]h@]hD]uhGMhI]rKhYX resp.protorL…rM}rN(h'jIh(jGubaubj)rO}rP(h'Uh>}rQ(hB]hC]hA]h@]hD]uh(jChI]rRh†)rS}rT(h'X2The HTTP protocol version to use for the response.rUh(jOh2h5h}rV(hB]hC]hA]h@]hD]uhGMhI]rWhYX2The HTTP protocol version to use for the response.rX…rY}rZ(h'jUh(jSubaubah}r](hB]hC]hA]h@]hD]uhGM‚hHhhI]r^(j)r_}r`(h'X resp.statusrah(j[h2h5h}rb(hB]hC]hA]h@]hD]uhGM‚hI]rchYX resp.statusrd…re}rf(h'jah(j_ubaubj)rg}rh(h'Uh>}ri(hB]hC]hA]h@]hD]uh(j[hI]rjh†)rk}rl(h'X+The HTTP status code that will be returned.rmh(jgh2h5h}rn(hB]hC]hA]h@]hD]uhGM‚hI]rohYX+The HTTP status code that will be returned.rp…rq}rr(h'jmh(jkubaubah}ru(hB]hC]hA]h@]hD]uhGM…hHhhI]rv(j)rw}rx(h'X resp.responseryh(jsh2h5h}rz(hB]hC]hA]h@]hD]uhGM…hI]r{hYX resp.responser|…r}}r~(h'jyh(jwubaubj)r}r€(h'Uh>}r(hB]hC]hA]h@]hD]uh(jshI]r‚h†)rƒ}r„(h'X.The HTTP status message that will be returned.r…h(jh2h5h}r†(hB]hC]hA]h@]hD]uhGM…hI]r‡hYX.The HTTP status message that will be returned.rˆ…r‰}rŠ(h'j…h(jƒubaubah}r(hB]hC]hA]h@]hD]uhGMˆhHhhI]rŽ(j)r}r(h'Xresp.http.headerr‘h(j‹h2h5h}r’(hB]hC]hA]h@]hD]uhGMˆhI]r“hYXresp.http.headerr”…r•}r–(h'j‘h(jubaubj)r—}r˜(h'Uh>}r™(hB]hC]hA]h@]hD]uh(j‹hI]ršh†)r›}rœ(h'XThe corresponding HTTP header.rh(j—h2h5h}rž(hB]hC]hA]h@]hD]uhGMˆhI]rŸhYXThe corresponding HTTP header.r …r¡}r¢(h'jh(j›ubaubah}r¥(hB]hC]hA]h@]hD]uhGMŠhHhhI]r¦hYX:Values may be assigned to variables using the set keyword:r§…r¨}r©(h'X:Values may be assigned to variables using the set keyword:h(j£ubaubjS)rª}r«(h'X’sub vcl_recv { # Normalize the Host: header if (req.http.host ~ "(?i)^(www.)?example.com$") { set req.http.host = "www.example.com"; } }h(j¼ h2h5h}r¬(jXjYh@]hA]hB]hC]hD]uhGMhHhhI]r­hYX’sub vcl_recv { # Normalize the Host: header if (req.http.host ~ "(?i)^(www.)?example.com$") { set req.http.host = "www.example.com"; } }r®…r¯}r°(h'Uh(jªubaubh†)r±}r²(h'XAHTTP headers can be removed entirely using the remove keyword: ::h(j¼ h2h5h}r³(hB]hC]hA]h@]hD]uhGM”hHhhI]r´hYX>HTTP headers can be removed entirely using the remove keyword:rµ…r¶}r·(h'X>HTTP headers can be removed entirely using the remove keyword:h(j±ubaubjS)r¸}r¹(h'XJsub vcl_fetch { # Don't cache cookies remove beresp.http.Set-Cookie; }h(j¼ h2h5h}rº(jXjYh@]hA]hB]hC]hD]uhGM—hHhhI]r»hYXJsub vcl_fetch { # Don't cache cookies remove beresp.http.Set-Cookie; }r¼…r½}r¾(h'Uh(j¸ubaubeubeubh))r¿}rÀ(h'Uh(h,h2h5h}rÁ(hB]hC]hA]h@]rÂUgrace-and-saint-moderÃahD]rÄhauhGMhHhhI]rÅ(hR)rÆ}rÇ(h'XGrace and saint moderÈh(j¿h2h5h}rÉ(hB]hC]hA]h@]hD]uhGMhHhhI]rÊhYXGrace and saint moderË…rÌ}rÍ(h'jÈh(jÆubaubh†)rÎ}rÏ(h'XIf the backend takes a long time to generate an object there is a risk of a thread pile up. In order to prevent this you can enable *grace*. This allows varnish to serve an expired version of the object while a fresh object is being generated by the backend.h(j¿h2h5h}rÐ(hB]hC]hA]h@]hD]uhGMŸhHhhI]rÑ(hYX…If the backend takes a long time to generate an object there is a risk of a thread pile up. In order to prevent this you can enable rÒ…rÓ}rÔ(h'X…If the backend takes a long time to generate an object there is a risk of a thread pile up. In order to prevent this you can enable h(jÎubj\)rÕ}rÖ(h'X*grace*h>}r×(hB]hC]hA]h@]hD]uh(jÎhI]rØhYXgracerÙ…rÚ}rÛ(h'Uh(jÕubah}rá(hB]hC]hA]h@]hD]uhGM¤hHhhI]râhYX¥The following vcl code will make Varnish serve expired objects. All object will be kept up to two minutes past their expiration time or a fresh object is generated.rã…rä}rå(h'X¥The following vcl code will make Varnish serve expired objects. All object will be kept up to two minutes past their expiration time or a fresh object is generated.h(jßubaubjS)ræ}rç(h'XQsub vcl_recv { set req.grace = 2m; } sub vcl_fetch { set beresp.grace = 2m; }h(j¿h2h5h}rè(jXjYh@]hA]hB]hC]hD]uhGM©hHhhI]réhYXQsub vcl_recv { set req.grace = 2m; } sub vcl_fetch { set beresp.grace = 2m; }rê…rë}rì(h'Uh(jæubaubh†)rí}rî(h'XˆSaint mode is similar to grace mode and relies on the same infrastructure but functions differently. You can add VCL code to vcl_fetch to see whether or not you *like* the response coming from the backend. If you find that the response is not appropriate you can set beresp.saintmode to a time limit and call *restart*. Varnish will then retry other backends to try to fetch the object again.h(j¿h2h5h}rï(hB]hC]hA]h@]hD]uhGM°hHhhI]rð(hYX¡Saint mode is similar to grace mode and relies on the same infrastructure but functions differently. You can add VCL code to vcl_fetch to see whether or not you rñ…rò}ró(h'X¡Saint mode is similar to grace mode and relies on the same infrastructure but functions differently. You can add VCL code to vcl_fetch to see whether or not you h(jíubj\)rô}rõ(h'X*like*h>}rö(hB]hC]hA]h@]hD]uh(jíhI]r÷hYXlikerø…rù}rú(h'Uh(jôubah}r(hB]hC]hA]h@]hD]uh(jíhI]rhYXrestartr…r}r(h'Uh(jþubah}r (hB]hC]hA]h@]hD]uhGM·hHhhI]r (hYX,If there are no more backends or if you hit r …r }r(h'X,If there are no more backends or if you hit h(jubj\)r}r(h'X*max_restarts*h>}r(hB]hC]hA]h@]hD]uh(jhI]rhYX max_restartsr…r}r(h'Uh(jubah}r(hB]hC]hA]h@]rUbackend-declarationsrahD]rhauhGKahHhhI]r(hR)r}r(h'XBackend declarationsr h(h*h2h5h}r!(hB]hC]hA]h@]hD]uhGKahHhhI]r"hYXBackend declarationsr#…r$}r%(h'j h(jubaubh†)r&}r'(h'XHA backend declaration creates and initializes a named backend object: ::h(h*h2h5h}r((hB]hC]hA]h@]hD]uhGKchHhhI]r)hYXEA backend declaration creates and initializes a named backend object:r*…r+}r,(h'XEA backend declaration creates and initializes a named backend object:h(j&ubaubjS)r-}r.(h'X>backend www { .host = "www.example.com"; .port = "http"; }h(h*h2h5h}r/(jXjYh@]hA]hB]hC]hD]uhGKfhHhhI]r0hYX>backend www { .host = "www.example.com"; .port = "http"; }r1…r2}r3(h'Uh(j-ubaubh†)r4}r5(h'XLThe backend object can later be used to select a backend at request time: ::h(h*h2h5h}r6(hB]hC]hA]h@]hD]uhGKkhHhhI]r7hYXIThe backend object can later be used to select a backend at request time:r8…r9}r:(h'XIThe backend object can later be used to select a backend at request time:h(j4ubaubjS)r;}r<(h'XLif (req.http.host ~ "(?i)^(www.)?example.com$") { set req.backend = www; }h(h*h2h5h}r=(jXjYh@]hA]hB]hC]hD]uhGKnhHhhI]r>hYXLif (req.http.host ~ "(?i)^(www.)?example.com$") { set req.backend = www; }r?…r@}rA(h'Uh(j;ubaubh†)rB}rC(h'X€To avoid overloading backend servers, .max_connections can be set to limit the maximum number of concurrent backend connections.rDh(h*h2h5h}rE(hB]hC]hA]h@]hD]uhGKrhHhhI]rFhYX€To avoid overloading backend servers, .max_connections can be set to limit the maximum number of concurrent backend connections.rG…rH}rI(h'jDh(jBubaubh†)rJ}rK(h'X4The timeout parameters can be overridden in the backend declaration. The timeout parameters are .connect_timeout for the time to wait for a backend connection, .first_byte_timeout for the time to wait for the first byte from the backend and .between_bytes_timeout for time to wait between each received byte.rLh(h*h2h5h}rM(hB]hC]hA]h@]hD]uhGKuhHhhI]rNhYX4The timeout parameters can be overridden in the backend declaration. The timeout parameters are .connect_timeout for the time to wait for a backend connection, .first_byte_timeout for the time to wait for the first byte from the backend and .between_bytes_timeout for time to wait between each received byte.rO…rP}rQ(h'jLh(jJubaubh†)rR}rS(h'X1These can be set in the declaration like this: ::h(h*h2h5h}rT(hB]hC]hA]h@]hD]uhGK{hHhhI]rUhYX.These can be set in the declaration like this:rV…rW}rX(h'X.These can be set in the declaration like this:h(jRubaubjS)rY}rZ(h'X’backend www { .host = "www.example.com"; .port = "http"; .connect_timeout = 1s; .first_byte_timeout = 5s; .between_bytes_timeout = 2s; }h(h*h2h5h}r[(jXjYh@]hA]hB]hC]hD]uhGK~hHhhI]r\hYX’backend www { .host = "www.example.com"; .port = "http"; .connect_timeout = 1s; .first_byte_timeout = 5s; .between_bytes_timeout = 2s; }r]…r^}r_(h'Uh(jYubaubh†)r`}ra(h'X$To mark a backend as unhealthy after number of items have been added to its saintmode list ``.saintmode_threshold`` can be set to the maximum list size. Setting a value of 0 disables saint mode checking entirely for that backend. The value in the backend declaration overrides the parameter.h(h*h2h5h}rb(hB]hC]hA]h@]hD]uhGK†hHhhI]rc(hYX[To mark a backend as unhealthy after number of items have been added to its saintmode list rd…re}rf(h'X[To mark a backend as unhealthy after number of items have been added to its saintmode list h(j`ubjÑ)rg}rh(h'X``.saintmode_threshold``h>}ri(hB]hC]hA]h@]hD]uh(j`hI]rjhYX.saintmode_thresholdrk…rl}rm(h'Uh(jgubah}rr(hB]UlevelKh@]hA]Usourceh5hC]hD]UlineKdUtypeUINFOrsuhGKdhHhhI]rth†)ru}rv(h'Uh>}rw(hB]hC]hA]h@]hD]uh(h%hI]rxhYXfPossible title underline, too short for the title. Treating it as ordinary text because it's so short.ry…rz}r{(h'Uh(juubah}r~(hB]UlevelKh@]hA]Usourceh5hC]hD]UlineKlUtypejsuhGKlhHhhI]rh†)r€}r(h'Uh>}r‚(hB]hC]hA]h@]hD]uh(j|hI]rƒhYXfPossible title underline, too short for the title. Treating it as ordinary text because it's so short.r„…r…}r†(h'Uh(j€ubah}r‰(hB]UlevelKh@]hA]Usourceh5hC]hD]UlineK|UtypejsuhGK|hHhhI]rŠh†)r‹}rŒ(h'Uh>}r(hB]hC]hA]h@]hD]uh(j‡hI]rŽhYXfPossible title underline, too short for the title. Treating it as ordinary text because it's so short.r…r}r‘(h'Uh(j‹ubah}r”(hB]UlevelKh@]hA]Usourceh5hC]hD]UlineK˜UtypejsuhGK˜hHhhI]r•h†)r–}r—(h'Uh>}r˜(hB]hC]hA]h@]hD]uh(j’hI]r™hYXfPossible title underline, too short for the title. Treating it as ordinary text because it's so short.rš…r›}rœ(h'Uh(j–ubah}rŸ(hB]UlevelKh@]hA]Usourceh5hC]hD]UlineMUtypejsuhGMhHhhI]r h†)r¡}r¢(h'Uh>}r£(hB]hC]hA]h@]hD]uh(jhI]r¤hYXfPossible title underline, too short for the title. Treating it as ordinary text because it's so short.r¥…r¦}r§(h'Uh(j¡ubah}rª(hB]UlevelKh@]hA]Usourceh5hC]hD]UlineMQUtypejsuhGMQhHhhI]r«h†)r¬}r­(h'Uh>}r®(hB]hC]hA]h@]hD]uh(j¨hI]r¯hYXfPossible title underline, too short for the title. Treating it as ordinary text because it's so short.r°…r±}r²(h'Uh(j¬ubah}rµ(hB]UlevelKh@]hA]Usourceh5hC]hD]UlineMgUtypejsuhGMghHhhI]r¶h†)r·}r¸(h'Uh>}r¹(hB]hC]hA]h@]hD]uh(j³hI]rºhYXfPossible title underline, too short for the title. Treating it as ordinary text because it's so short.r»…r¼}r½(h'Uh(j·ubah}rÀ(hB]UlevelKh@]hA]Usourceh5hC]hD]UlineM…UtypejsuhGM…hHhhI]rÁh†)rÂ}rÃ(h'Uh>}rÄ(hB]hC]hA]h@]hD]uh(j¾hI]rÅhYXfPossible title underline, too short for the title. Treating it as ordinary text because it's so short.rÆ…rÇ}rÈ(h'Uh(jÂubah}rË(hB]UlevelKh@]hA]Usourceh5hC]hD]UlineM¹UtypejsuhGM¹hHhhI]rÌh†)rÍ}rÎ(h'Uh>}rÏ(hB]hC]hA]h@]hD]uh(jÉhI]rÐhYXfPossible title underline, too short for the title. Treating it as ordinary text because it's so short.rÑ…rÒ}rÓ(h'Uh(jÍubah}rÖ(hB]UlevelKh@]hA]Usourceh5hC]hD]UlineMUtypejsuhGMhHhhI]r×h†)rØ}rÙ(h'Uh>}rÚ(hB]hC]hA]h@]hD]uh(jÔhI]rÛhYXfPossible title underline, too short for the title. Treating it as ordinary text because it's so short.rÜ…rÝ}rÞ(h'Uh(jØubah}rá(hB]UlevelKh@]hA]Usourceh5hC]hD]UlineM‹UtypejsuhGM‹hHhhI]râh†)rã}rä(h'Uh>}rå(hB]hC]hA]h@]hD]uh(jßhI]ræhYXfPossible title underline, too short for the title. Treating it as ordinary text because it's so short.rç…rè}ré(h'Uh(jãubah}rì(hB]UlevelKh@]hA]Usourceh5hC]hD]UlineM•UtypejsuhGM•hHhhI]ríh†)rî}rï(h'Uh>}rð(hB]hC]hA]h@]hD]uh(jêhI]rñhYXfPossible title underline, too short for the title. Treating it as ordinary text because it's so short.rò…ró}rô(h'Uh(jîubah}r (hB]UlevelKh@]hA]Usourceh5hC]hD]UlineKUtypejsuhI]rh†)r}r(h'Uh>}r(hB]hC]hA]h@]hD]uh(j hI]rhYX3Hyperlink target "reference-vcl" is not referenced.r…r}r(h'Uh(jubahKUconfigr?NUstrict_visitorr@NUcloak_email_addressesrAˆUtrim_footnote_reference_spacerB‰UenvrCNUdump_pseudo_xmlrDNUexpose_internalsrENUsectsubtitle_xformrF‰U source_linkrGNUrfc_referencesrHNUoutput_encodingrIUutf-8rJU source_urlrKNUinput_encodingrLU utf-8-sigrMU_disable_configrNNU id_prefixrOUU tab_widthrPKUerror_encodingrQUUTF-8rRU_sourcerSU1/home/tfheen/varnish/doc/sphinx/reference/vcl.rstrTUgettext_compactrUˆU generatorrVNUdump_internalsrWNU smart_quotesrX‰U pep_base_urlrYUhttp://www.python.org/dev/peps/rZUsyntax_highlightr[Ulongr\Uinput_encoding_error_handlerr]j7Uauto_id_prefixr^Uidr_Udoctitle_xformr`‰Ustrip_elements_with_classesraNU _config_filesrb]Ufile_insertion_enabledrcKU raw_enabledrdKU dump_settingsreNubUsymbol_footnote_startrfKUidsrg}rh(j°j¬jójïj› j— j¤j jh,jAj=jÜjØj,j(j[jWjDj@hMh0jh*jkjgjõjñjùjõjÀ j¼ j"jjÝjÙjµj±jÃj¿hFh0jëjçh_h.jjjˆj„jÔjÐuUsubstitution_namesri}rjh}rk(hB]h@]hA]Usourceh5hC]hD]uU footnotesrl]rmUrefidsrn}rohF]rph:asub.varnish-3.0.5/doc/sphinx/=build/doctrees/reference/varnishreplay.doctree0000644000175000017500000002750212247037213023377 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(X varnishreplayqNX copyrightqNX descriptionqNXsynopsisq NXhttp traffic replay toolq NXsee alsoq NXhistoryq NuUsubstitution_defsq }qUparse_messagesq]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hU varnishreplayqhU copyrightqhU descriptionqh Usynopsisqh Uhttp-traffic-replay-toolqh Usee-alsoqh UhistoryquUchildrenq]qcdocutils.nodes section q)q }q!(U rawsourceq"UUparentq#hUsourceq$cdocutils.nodes reprunicode q%X;/home/tfheen/varnish/doc/sphinx/reference/varnishreplay.rstq&…q'}q(bUtagnameq)Usectionq*U attributesq+}q,(Udupnamesq-]Uclassesq.]Ubackrefsq/]Uidsq0]q1haUnamesq2]q3hauUlineq4KUdocumentq5hh]q6(cdocutils.nodes title q7)q8}q9(h"X varnishreplayq:h#h h$h'h)Utitleq;h+}q<(h-]h.]h/]h0]h2]uh4Kh5hh]q=cdocutils.nodes Text q>X varnishreplayq?…q@}qA(h"h:h#h8ubaubh)qB}qC(h"Uh#h h$h'h)h*h+}qD(h-]h.]h/]h0]qEhah2]qFh auh4Kh5hh]qG(h7)qH}qI(h"XHTTP traffic replay toolqJh#hBh$h'h)h;h+}qK(h-]h.]h/]h0]h2]uh4Kh5hh]qLh>XHTTP traffic replay toolqM…qN}qO(h"hJh#hHubaubcdocutils.nodes field_list qP)qQ}qR(h"Uh#hBh$h'h)U field_listqSh+}qT(h-]h.]h/]h0]h2]uh4K h5hh]qU(cdocutils.nodes field qV)qW}qX(h"Uh#hQh$h'h)UfieldqYh+}qZ(h-]h.]h/]h0]h2]uh4K h5hh]q[(cdocutils.nodes field_name q\)q]}q^(h"XAuthorq_h+}q`(h-]h.]h/]h0]h2]uh#hWh]qah>XAuthorqb…qc}qd(h"h_h#h]ubah)U field_nameqeubcdocutils.nodes field_body qf)qg}qh(h"XCecilie Fritzvoldqih+}qj(h-]h.]h/]h0]h2]uh#hWh]qkcdocutils.nodes paragraph ql)qm}qn(h"hih#hgh$h'h)U paragraphqoh+}qp(h-]h.]h/]h0]h2]uh4K h]qqh>XCecilie Fritzvoldqr…qs}qt(h"hih#hmubaubah)U field_bodyquubeubhV)qv}qw(h"Uh#hQh$h'h)hYh+}qx(h-]h.]h/]h0]h2]uh4K h5hh]qy(h\)qz}q{(h"XAuthorq|h+}q}(h-]h.]h/]h0]h2]uh#hvh]q~h>XAuthorq…q€}q(h"h|h#hzubah)heubhf)q‚}qƒ(h"XPer Buerq„h+}q…(h-]h.]h/]h0]h2]uh#hvh]q†hl)q‡}qˆ(h"h„h#h‚h$h'h)hoh+}q‰(h-]h.]h/]h0]h2]uh4K h]qŠh>XPer Buerq‹…qŒ}q(h"h„h#h‡ubaubah)huubeubhV)qŽ}q(h"Uh#hQh$h'h)hYh+}q(h-]h.]h/]h0]h2]uh4K h5hh]q‘(h\)q’}q“(h"XDateq”h+}q•(h-]h.]h/]h0]h2]uh#hŽh]q–h>XDateq—…q˜}q™(h"h”h#h’ubah)heubhf)qš}q›(h"X 2010-05-31qœh+}q(h-]h.]h/]h0]h2]uh#hŽh]qžhl)qŸ}q (h"hœh#hšh$h'h)hoh+}q¡(h-]h.]h/]h0]h2]uh4K h]q¢h>X 2010-05-31q£…q¤}q¥(h"hœh#hŸubaubah)huubeubhV)q¦}q§(h"Uh#hQh$h'h)hYh+}q¨(h-]h.]h/]h0]h2]uh4K h5hh]q©(h\)qª}q«(h"XVersionq¬h+}q­(h-]h.]h/]h0]h2]uh#h¦h]q®h>XVersionq¯…q°}q±(h"h¬h#hªubah)heubhf)q²}q³(h"X1.0q´h+}qµ(h-]h.]h/]h0]h2]uh#h¦h]q¶hl)q·}q¸(h"h´h#h²h$h'h)hoh+}q¹(h-]h.]h/]h0]h2]uh4K h]qºh>X1.0q»…q¼}q½(h"h´h#h·ubaubah)huubeubhV)q¾}q¿(h"Uh#hQh$h'h)hYh+}qÀ(h-]h.]h/]h0]h2]uh4K h5hh]qÁ(h\)qÂ}qÃ(h"XManual sectionqÄh+}qÅ(h-]h.]h/]h0]h2]uh#h¾h]qÆh>XManual sectionqÇ…qÈ}qÉ(h"hÄh#hÂubah)heubhf)qÊ}qË(h"X1 h+}qÌ(h-]h.]h/]h0]h2]uh#h¾h]qÍhl)qÎ}qÏ(h"X1h#hÊh$h'h)hoh+}qÐ(h-]h.]h/]h0]h2]uh4K h]qÑh>X1…qÒ}qÓ(h"X1h#hÎubaubah)huubeubeubh)qÔ}qÕ(h"Uh#hBh$h'h)h*h+}qÖ(h-]h.]h/]h0]q×hah2]qØh auh4Kh5hh]qÙ(h7)qÚ}qÛ(h"XSYNOPSISqÜh#hÔh$h'h)h;h+}qÝ(h-]h.]h/]h0]h2]uh4Kh5hh]qÞh>XSYNOPSISqß…qà}qá(h"hÜh#hÚubaubhl)qâ}qã(h"X*varnishreplay [-D] -a address:port -r fileqäh#hÔh$h'h)hoh+}qå(h-]h.]h/]h0]h2]uh4Kh5hh]qæh>X*varnishreplay [-D] -a address:port -r fileqç…qè}qé(h"häh#hâubaubeubh)qê}që(h"Uh#hBh$h'h)h*h+}qì(h-]h.]h/]h0]qíhah2]qîhauh4Kh5hh]qï(h7)qð}qñ(h"X DESCRIPTIONqòh#hêh$h'h)h;h+}qó(h-]h.]h/]h0]h2]uh4Kh5hh]qôh>X DESCRIPTIONqõ…qö}q÷(h"hòh#hðubaubhl)qø}qù(h"X™The varnishreplay utility parses varnish logs and attempts to reproduce the traffic. It is typcally used to *warm* up caches or various forms of testing.h#hêh$h'h)hoh+}qú(h-]h.]h/]h0]h2]uh4Kh5hh]qû(h>XlThe varnishreplay utility parses varnish logs and attempts to reproduce the traffic. It is typcally used to qü…qý}qþ(h"XlThe varnishreplay utility parses varnish logs and attempts to reproduce the traffic. It is typcally used to h#høubcdocutils.nodes emphasis qÿ)r}r(h"X*warm*h+}r(h-]h.]h/]h0]h2]uh#høh]rh>Xwarmr…r}r(h"Uh#jubah)Uemphasisrubh>X' up caches or various forms of testing.r…r }r (h"X' up caches or various forms of testing.h#høubeubhl)r }r (h"X$The following options are available:r h#hêh$h'h)hoh+}r(h-]h.]h/]h0]h2]uh4Kh5hh]rh>X$The following options are available:r…r}r(h"j h#j ubaubcdocutils.nodes option_list r)r}r(h"Uh#hêh$h'h)U option_listrh+}r(h-]h.]h/]h0]h2]uh4Nh5hh]r(cdocutils.nodes option_list_item r)r}r(h"Uh#jh$h'h)Uoption_list_itemrh+}r(h-]h.]h/]h0]h2]uh4Nh5hh]r(cdocutils.nodes option_group r)r }r!(h"Uh+}r"(h-]h.]h/]h0]h2]uh#jh]r#cdocutils.nodes option r$)r%}r&(h"X -a backendh+}r'(h-]h.]h/]h0]h2]uh#j h]r((cdocutils.nodes option_string r))r*}r+(h"X-ah+}r,(h-]h.]h/]h0]h2]uh#j%h]r-h>X-ar.…r/}r0(h"Uh#j*ubah)U option_stringr1ubcdocutils.nodes option_argument r2)r3}r4(h"Xbackendh+}r5(h0]h/]h-]U delimiterU h.]h2]uh#j%h]r6h>Xbackendr7…r8}r9(h"Uh#j3ubah)Uoption_argumentr:ubeh)Uoptionr;ubah)U option_groupr<ubcdocutils.nodes description r=)r>}r?(h"XŽSend the traffic over tcp to this server, specified by an address and a port. This option is mandatory. Only IPV4 is supported at this time. h+}r@(h-]h.]h/]h0]h2]uh#jh]rAhl)rB}rC(h"XSend the traffic over tcp to this server, specified by an address and a port. This option is mandatory. Only IPV4 is supported at this time.rDh#j>h$h'h)hoh+}rE(h-]h.]h/]h0]h2]uh4Kh]rFh>XSend the traffic over tcp to this server, specified by an address and a port. This option is mandatory. Only IPV4 is supported at this time.rG…rH}rI(h"jDh#jBubaubah)U descriptionrJubeubj)rK}rL(h"Uh#jh$h'h)jh+}rM(h-]h.]h/]h0]h2]uh4Nh5hh]rN(j)rO}rP(h"Uh+}rQ(h-]h.]h/]h0]h2]uh#jKh]rRj$)rS}rT(h"X-DrUh+}rV(h-]h.]h/]h0]h2]uh#jOh]rWj))rX}rY(h"jUh+}rZ(h-]h.]h/]h0]h2]uh#jSh]r[h>X-Dr\…r]}r^(h"Uh#jXubah)j1ubah)j;ubah)j<ubj=)r_}r`(h"XTurn on debugging mode. h+}ra(h-]h.]h/]h0]h2]uh#jKh]rbhl)rc}rd(h"XTurn on debugging mode.reh#j_h$h'h)hoh+}rf(h-]h.]h/]h0]h2]uh4K!h]rgh>XTurn on debugging mode.rh…ri}rj(h"jeh#jcubaubah)jJubeubj)rk}rl(h"Uh#jh$h'h)jh+}rm(h-]h.]h/]h0]h2]uh4Nh5hh]rn(j)ro}rp(h"Uh+}rq(h-]h.]h/]h0]h2]uh#jkh]rrj$)rs}rt(h"X-r fileh+}ru(h-]h.]h/]h0]h2]uh#joh]rv(j))rw}rx(h"X-rh+}ry(h-]h.]h/]h0]h2]uh#jsh]rzh>X-rr{…r|}r}(h"Uh#jwubah)j1ubj2)r~}r(h"Xfileh+}r€(h0]h/]h-]U delimiterU h.]h2]uh#jsh]rh>Xfiler‚…rƒ}r„(h"Uh#j~ubah)j:ubeh)j;ubah)j<ubj=)r…}r†(h"X7Parse logs from this file. This option is mandatory. h+}r‡(h-]h.]h/]h0]h2]uh#jkh]rˆhl)r‰}rŠ(h"X5Parse logs from this file. This option is mandatory.r‹h#j…h$h'h)hoh+}rŒ(h-]h.]h/]h0]h2]uh4K#h]rh>X5Parse logs from this file. This option is mandatory.rŽ…r}r(h"j‹h#j‰ubaubah)jJubeubeubeubh)r‘}r’(h"Uh#hBh$h'h)h*h+}r“(h-]h.]h/]h0]r”hah2]r•h auh4K'h5hh]r–(h7)r—}r˜(h"XSEE ALSOr™h#j‘h$h'h)h;h+}rš(h-]h.]h/]h0]h2]uh4K'h5hh]r›h>XSEE ALSOrœ…r}rž(h"j™h#j—ubaubcdocutils.nodes bullet_list rŸ)r }r¡(h"Uh#j‘h$h'h)U bullet_listr¢h+}r£(Ubulletr¤X*h0]h/]h-]h.]h2]uh4K)h5hh]r¥(cdocutils.nodes list_item r¦)r§}r¨(h"X varnishd(1)r©h#j h$h'h)U list_itemrªh+}r«(h-]h.]h/]h0]h2]uh4Nh5hh]r¬hl)r­}r®(h"j©h#j§h$h'h)hoh+}r¯(h-]h.]h/]h0]h2]uh4K)h]r°h>X varnishd(1)r±…r²}r³(h"j©h#j­ubaubaubj¦)r´}rµ(h"Xvarnishlog(1) h#j h$h'h)jªh+}r¶(h-]h.]h/]h0]h2]uh4Nh5hh]r·hl)r¸}r¹(h"X varnishlog(1)rºh#j´h$h'h)hoh+}r»(h-]h.]h/]h0]h2]uh4K*h]r¼h>X varnishlog(1)r½…r¾}r¿(h"jºh#j¸ubaubaubeubeubh)rÀ}rÁ(h"Uh#hBh$h'h)h*h+}rÂ(h-]h.]h/]h0]rÃhah2]rÄh auh4K-h5hh]rÅ(h7)rÆ}rÇ(h"XHISTORYrÈh#jÀh$h'h)h;h+}rÉ(h-]h.]h/]h0]h2]uh4K-h5hh]rÊh>XHISTORYrË…rÌ}rÍ(h"jÈh#jÆubaubhl)rÎ}rÏ(h"XoThe varnishreplay utility and this manual page were written by Cecilie Fritzvold and later updated by Per Buer.rÐh#jÀh$h'h)hoh+}rÑ(h-]h.]h/]h0]h2]uh4K/h5hh]rÒh>XoThe varnishreplay utility and this manual page were written by Cecilie Fritzvold and later updated by Per Buer.rÓ…rÔ}rÕ(h"jÐh#jÎubaubeubh)rÖ}r×(h"Uh#hBh$h'h)h*h+}rØ(h-]h.]h/]h0]rÙhah2]rÚhauh4K3h5hh]rÛ(h7)rÜ}rÝ(h"X COPYRIGHTrÞh#jÖh$h'h)h;h+}rß(h-]h.]h/]h0]h2]uh4K3h5hh]ràh>X COPYRIGHTrá…râ}rã(h"jÞh#jÜubaubhl)rä}rå(h"X\This document is licensed under the same licence as Varnish itself. See LICENCE for details.ræh#jÖh$h'h)hoh+}rç(h-]h.]h/]h0]h2]uh4K5h5hh]rèh>X\This document is licensed under the same licence as Varnish itself. See LICENCE for details.ré…rê}rë(h"jæh#jäubaubjŸ)rì}rí(h"Uh#jÖh$h'h)j¢h+}rî(j¤X*h0]h/]h-]h.]h2]uh4K8h5hh]rïj¦)rð}rñ(h"X+Copyright (c) 2007-2010 Varnish Software ASròh#jìh$h'h)jªh+}ró(h-]h.]h/]h0]h2]uh4Nh5hh]rôhl)rõ}rö(h"jòh#jðh$h'h)hoh+}r÷(h-]h.]h/]h0]h2]uh4K8h]røh>X+Copyright (c) 2007-2010 Varnish Software ASrù…rú}rû(h"jòh#jõubaubaubaubeubeubeubah"UU transformerrüNU footnote_refsrý}rþUrefnamesrÿ}rUsymbol_footnotesr]rUautofootnote_refsr]rUsymbol_footnote_refsr]rU citationsr]rh5hU current_liner NUtransform_messagesr ]r Ureporterr NUid_startr KU autofootnotesr]rU citation_refsr}rUindirect_targetsr]rUsettingsr(cdocutils.frontend Values ror}r(Ufootnote_backlinksrKUrecord_dependenciesrNU rfc_base_urlrUhttp://tools.ietf.org/html/rU tracebackrˆUpep_referencesrNUstrip_commentsrNU toc_backlinksrUentryr U language_coder!Uenr"U datestampr#NU report_levelr$KU _destinationr%NU halt_levelr&KU strip_classesr'Nh;NUerror_encoding_error_handlerr(Ubackslashreplacer)Udebugr*NUembed_stylesheetr+‰Uoutput_encoding_error_handlerr,Ustrictr-U sectnum_xformr.KUdump_transformsr/NU docinfo_xformr0KUwarning_streamr1NUpep_file_url_templater2Upep-%04dr3Uexit_status_levelr4KUconfigr5NUstrict_visitorr6NUcloak_email_addressesr7ˆUtrim_footnote_reference_spacer8‰Uenvr9NUdump_pseudo_xmlr:NUexpose_internalsr;NUsectsubtitle_xformr<‰U source_linkr=NUrfc_referencesr>NUoutput_encodingr?Uutf-8r@U source_urlrANUinput_encodingrBU utf-8-sigrCU_disable_configrDNU id_prefixrEUU tab_widthrFKUerror_encodingrGUUTF-8rHU_sourcerIU;/home/tfheen/varnish/doc/sphinx/reference/varnishreplay.rstrJUgettext_compactrKˆU generatorrLNUdump_internalsrMNU smart_quotesrN‰U pep_base_urlrOUhttp://www.python.org/dev/peps/rPUsyntax_highlightrQUlongrRUinput_encoding_error_handlerrSj-Uauto_id_prefixrTUidrUUdoctitle_xformrV‰Ustrip_elements_with_classesrWNU _config_filesrX]rYUfile_insertion_enabledrZKU raw_enabledr[KU dump_settingsr\NubUsymbol_footnote_startr]KUidsr^}r_(hhêhjÖhh hj‘hhBhhÔhjÀuUsubstitution_namesr`}rah)h5h+}rb(h-]h0]h/]Usourceh'h.]h2]uU footnotesrc]rdUrefidsre}rfub.varnish-3.0.5/doc/sphinx/=build/doctrees/reference/index.doctree0000644000175000017500000001415512247037213021617 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(Xreference-indexqˆXthe varnish reference manualqNuUsubstitution_defsq}q Uparse_messagesq ]q Ucurrent_sourceq NU decorationq NUautofootnote_startqKUnameidsq}q(hUreference-indexqhUthe-varnish-reference-manualquUchildrenq]q(cdocutils.nodes target q)q}q(U rawsourceqX.. _reference-index:UparentqhUsourceqcdocutils.nodes reprunicode qX3/home/tfheen/varnish/doc/sphinx/reference/index.rstq…q}qbUtagnameqUtargetq U attributesq!}q"(Uidsq#]Ubackrefsq$]Udupnamesq%]Uclassesq&]Unamesq']Urefidq(huUlineq)KUdocumentq*hh]ubcdocutils.nodes section q+)q,}q-(hUhhhhUexpect_referenced_by_nameq.}q/hhshUsectionq0h!}q1(h%]h&]h$]h#]q2(hheh']q3(hheuh)Kh*hUexpect_referenced_by_idq4}q5hhsh]q6(cdocutils.nodes title q7)q8}q9(hXThe Varnish Reference Manualq:hh,hhhUtitleq;h!}q<(h%]h&]h$]h#]h']uh)Kh*hh]q=cdocutils.nodes Text q>XThe Varnish Reference Manualq?…q@}qA(hh:hh8ubaubcdocutils.nodes compound qB)qC}qD(hUhh,hhhUcompoundqEh!}qF(h%]h&]qGUtoctree-wrapperqHah$]h#]h']uh)Kh*hh]qIcsphinx.addnodes toctree qJ)qK}qL(hUhhChhhUtoctreeqMh!}qN(UnumberedqOKhUreference/indexqPU titlesonlyqQ‰UglobqR‰h#]h$]h%]h&]h']UentriesqS]qT(NX reference/vclqU†qVNXreference/varnish-cliqW†qXNXreference/varnishadmqY†qZNXreference/varnishdq[†q\NXreference/varnishhistq]†q^NXreference/varnishlogq_†q`NXreference/varnishncsaqa†qbNXreference/varnishreplayqc†qdNXreference/varnishsizesqe†qfNXreference/varnishstatqg†qhNXreference/varnishtestqi†qjNXreference/varnishtopqk†qlNXreference/shmemqm†qnNXreference/vmodqo†qpNXreference/vmod_stdqq†qrNX reference/vslqs†qteUhiddenqu‰U includefilesqv]qw(hUhWhYh[h]h_hahchehghihkhmhohqhseUmaxdepthqxJÿÿÿÿuh)Kh]ubaubh)qy}qz(hUhh,hhhh h!}q{(h#]h$]h%]h&]h']h(Uindex-0q|uh)Nh*hh]ubcsphinx.ext.todo todo_node q})q~}q(hXThe programs: . varnishd manual page . varnishstat . - counters explained . common filtering options for shmlog tools . varnishlog .. . varnsihtop .. . varnsihncsa .. . varnsihhist .. The CLI: . connections: -T -S -M . varnishadm . CLI commands and what they do . - vcl.load . - stop . - start . - ... VCL language . The functions: . - vcl_recv . - vcl_miss . --- . The things you can do . - set . - unset . - esi . - rollback Varnishtest . syntax etc. Shared Memory . internals . Log records Libvarnishapi . function descriptionsq€hh,hhh.}hU todo_nodeqh!}q‚(h%]h&]qƒUadmonition-todoq„ah$]h#]q…h|ah']uh)Kh*hh4}q†h|hysh]q‡(h7)qˆ}q‰(hXTodoqŠh!}q‹(h%]h&]h$]h#]h']uhh~h]qŒh>XTodoq…qŽ}q(hhŠhhˆubahh;ubcdocutils.nodes paragraph q)q‘}q’(hXThe programs: . varnishd manual page . varnishstat . - counters explained . common filtering options for shmlog tools . varnishlog .. . varnsihtop .. . varnsihncsa .. . varnsihhist .. The CLI: . connections: -T -S -M . varnishadm . CLI commands and what they do . - vcl.load . - stop . - start . - ... VCL language . The functions: . - vcl_recv . - vcl_miss . --- . The things you can do . - set . - unset . - esi . - rollback Varnishtest . syntax etc. Shared Memory . internals . Log records Libvarnishapi . function descriptionsq“hh~hhhU paragraphq”h!}q•(h%]h&]h$]h#]h']uh)Kh]q–h>XThe programs: . varnishd manual page . varnishstat . - counters explained . common filtering options for shmlog tools . varnishlog .. . varnsihtop .. . varnsihncsa .. . varnsihhist .. The CLI: . connections: -T -S -M . varnishadm . CLI commands and what they do . - vcl.load . - stop . - start . - ... VCL language . The functions: . - vcl_recv . - vcl_miss . --- . The things you can do . - set . - unset . - esi . - rollback Varnishtest . syntax etc. Shared Memory . internals . Log records Libvarnishapi . function descriptionsq—…q˜}q™(hh“hh‘ubaubeubeubehUU transformerqšNU footnote_refsq›}qœUrefnamesq}qžUsymbol_footnotesqŸ]q Uautofootnote_refsq¡]q¢Usymbol_footnote_refsq£]q¤U citationsq¥]q¦h*hU current_lineq§NUtransform_messagesq¨]q©(cdocutils.nodes system_message qª)q«}q¬(hUh!}q­(h%]UlevelKh#]h$]Usourcehh&]h']UlineKUtypeUINFOq®uh]q¯h)q°}q±(hUh!}q²(h%]h&]h$]h#]h']uhh«h]q³h>X5Hyperlink target "reference-index" is not referenced.q´…qµ}q¶(hUhh°ubahh”ubahUsystem_messageq·ubhª)q¸}q¹(hUh!}qº(h%]UlevelKh#]h$]Usourcehh&]h']Utypeh®uh]q»h)q¼}q½(hUh!}q¾(h%]h&]h$]h#]h']uhh¸h]q¿h>X-Hyperlink target "index-0" is not referenced.qÀ…qÁ}qÂ(hUhh¼ubahh”ubahh·ubeUreporterqÃNUid_startqÄKU autofootnotesqÅ]qÆU citation_refsqÇ}qÈUindirect_targetsqÉ]qÊUsettingsqË(cdocutils.frontend Values qÌoqÍ}qÎ(Ufootnote_backlinksqÏKUrecord_dependenciesqÐNU rfc_base_urlqÑUhttp://tools.ietf.org/html/qÒU tracebackqÓˆUpep_referencesqÔNUstrip_commentsqÕNU toc_backlinksqÖUentryq×U language_codeqØUenqÙU datestampqÚNU report_levelqÛKU _destinationqÜNU halt_levelqÝKU strip_classesqÞNh;NUerror_encoding_error_handlerqßUbackslashreplaceqàUdebugqáNUembed_stylesheetqâ‰Uoutput_encoding_error_handlerqãUstrictqäU sectnum_xformqåKUdump_transformsqæNU docinfo_xformqçKUwarning_streamqèNUpep_file_url_templateqéUpep-%04dqêUexit_status_levelqëKUconfigqìNUstrict_visitorqíNUcloak_email_addressesqîˆUtrim_footnote_reference_spaceqï‰UenvqðNUdump_pseudo_xmlqñNUexpose_internalsqòNUsectsubtitle_xformqó‰U source_linkqôNUrfc_referencesqõNUoutput_encodingqöUutf-8q÷U source_urlqøNUinput_encodingqùU utf-8-sigqúU_disable_configqûNU id_prefixqüUU tab_widthqýKUerror_encodingqþUUTF-8qÿU_sourcerU3/home/tfheen/varnish/doc/sphinx/reference/index.rstrUgettext_compactrˆU generatorrNUdump_internalsrNU smart_quotesr‰U pep_base_urlrUhttp://www.python.org/dev/peps/rUsyntax_highlightrUlongr Uinput_encoding_error_handlerr häUauto_id_prefixr Uidr Udoctitle_xformr ‰Ustrip_elements_with_classesrNU _config_filesr]rUfile_insertion_enabledrKU raw_enabledrKU dump_settingsrNubUsymbol_footnote_startrKUidsr}r(hh,h|h~hh,uUsubstitution_namesr}rhh*h!}r(h%]h#]h$]Usourcehh&]h']uU footnotesr]rUrefidsr}r(h]rhah|]rhyauub.varnish-3.0.5/doc/sphinx/=build/doctrees/reference/varnishadm.doctree0000644000175000017500000004340512247037213022644 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(X descriptionqNX copyrightqNX varnishadmqNXoptionsq NXsynopsisq NXexamplesq NXsee alsoq NX"control a running varnish instanceq NX exit statusqNXhistoryqNuUsubstitution_defsq}qUparse_messagesq]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hU descriptionqhU copyrightqhU varnishadmqh Uoptionsqh Usynopsisqh Uexamplesqh Usee-alsoqh U"control-a-running-varnish-instanceq hU exit-statusq!hUhistoryq"uUchildrenq#]q$cdocutils.nodes section q%)q&}q'(U rawsourceq(UUparentq)hUsourceq*cdocutils.nodes reprunicode q+X8/home/tfheen/varnish/doc/sphinx/reference/varnishadm.rstq,…q-}q.bUtagnameq/Usectionq0U attributesq1}q2(Udupnamesq3]Uclassesq4]Ubackrefsq5]Uidsq6]q7haUnamesq8]q9hauUlineq:KUdocumentq;hh#]q<(cdocutils.nodes title q=)q>}q?(h(X varnishadmq@h)h&h*h-h/UtitleqAh1}qB(h3]h4]h5]h6]h8]uh:Kh;hh#]qCcdocutils.nodes Text qDX varnishadmqE…qF}qG(h(h@h)h>ubaubh%)qH}qI(h(Uh)h&h*h-h/h0h1}qJ(h3]h4]h5]h6]qKh ah8]qLh auh:Kh;hh#]qM(h=)qN}qO(h(X"Control a running varnish instanceqPh)hHh*h-h/hAh1}qQ(h3]h4]h5]h6]h8]uh:Kh;hh#]qRhDX"Control a running varnish instanceqS…qT}qU(h(hPh)hNubaubcdocutils.nodes field_list qV)qW}qX(h(Uh)hHh*h-h/U field_listqYh1}qZ(h3]h4]h5]h6]h8]uh:K h;hh#]q[(cdocutils.nodes field q\)q]}q^(h(Uh)hWh*h-h/Ufieldq_h1}q`(h3]h4]h5]h6]h8]uh:K h;hh#]qa(cdocutils.nodes field_name qb)qc}qd(h(XAuthorqeh1}qf(h3]h4]h5]h6]h8]uh)h]h#]qghDXAuthorqh…qi}qj(h(heh)hcubah/U field_nameqkubcdocutils.nodes field_body ql)qm}qn(h(XCecilie Fritzvoldqoh1}qp(h3]h4]h5]h6]h8]uh)h]h#]qqcdocutils.nodes paragraph qr)qs}qt(h(hoh)hmh*h-h/U paragraphquh1}qv(h3]h4]h5]h6]h8]uh:K h#]qwhDXCecilie Fritzvoldqx…qy}qz(h(hoh)hsubaubah/U field_bodyq{ubeubh\)q|}q}(h(Uh)hWh*h-h/h_h1}q~(h3]h4]h5]h6]h8]uh:K h;hh#]q(hb)q€}q(h(XAuthorq‚h1}qƒ(h3]h4]h5]h6]h8]uh)h|h#]q„hDXAuthorq……q†}q‡(h(h‚h)h€ubah/hkubhl)qˆ}q‰(h(XPer BuerqŠh1}q‹(h3]h4]h5]h6]h8]uh)h|h#]qŒhr)q}qŽ(h(hŠh)hˆh*h-h/huh1}q(h3]h4]h5]h6]h8]uh:K h#]qhDXPer Buerq‘…q’}q“(h(hŠh)hubaubah/h{ubeubh\)q”}q•(h(Uh)hWh*h-h/h_h1}q–(h3]h4]h5]h6]h8]uh:K h;hh#]q—(hb)q˜}q™(h(XDateqšh1}q›(h3]h4]h5]h6]h8]uh)h”h#]qœhDXDateq…qž}qŸ(h(hšh)h˜ubah/hkubhl)q }q¡(h(X 2010-05-31q¢h1}q£(h3]h4]h5]h6]h8]uh)h”h#]q¤hr)q¥}q¦(h(h¢h)h h*h-h/huh1}q§(h3]h4]h5]h6]h8]uh:K h#]q¨hDX 2010-05-31q©…qª}q«(h(h¢h)h¥ubaubah/h{ubeubh\)q¬}q­(h(Uh)hWh*h-h/h_h1}q®(h3]h4]h5]h6]h8]uh:K h;hh#]q¯(hb)q°}q±(h(XVersionq²h1}q³(h3]h4]h5]h6]h8]uh)h¬h#]q´hDXVersionqµ…q¶}q·(h(h²h)h°ubah/hkubhl)q¸}q¹(h(X0.3qºh1}q»(h3]h4]h5]h6]h8]uh)h¬h#]q¼hr)q½}q¾(h(hºh)h¸h*h-h/huh1}q¿(h3]h4]h5]h6]h8]uh:K h#]qÀhDX0.3qÁ…qÂ}qÃ(h(hºh)h½ubaubah/h{ubeubh\)qÄ}qÅ(h(Uh)hWh*h-h/h_h1}qÆ(h3]h4]h5]h6]h8]uh:K h;hh#]qÇ(hb)qÈ}qÉ(h(XManual sectionqÊh1}qË(h3]h4]h5]h6]h8]uh)hÄh#]qÌhDXManual sectionqÍ…qÎ}qÏ(h(hÊh)hÈubah/hkubhl)qÐ}qÑ(h(X1 h1}qÒ(h3]h4]h5]h6]h8]uh)hÄh#]qÓhr)qÔ}qÕ(h(X1h)hÐh*h-h/huh1}qÖ(h3]h4]h5]h6]h8]uh:K h#]q×hDX1…qØ}qÙ(h(X1h)hÔubaubah/h{ubeubeubh%)qÚ}qÛ(h(Uh)hHh*h-h/h0h1}qÜ(h3]h4]h5]h6]qÝhah8]qÞh auh:Kh;hh#]qß(h=)qà}qá(h(XSYNOPSISqâh)hÚh*h-h/hAh1}qã(h3]h4]h5]h6]h8]uh:Kh;hh#]qähDXSYNOPSISqå…qæ}qç(h(hâh)hàubaubcdocutils.nodes block_quote qè)qé}qê(h(Uh)hÚh*h-h/U block_quoteqëh1}qì(h3]h4]h5]h6]h8]uh:Nh;hh#]qíhr)qî}qï(h(XTvarnishadm [-t timeout] [-S secret_file] [-T address:port] [-n name] [command [...]]qðh)héh*h-h/huh1}qñ(h3]h4]h5]h6]h8]uh:Kh#]qòhDXTvarnishadm [-t timeout] [-S secret_file] [-T address:port] [-n name] [command [...]]qó…qô}qõ(h(hðh)hîubaubaubeubh%)qö}q÷(h(Uh)hHh*h-h/h0h1}qø(h3]h4]h5]h6]qùhah8]qúhauh:Kh;hh#]qû(h=)qü}qý(h(X DESCRIPTIONqþh)höh*h-h/hAh1}qÿ(h3]h4]h5]h6]h8]uh:Kh;hh#]rhDX DESCRIPTIONr…r}r(h(hþh)hüubaubhr)r}r(h(X1The 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.h)höh*h-h/huh1}r(h3]h4]h5]h6]h8]uh:Kh;hh#]r(hDXPThe varnishadm utility establishes a CLI connection to varnishd either using -n r…r }r (h(XPThe varnishadm utility establishes a CLI connection to varnishd either using -n h)jubcdocutils.nodes emphasis r )r }r (h(X*name*h1}r(h3]h4]h5]h6]h8]uh)jh#]rhDXnamer…r}r(h(Uh)j ubah/UemphasisrubhDX) or using the -T and -S arguments. If -n r…r}r(h(X) or using the -T and -S arguments. If -n h)jubj )r}r(h(X*name*h1}r(h3]h4]h5]h6]h8]uh)jh#]rhDXnamer…r}r(h(Uh)jubah/jubhDX¬ 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.r…r}r (h(X¬ 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.h)jubeubhr)r!}r"(h(XtIf a command is given, the command and arguments are sent over the CLI connection and the result returned on stdout.r#h)höh*h-h/huh1}r$(h3]h4]h5]h6]h8]uh:Kh;hh#]r%hDXtIf a command is given, the command and arguments are sent over the CLI connection and the result returned on stdout.r&…r'}r((h(j#h)j!ubaubhr)r)}r*(h(XrIf no command argument is given varnishadm will pass commands and replies between the CLI socket and stdin/stdout.r+h)höh*h-h/huh1}r,(h3]h4]h5]h6]h8]uh:K h;hh#]r-hDXrIf no command argument is given varnishadm will pass commands and replies between the CLI socket and stdin/stdout.r.…r/}r0(h(j+h)j)ubaubeubh%)r1}r2(h(Uh)hHh*h-h/h0h1}r3(h3]h4]h5]h6]r4hah8]r5h auh:K$h;hh#]r6(h=)r7}r8(h(XOPTIONSr9h)j1h*h-h/hAh1}r:(h3]h4]h5]h6]h8]uh:K$h;hh#]r;hDXOPTIONSr<…r=}r>(h(j9h)j7ubaubcdocutils.nodes option_list r?)r@}rA(h(Uh)j1h*h-h/U option_listrBh1}rC(h3]h4]h5]h6]h8]uh:Nh;hh#]rD(cdocutils.nodes option_list_item rE)rF}rG(h(Uh)j@h*h-h/Uoption_list_itemrHh1}rI(h3]h4]h5]h6]h8]uh:Nh;hh#]rJ(cdocutils.nodes option_group rK)rL}rM(h(Uh1}rN(h3]h4]h5]h6]h8]uh)jFh#]rOcdocutils.nodes option rP)rQ}rR(h(X -t timeoutrSh1}rT(h3]h4]h5]h6]h8]uh)jLh#]rU(cdocutils.nodes option_string rV)rW}rX(h(X-th1}rY(h3]h4]h5]h6]h8]uh)jQh#]rZhDX-tr[…r\}r](h(Uh)jWubah/U option_stringr^ubcdocutils.nodes option_argument r_)r`}ra(h(Xtimeouth1}rb(h6]h5]h3]U delimiterU h4]h8]uh)jQh#]rchDXtimeoutrd…re}rf(h(Uh)j`ubah/Uoption_argumentrgubeh/Uoptionrhubah/U option_groupriubcdocutils.nodes description rj)rk}rl(h(XBWait no longer than this many seconds for an operation to finish. h1}rm(h3]h4]h5]h6]h8]uh)jFh#]rnhr)ro}rp(h(XAWait no longer than this many seconds for an operation to finish.rqh)jkh*h-h/huh1}rr(h3]h4]h5]h6]h8]uh:K'h#]rshDXAWait no longer than this many seconds for an operation to finish.rt…ru}rv(h(jqh)joubaubah/U descriptionrwubeubjE)rx}ry(h(Uh)j@h*h-h/jHh1}rz(h3]h4]h5]h6]h8]uh:Nh;hh#]r{(jK)r|}r}(h(Uh1}r~(h3]h4]h5]h6]h8]uh)jxh#]rjP)r€}r(h(X-S secret_filer‚h1}rƒ(h3]h4]h5]h6]h8]uh)j|h#]r„(jV)r…}r†(h(X-Sh1}r‡(h3]h4]h5]h6]h8]uh)j€h#]rˆhDX-Sr‰…rŠ}r‹(h(Uh)j…ubah/j^ubj_)rŒ}r(h(X secret_fileh1}rŽ(h6]h5]h3]U delimiterU h4]h8]uh)j€h#]rhDX secret_filer…r‘}r’(h(Uh)jŒubah/jgubeh/jhubah/jiubjj)r“}r”(h(XÐ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. h1}r•(h3]h4]h5]h6]h8]uh)jxh#]r–hr)r—}r˜(h(XÏ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.r™h)j“h*h-h/huh1}rš(h3]h4]h5]h6]h8]uh:K*h#]r›hDXÏ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.rœ…r}rž(h(j™h)j—ubaubah/jwubeubeubcdocutils.nodes definition_list rŸ)r }r¡(h(Uh)j1h*h-h/Udefinition_listr¢h1}r£(h3]h4]h5]h6]h8]uh:Nh;hh#]r¤cdocutils.nodes definition_list_item r¥)r¦}r§(h(XW-T address:port Connect to the management interface at the specified address and port. h)j h*h-h/Udefinition_list_itemr¨h1}r©(h3]h4]h5]h6]h8]uh:K/h#]rª(cdocutils.nodes term r«)r¬}r­(h(X-T address:portr®h)j¦h*h-h/Utermr¯h1}r°(h3]h4]h5]h6]h8]uh:K/h#]r±hDX-T address:portr²…r³}r´(h(j®h)j¬ubaubcdocutils.nodes definition rµ)r¶}r·(h(Uh1}r¸(h3]h4]h5]h6]h8]uh)j¦h#]r¹hr)rº}r»(h(XFConnect to the management interface at the specified address and port.r¼h)j¶h*h-h/huh1}r½(h3]h4]h5]h6]h8]uh:K/h#]r¾hDXFConnect to the management interface at the specified address and port.r¿…rÀ}rÁ(h(j¼h)jºubaubah/U definitionrÂubeubaubj?)rÃ}rÄ(h(Uh)j1h*h-h/jBh1}rÅ(h3]h4]h5]h6]h8]uh:Nh;hh#]rÆjE)rÇ}rÈ(h(Uh)jÃh*h-h/jHh1}rÉ(h3]h4]h5]h6]h8]uh:Nh;hh#]rÊ(jK)rË}rÌ(h(Uh1}rÍ(h3]h4]h5]h6]h8]uh)jÇh#]rÎjP)rÏ}rÐ(h(X-n namerÑh1}rÒ(h3]h4]h5]h6]h8]uh)jËh#]rÓ(jV)rÔ}rÕ(h(X-nh1}rÖ(h3]h4]h5]h6]h8]uh)jÏh#]r×hDX-nrØ…rÙ}rÚ(h(Uh)jÔubah/j^ubj_)rÛ}rÜ(h(Xnameh1}rÝ(h6]h5]h3]U delimiterU h4]h8]uh)jÏh#]rÞhDXnamerß…rà}rá(h(Uh)jÛubah/jgubeh/jhubah/jiubjj)râ}rã(h(X4Connect to the instance of varnishd with this name. h1}rä(h3]h4]h5]h6]h8]uh)jÇh#]råhr)ræ}rç(h(X3Connect to the instance of varnishd with this name.rèh)jâh*h-h/huh1}ré(h3]h4]h5]h6]h8]uh:K2h#]rêhDX3Connect to the instance of varnishd with this name.rë…rì}rí(h(jèh)jæubaubah/jwubeubaubhr)rî}rï(h(XšThe syntax and operation of the actual CLI interface is described in the varnish-cli(7) manual page. Parameteres are described in varnishd(1) manual page.rðh)j1h*h-h/huh1}rñ(h3]h4]h5]h6]h8]uh:K4h;hh#]ròhDXšThe syntax and operation of the actual CLI interface is described in the varnish-cli(7) manual page. Parameteres are described in varnishd(1) manual page.ró…rô}rõ(h(jðh)jîubaubhr)rö}r÷(h(X£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.h)j1h*h-h/huh1}rø(h3]h4]h5]h6]h8]uh:K8h;hh#]rù(hDXCAdditionally, a summary of commands can be obtained by issuing the rú…rû}rü(h(XCAdditionally, a summary of commands can be obtained by issuing the h)jöubj )rý}rþ(h(X*help*h1}rÿ(h3]h4]h5]h6]h8]uh)jöh#]rhDXhelpr…r}r(h(Uh)jýubah/jubhDXE command, and a summary of parameters can be obtained by issuing the r…r}r(h(XE command, and a summary of parameters can be obtained by issuing the h)jöubj )r}r(h(X *param.show*h1}r (h3]h4]h5]h6]h8]uh)jöh#]r hDX param.showr …r }r (h(Uh)jubah/jubhDX command.r…r}r(h(X command.h)jöubeubeubh%)r}r(h(Uh)hHh*h-h/h0h1}r(h3]h4]h5]h6]rh!ah8]rhauh:K=h;hh#]r(h=)r}r(h(X EXIT STATUSrh)jh*h-h/hAh1}r(h3]h4]h5]h6]h8]uh:K=h;hh#]rhDX EXIT STATUSr…r}r(h(jh)jubaubhr)r}r (h(XzIf a command is given, the exit status of the varnishadm utility is zero if the command succeeded, and non-zero otherwise.r!h)jh*h-h/huh1}r"(h3]h4]h5]h6]h8]uh:K?h;hh#]r#hDXzIf a command is given, the exit status of the varnishadm utility is zero if the command succeeded, and non-zero otherwise.r$…r%}r&(h(j!h)jubaubeubh%)r'}r((h(Uh)hHh*h-h/h0h1}r)(h3]h4]h5]h6]r*hah8]r+h auh:KCh;hh#]r,(h=)r-}r.(h(XEXAMPLESr/h)j'h*h-h/hAh1}r0(h3]h4]h5]h6]h8]uh:KCh;hh#]r1hDXEXAMPLESr2…r3}r4(h(j/h)j-ubaubhr)r5}r6(h(X"Some ways you can use varnishadm::r7h)j'h*h-h/huh1}r8(h3]h4]h5]h6]h8]uh:KEh;hh#]r9hDX!Some ways you can use varnishadm:r:…r;}r<(h(X!Some ways you can use varnishadm:h)j5ubaubcdocutils.nodes literal_block r=)r>}r?(h(XÅ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/secreth)j'h*h-h/U literal_blockr@h1}rA(U xml:spacerBUpreserverCh6]h5]h3]h4]h8]uh:KGh;hh#]rDhDXÅ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/secretrE…rF}rG(h(Uh)j>ubaubeubh%)rH}rI(h(Uh)hHh*h-h/h0h1}rJ(h3]h4]h5]h6]rKhah8]rLh auh:KLh;hh#]rM(h=)rN}rO(h(XSEE ALSOrPh)jHh*h-h/hAh1}rQ(h3]h4]h5]h6]h8]uh:KLh;hh#]rRhDXSEE ALSOrS…rT}rU(h(jPh)jNubaubcdocutils.nodes bullet_list rV)rW}rX(h(Uh)jHh*h-h/U bullet_listrYh1}rZ(Ubulletr[X*h6]h5]h3]h4]h8]uh:KNh;hh#]r\cdocutils.nodes list_item r])r^}r_(h(X varnishd(1) h)jWh*h-h/U list_itemr`h1}ra(h3]h4]h5]h6]h8]uh:Nh;hh#]rbhr)rc}rd(h(X varnishd(1)reh)j^h*h-h/huh1}rf(h3]h4]h5]h6]h8]uh:KNh#]rghDX varnishd(1)rh…ri}rj(h(jeh)jcubaubaubaubeubh%)rk}rl(h(Uh)hHh*h-h/h0h1}rm(h3]h4]h5]h6]rnh"ah8]rohauh:KQh;hh#]rp(h=)rq}rr(h(XHISTORYrsh)jkh*h-h/hAh1}rt(h3]h4]h5]h6]h8]uh:KQh;hh#]ruhDXHISTORYrv…rw}rx(h(jsh)jqubaubhr)ry}rz(h(X‰The varnishadm utility and this manual page were written by Cecilie Fritzvold. Converted to reStructured and updated in 2010 by Per Buer.r{h)jkh*h-h/huh1}r|(h3]h4]h5]h6]h8]uh:KSh;hh#]r}hDX‰The varnishadm utility and this manual page were written by Cecilie Fritzvold. Converted to reStructured and updated in 2010 by Per Buer.r~…r}r€(h(j{h)jyubaubeubh%)r}r‚(h(Uh)hHh*h-h/h0h1}rƒ(h3]h4]h5]h6]r„hah8]r…hauh:KXh;hh#]r†(h=)r‡}rˆ(h(X COPYRIGHTr‰h)jh*h-h/hAh1}rŠ(h3]h4]h5]h6]h8]uh:KXh;hh#]r‹hDX COPYRIGHTrŒ…r}rŽ(h(j‰h)j‡ubaubhr)r}r(h(X\This document is licensed under the same licence as Varnish itself. See LICENCE for details.r‘h)jh*h-h/huh1}r’(h3]h4]h5]h6]h8]uh:KZh;hh#]r“hDX\This document is licensed under the same licence as Varnish itself. See LICENCE for details.r”…r•}r–(h(j‘h)jubaubjV)r—}r˜(h(Uh)jh*h-h/jYh1}r™(j[X*h6]h5]h3]h4]h8]uh:K]h;hh#]ršj])r›}rœ(h(X+Copyright (c) 2007-2011 Varnish Software ASrh)j—h*h-h/j`h1}rž(h3]h4]h5]h6]h8]uh:Nh;hh#]rŸhr)r }r¡(h(jh)j›h*h-h/huh1}r¢(h3]h4]h5]h6]h8]uh:K]h#]r£hDX+Copyright (c) 2007-2011 Varnish Software ASr¤…r¥}r¦(h(jh)j ubaubaubaubeubeubeubah(UU transformerr§NU footnote_refsr¨}r©Urefnamesrª}r«Usymbol_footnotesr¬]r­Uautofootnote_refsr®]r¯Usymbol_footnote_refsr°]r±U citationsr²]r³h;hU current_liner´NUtransform_messagesrµ]r¶Ureporterr·NUid_startr¸KU autofootnotesr¹]rºU citation_refsr»}r¼Uindirect_targetsr½]r¾Usettingsr¿(cdocutils.frontend Values rÀorÁ}rÂ(Ufootnote_backlinksrÃKUrecord_dependenciesrÄNU rfc_base_urlrÅUhttp://tools.ietf.org/html/rÆU tracebackrLjUpep_referencesrÈNUstrip_commentsrÉNU toc_backlinksrÊUentryrËU language_coderÌUenrÍU datestamprÎNU report_levelrÏKU _destinationrÐNU halt_levelrÑKU strip_classesrÒNhANUerror_encoding_error_handlerrÓUbackslashreplacerÔUdebugrÕNUembed_stylesheetrÖ‰Uoutput_encoding_error_handlerr×UstrictrØU sectnum_xformrÙKUdump_transformsrÚNU docinfo_xformrÛKUwarning_streamrÜNUpep_file_url_templaterÝUpep-%04drÞUexit_status_levelrßKUconfigràNUstrict_visitorráNUcloak_email_addressesrâˆUtrim_footnote_reference_spacerã‰UenvräNUdump_pseudo_xmlråNUexpose_internalsræNUsectsubtitle_xformrç‰U source_linkrèNUrfc_referencesréNUoutput_encodingrêUutf-8rëU source_urlrìNUinput_encodingríU utf-8-sigrîU_disable_configrïNU id_prefixrðUU tab_widthrñKUerror_encodingròUUTF-8róU_sourcerôU8/home/tfheen/varnish/doc/sphinx/reference/varnishadm.rstrõUgettext_compactröˆU generatorr÷NUdump_internalsrøNU smart_quotesrù‰U pep_base_urlrúUhttp://www.python.org/dev/peps/rûUsyntax_highlightrüUlongrýUinput_encoding_error_handlerrþjØUauto_id_prefixrÿUidrUdoctitle_xformr‰Ustrip_elements_with_classesrNU _config_filesr]Ufile_insertion_enabledrKU raw_enabledrKU dump_settingsrNubUsymbol_footnote_startrKUidsr}r (hhöhjhjHhh&h hHh!jhhÚhj'hj1h"jkuUsubstitution_namesr }r h/h;h1}r (h3]h6]h5]Usourceh-h4]h8]uU footnotesr ]rUrefidsr}rub.varnish-3.0.5/doc/sphinx/=build/doctrees/reference/vcl_var.doctree0000644000175000017500000016310012247037213022137 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(XberespqNXobjqNXbereqqNXrespq NXreqq NXserverq NXclientq NXnowq NuUsubstitution_defsq}qUparse_messagesq]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hUberespqhUobjqhUbereqqh Urespqh Ureqqh Userverqh Uclientqh UnowquUchildrenq]q (cdocutils.nodes section q!)q"}q#(U rawsourceq$UUparentq%hUsourceq&cdocutils.nodes reprunicode q'X5/home/tfheen/varnish/doc/sphinx/reference/vcl_var.rstq(…q)}q*bUtagnameq+Usectionq,U attributesq-}q.(Udupnamesq/]Uclassesq0]Ubackrefsq1]Uidsq2]q3haUnamesq4]q5hauUlineq6KUdocumentq7hh]q8(cdocutils.nodes title q9)q:}q;(h$Xbereqq(h/]h0]h1]h2]h4]uh6Kh7hh]q?cdocutils.nodes Text q@XbereqqA…qB}qC(h$h}r?(h$j:h%j8ubaubhD)r@}rA(h$X&The request type (e.g. "GET", "HEAD").rBh%j$h&h)h+hHh-}rC(h/]h0]h1]h2]h4]uh6KKh]rDh@X&The request type (e.g. "GET", "HEAD").rE…rF}rG(h$jBh%j@ubaubeubhD)rH}rI(h$X bereq.protorJh%h"h&h)h+hHh-}rK(h/]h0]h1]h2]h4]uh6KNh7hh]rLh@X bereq.protorM…rN}rO(h$jJh%jHubaubhN)rP}rQ(h$Uh%h"h&h)h+hQh-}rR(h/]h0]h1]h2]h4]uh6Nh7hh]rS(hD)rT}rU(h$X Type: STRINGrVh%jPh&h)h+hHh-}rW(h/]h0]h1]h2]h4]uh6KPh]rXh@X Type: STRINGrY…rZ}r[(h$jVh%jTubaubhD)r\}r](h$X Readable from: vcl_pipe, backendr^h%jPh&h)h+hHh-}r_(h/]h0]h1]h2]h4]uh6KRh]r`h@X Readable from: vcl_pipe, backendra…rb}rc(h$j^h%j\ubaubhD)rd}re(h$X"Writeable frome: vcl_pipe, backendrfh%jPh&h)h+hHh-}rg(h/]h0]h1]h2]h4]uh6KTh]rhh@X"Writeable frome: vcl_pipe, backendri…rj}rk(h$jfh%jdubaubhD)rl}rm(h$X5The HTTP protocol version used to talk to the server.rnh%jPh&h)h+hHh-}ro(h/]h0]h1]h2]h4]uh6KWh]rph@X5The HTTP protocol version used to talk to the server.rq…rr}rs(h$jnh%jlubaubeubhD)rt}ru(h$X bereq.retriesrvh%h"h&h)h+hHh-}rw(h/]h0]h1]h2]h4]uh6KZh7hh]rxh@X bereq.retriesry…rz}r{(h$jvh%jtubaubhN)r|}r}(h$Uh%h"h&h)h+hQh-}r~(h/]h0]h1]h2]h4]uh6Nh7hh]r(hD)r€}r(h$X Type: INTr‚h%j|h&h)h+hHh-}rƒ(h/]h0]h1]h2]h4]uh6K\h]r„h@X Type: INTr……r†}r‡(h$j‚h%j€ubaubhD)rˆ}r‰(h$XReadable from: backendrŠh%j|h&h)h+hHh-}r‹(h/]h0]h1]h2]h4]uh6K^h]rŒh@XReadable from: backendr…rŽ}r(h$jŠh%jˆubaubeubhD)r}r‘(h$Xbereq.uncacheabler’h%h"h&h)h+hHh-}r“(h/]h0]h1]h2]h4]uh6Kch7hh]r”h@Xbereq.uncacheabler•…r–}r—(h$j’h%jubaubhN)r˜}r™(h$Uh%h"h&h)h+hQh-}rš(h/]h0]h1]h2]h4]uh6Nh7hh]r›(hD)rœ}r(h$X Type: BOOLržh%j˜h&h)h+hHh-}rŸ(h/]h0]h1]h2]h4]uh6Keh]r h@X Type: BOOLr¡…r¢}r£(h$jžh%jœubaubhD)r¤}r¥(h$XReadable from: backendr¦h%j˜h&h)h+hHh-}r§(h/]h0]h1]h2]h4]uh6Kgh]r¨h@XReadable from: backendr©…rª}r«(h$j¦h%j¤ubaubhD)r¬}r­(h$XWriteable frome: backendr®h%j˜h&h)h+hHh-}r¯(h/]h0]h1]h2]h4]uh6Kih]r°h@XWriteable frome: backendr±…r²}r³(h$j®h%j¬ubaubeubhD)r´}rµ(h$X bereq.urlr¶h%h"h&h)h+hHh-}r·(h/]h0]h1]h2]h4]uh6Knh7hh]r¸h@X bereq.urlr¹…rº}r»(h$j¶h%j´ubaubhN)r¼}r½(h$Uh%h"h&h)h+hQh-}r¾(h/]h0]h1]h2]h4]uh6Nh7hh]r¿(hD)rÀ}rÁ(h$X Type: STRINGrÂh%j¼h&h)h+hHh-}rÃ(h/]h0]h1]h2]h4]uh6Kph]rÄh@X Type: STRINGrÅ…rÆ}rÇ(h$jÂh%jÀubaubhD)rÈ}rÉ(h$X Readable from: vcl_pipe, backendrÊh%j¼h&h)h+hHh-}rË(h/]h0]h1]h2]h4]uh6Krh]rÌh@X Readable from: vcl_pipe, backendrÍ…rÎ}rÏ(h$jÊh%jÈubaubhD)rÐ}rÑ(h$X"Writeable frome: vcl_pipe, backendrÒh%j¼h&h)h+hHh-}rÓ(h/]h0]h1]h2]h4]uh6Kth]rÔh@X"Writeable frome: vcl_pipe, backendrÕ…rÖ}r×(h$jÒh%jÐubaubhD)rØ}rÙ(h$XThe requested URL.rÚh%j¼h&h)h+hHh-}rÛ(h/]h0]h1]h2]h4]uh6Kwh]rÜh@XThe requested URL.rÝ…rÞ}rß(h$jÚh%jØubaubeubeubh!)rà}rá(h$Uh%hh&h)h+h,h-}râ(h/]h0]h1]h2]rãhah4]rähauh6K{h7hh]rå(h9)ræ}rç(h$Xberesprèh%jàh&h)h+h=h-}ré(h/]h0]h1]h2]h4]uh6K{h7hh]rêh@Xberesprë…rì}rí(h$jèh%jæubaubhD)rî}rï(h$Xberesp.backend.iprðh%jàh&h)h+hHh-}rñ(h/]h0]h1]h2]h4]uh6K}h7hh]ròh@Xberesp.backend.ipró…rô}rõ(h$jðh%jîubaubhN)rö}r÷(h$Uh%jàh&h)h+hQh-}rø(h/]h0]h1]h2]h4]uh6Nh7hh]rù(hD)rú}rû(h$XType: IPrüh%jöh&h)h+hHh-}rý(h/]h0]h1]h2]h4]uh6Kh]rþh@XType: IPrÿ…r}r(h$jüh%júubaubhD)r}r(h$X#Readable from: vcl_backend_responserh%jöh&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6Kh]rh@X#Readable from: vcl_backend_responser…r}r (h$jh%jubaubhD)r }r (h$X1IP of the backend this response was fetched from.r h%jöh&h)h+hHh-}r (h/]h0]h1]h2]h4]uh6K„h]rh@X1IP of the backend this response was fetched from.r…r}r(h$j h%j ubaubeubhD)r}r(h$Xberesp.backend.namerh%jàh&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6K‡h7hh]rh@Xberesp.backend.namer…r}r(h$jh%jubaubhN)r}r(h$Uh%jàh&h)h+hQh-}r(h/]h0]h1]h2]h4]uh6Nh7hh]r(hD)r}r(h$X Type: STRINGr h%jh&h)h+hHh-}r!(h/]h0]h1]h2]h4]uh6K‰h]r"h@X Type: STRINGr#…r$}r%(h$j h%jubaubhD)r&}r'(h$X#Readable from: vcl_backend_responser(h%jh&h)h+hHh-}r)(h/]h0]h1]h2]h4]uh6K‹h]r*h@X#Readable from: vcl_backend_responser+…r,}r-(h$j(h%j&ubaubhD)r.}r/(h$X3Name of the backend this response was fetched from.r0h%jh&h)h+hHh-}r1(h/]h0]h1]h2]h4]uh6KŽh]r2h@X3Name of the backend this response was fetched from.r3…r4}r5(h$j0h%j.ubaubeubhD)r6}r7(h$X beresp.do_esir8h%jàh&h)h+hHh-}r9(h/]h0]h1]h2]h4]uh6K‘h7hh]r:h@X beresp.do_esir;…r<}r=(h$j8h%j6ubaubhN)r>}r?(h$Uh%jàh&h)h+hQh-}r@(h/]h0]h1]h2]h4]uh6Nh7hh]rA(hD)rB}rC(h$X Type: BOOLrDh%j>h&h)h+hHh-}rE(h/]h0]h1]h2]h4]uh6K“h]rFh@X Type: BOOLrG…rH}rI(h$jDh%jBubaubhD)rJ}rK(h$X#Readable from: vcl_backend_responserLh%j>h&h)h+hHh-}rM(h/]h0]h1]h2]h4]uh6K•h]rNh@X#Readable from: vcl_backend_responserO…rP}rQ(h$jLh%jJubaubhD)rR}rS(h$X%Writeable frome: vcl_backend_responserTh%j>h&h)h+hHh-}rU(h/]h0]h1]h2]h4]uh6K—h]rVh@X%Writeable frome: vcl_backend_responserW…rX}rY(h$jTh%jRubaubhD)rZ}r[(h$X¥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.r\h%j>h&h)h+hHh-}r](h/]h0]h1]h2]h4]uh6Kšh]r^h@X¥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.r_…r`}ra(h$j\h%jZubaubeubhD)rb}rc(h$Xberesp.do_gunziprdh%jàh&h)h+hHh-}re(h/]h0]h1]h2]h4]uh6K h7hh]rfh@Xberesp.do_gunziprg…rh}ri(h$jdh%jbubaubhN)rj}rk(h$Uh%jàh&h)h+hQh-}rl(h/]h0]h1]h2]h4]uh6Nh7hh]rm(hD)rn}ro(h$X Type: BOOLrph%jjh&h)h+hHh-}rq(h/]h0]h1]h2]h4]uh6K¢h]rrh@X Type: BOOLrs…rt}ru(h$jph%jnubaubhD)rv}rw(h$X#Readable from: vcl_backend_responserxh%jjh&h)h+hHh-}ry(h/]h0]h1]h2]h4]uh6K¤h]rzh@X#Readable from: vcl_backend_responser{…r|}r}(h$jxh%jvubaubhD)r~}r(h$X%Writeable frome: vcl_backend_responser€h%jjh&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6K¦h]r‚h@X%Writeable frome: vcl_backend_responserƒ…r„}r…(h$j€h%j~ubaubhD)r†}r‡(h$XMBoolean. Unzip the object before storing it in the cache. Defaults to false.rˆh%jjh&h)h+hHh-}r‰(h/]h0]h1]h2]h4]uh6K©h]rŠh@XMBoolean. Unzip the object before storing it in the cache. Defaults to false.r‹…rŒ}r(h$jˆh%j†ubaubeubhD)rŽ}r(h$Xberesp.do_gziprh%jàh&h)h+hHh-}r‘(h/]h0]h1]h2]h4]uh6K­h7hh]r’h@Xberesp.do_gzipr“…r”}r•(h$jh%jŽubaubhN)r–}r—(h$Uh%jàh&h)h+hQh-}r˜(h/]h0]h1]h2]h4]uh6Nh7hh]r™(hD)rš}r›(h$X Type: BOOLrœh%j–h&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6K¯h]ržh@X Type: BOOLrŸ…r }r¡(h$jœh%jšubaubhD)r¢}r£(h$X#Readable from: vcl_backend_responser¤h%j–h&h)h+hHh-}r¥(h/]h0]h1]h2]h4]uh6K±h]r¦h@X#Readable from: vcl_backend_responser§…r¨}r©(h$j¤h%j¢ubaubhD)rª}r«(h$X%Writeable frome: vcl_backend_responser¬h%j–h&h)h+hHh-}r­(h/]h0]h1]h2]h4]uh6K³h]r®h@X%Writeable frome: vcl_backend_responser¯…r°}r±(h$j¬h%jªubaubhD)r²}r³(h$XÎ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.r´h%j–h&h)h+hHh-}rµ(h/]h0]h1]h2]h4]uh6K¶h]r¶h@XÎ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.r·…r¸}r¹(h$j´h%j²ubaubeubhD)rº}r»(h$Xberesp.do_streamr¼h%jàh&h)h+hHh-}r½(h/]h0]h1]h2]h4]uh6K¼h7hh]r¾h@Xberesp.do_streamr¿…rÀ}rÁ(h$j¼h%jºubaubhN)rÂ}rÃ(h$Uh%jàh&h)h+hQh-}rÄ(h/]h0]h1]h2]h4]uh6Nh7hh]rÅ(hD)rÆ}rÇ(h$X Type: BOOLrÈh%jÂh&h)h+hHh-}rÉ(h/]h0]h1]h2]h4]uh6K¾h]rÊh@X Type: BOOLrË…rÌ}rÍ(h$jÈh%jÆubaubhD)rÎ}rÏ(h$X#Readable from: vcl_backend_responserÐh%jÂh&h)h+hHh-}rÑ(h/]h0]h1]h2]h4]uh6KÀh]rÒh@X#Readable from: vcl_backend_responserÓ…rÔ}rÕ(h$jÐh%jÎubaubhD)rÖ}r×(h$X%Writeable frome: vcl_backend_responserØh%jÂh&h)h+hHh-}rÙ(h/]h0]h1]h2]h4]uh6KÂh]rÚh@X%Writeable frome: vcl_backend_responserÛ…rÜ}rÝ(h$jØh%jÖubaubhD)rÞ}rß(h$XDeliver 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. As of Varnish Cache 3.0 the object will marked as busy as it is delivered so only client can access the object.ràh%jÂh&h)h+hHh-}rá(h/]h0]h1]h2]h4]uh6KÅh]râh@XDeliver 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. As of Varnish Cache 3.0 the object will marked as busy as it is delivered so only client can access the object.rã…rä}rå(h$jàh%jÞubaubeubhD)ræ}rç(h$X beresp.gracerèh%jàh&h)h+hHh-}ré(h/]h0]h1]h2]h4]uh6KÌh7hh]rêh@X beresp.gracerë…rì}rí(h$jèh%jæubaubhN)rî}rï(h$Uh%jàh&h)h+hQh-}rð(h/]h0]h1]h2]h4]uh6Nh7hh]rñ(hD)rò}ró(h$XType: DURATIONrôh%jîh&h)h+hHh-}rõ(h/]h0]h1]h2]h4]uh6KÎh]röh@XType: DURATIONr÷…rø}rù(h$jôh%jòubaubhD)rú}rû(h$X#Readable from: vcl_backend_responserüh%jîh&h)h+hHh-}rý(h/]h0]h1]h2]h4]uh6KÐh]rþh@X#Readable from: vcl_backend_responserÿ…r}r(h$jüh%júubaubhD)r}r(h$X%Writeable frome: vcl_backend_responserh%jîh&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6KÒh]rh@X%Writeable frome: vcl_backend_responser…r}r (h$jh%jubaubhD)r }r (h$X Set to a period to enable grace.r h%jîh&h)h+hHh-}r (h/]h0]h1]h2]h4]uh6KÕh]rh@X Set to a period to enable grace.r…r}r(h$j h%j ubaubeubhD)r}r(h$X beresp.http.rh%jàh&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6KØh7hh]rh@X beresp.http.r…r}r(h$jh%jubaubhN)r}r(h$Uh%jàh&h)h+hQh-}r(h/]h0]h1]h2]h4]uh6Nh7hh]r(hD)r}r(h$X Type: HEADERr h%jh&h)h+hHh-}r!(h/]h0]h1]h2]h4]uh6KÚh]r"h@X Type: HEADERr#…r$}r%(h$j h%jubaubhD)r&}r'(h$X#Readable from: vcl_backend_responser(h%jh&h)h+hHh-}r)(h/]h0]h1]h2]h4]uh6KÜh]r*h@X#Readable from: vcl_backend_responser+…r,}r-(h$j(h%j&ubaubhD)r.}r/(h$X%Writeable frome: vcl_backend_responser0h%jh&h)h+hHh-}r1(h/]h0]h1]h2]h4]uh6KÞh]r2h@X%Writeable frome: vcl_backend_responser3…r4}r5(h$j0h%j.ubaubhD)r6}r7(h$XThe corresponding HTTP header.r8h%jh&h)h+hHh-}r9(h/]h0]h1]h2]h4]uh6Káh]r:h@XThe corresponding HTTP header.r;…r<}r=(h$j8h%j6ubaubeubhD)r>}r?(h$X beresp.keepr@h%jàh&h)h+hHh-}rA(h/]h0]h1]h2]h4]uh6Käh7hh]rBh@X beresp.keeprC…rD}rE(h$j@h%j>ubaubhN)rF}rG(h$Uh%jàh&h)h+hQh-}rH(h/]h0]h1]h2]h4]uh6Nh7hh]rI(hD)rJ}rK(h$XType: DURATIONrLh%jFh&h)h+hHh-}rM(h/]h0]h1]h2]h4]uh6Kæh]rNh@XType: DURATIONrO…rP}rQ(h$jLh%jJubaubhD)rR}rS(h$X#Readable from: vcl_backend_responserTh%jFh&h)h+hHh-}rU(h/]h0]h1]h2]h4]uh6Kèh]rVh@X#Readable from: vcl_backend_responserW…rX}rY(h$jTh%jRubaubhD)rZ}r[(h$X%Writeable frome: vcl_backend_responser\h%jFh&h)h+hHh-}r](h/]h0]h1]h2]h4]uh6Kêh]r^h@X%Writeable frome: vcl_backend_responser_…r`}ra(h$j\h%jZubaubeubhD)rb}rc(h$X beresp.protordh%jàh&h)h+hHh-}re(h/]h0]h1]h2]h4]uh6Kïh7hh]rfh@X beresp.protorg…rh}ri(h$jdh%jbubaubhN)rj}rk(h$Uh%jàh&h)h+hQh-}rl(h/]h0]h1]h2]h4]uh6Nh7hh]rm(hD)rn}ro(h$X Type: STRINGrph%jjh&h)h+hHh-}rq(h/]h0]h1]h2]h4]uh6Kñh]rrh@X Type: STRINGrs…rt}ru(h$jph%jnubaubhD)rv}rw(h$X#Readable from: vcl_backend_responserxh%jjh&h)h+hHh-}ry(h/]h0]h1]h2]h4]uh6Kóh]rzh@X#Readable from: vcl_backend_responser{…r|}r}(h$jxh%jvubaubhD)r~}r(h$X%Writeable frome: vcl_backend_responser€h%jjh&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6Kõh]r‚h@X%Writeable frome: vcl_backend_responserƒ…r„}r…(h$j€h%j~ubaubhD)r†}r‡(h$X8The HTTP protocol version used the backend replied with.rˆh%jjh&h)h+hHh-}r‰(h/]h0]h1]h2]h4]uh6Køh]rŠh@X8The HTTP protocol version used the backend replied with.r‹…rŒ}r(h$jˆh%j†ubaubeubhD)rŽ}r(h$X beresp.reasonrh%jàh&h)h+hHh-}r‘(h/]h0]h1]h2]h4]uh6Kûh7hh]r’h@X beresp.reasonr“…r”}r•(h$jh%jŽubaubhN)r–}r—(h$Uh%jàh&h)h+hQh-}r˜(h/]h0]h1]h2]h4]uh6Nh7hh]r™(hD)rš}r›(h$X Type: STRINGrœh%j–h&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6Kýh]ržh@X Type: STRINGrŸ…r }r¡(h$jœh%jšubaubhD)r¢}r£(h$X#Readable from: vcl_backend_responser¤h%j–h&h)h+hHh-}r¥(h/]h0]h1]h2]h4]uh6Kÿh]r¦h@X#Readable from: vcl_backend_responser§…r¨}r©(h$j¤h%j¢ubaubhD)rª}r«(h$X%Writeable frome: vcl_backend_responser¬h%j–h&h)h+hHh-}r­(h/]h0]h1]h2]h4]uh6Mh]r®h@X%Writeable frome: vcl_backend_responser¯…r°}r±(h$j¬h%jªubaubhD)r²}r³(h$X/The HTTP status message returned by the server.r´h%j–h&h)h+hHh-}rµ(h/]h0]h1]h2]h4]uh6Mh]r¶h@X/The HTTP status message returned by the server.r·…r¸}r¹(h$j´h%j²ubaubeubhD)rº}r»(h$X beresp.statusr¼h%jàh&h)h+hHh-}r½(h/]h0]h1]h2]h4]uh6Mh7hh]r¾h@X beresp.statusr¿…rÀ}rÁ(h$j¼h%jºubaubhN)rÂ}rÃ(h$Uh%jàh&h)h+hQh-}rÄ(h/]h0]h1]h2]h4]uh6Nh7hh]rÅ(hD)rÆ}rÇ(h$X Type: INTrÈh%jÂh&h)h+hHh-}rÉ(h/]h0]h1]h2]h4]uh6M h]rÊh@X Type: INTrË…rÌ}rÍ(h$jÈh%jÆubaubhD)rÎ}rÏ(h$X#Readable from: vcl_backend_responserÐh%jÂh&h)h+hHh-}rÑ(h/]h0]h1]h2]h4]uh6M h]rÒh@X#Readable from: vcl_backend_responserÓ…rÔ}rÕ(h$jÐh%jÎubaubhD)rÖ}r×(h$X%Writeable frome: vcl_backend_responserØh%jÂh&h)h+hHh-}rÙ(h/]h0]h1]h2]h4]uh6M h]rÚh@X%Writeable frome: vcl_backend_responserÛ…rÜ}rÝ(h$jØh%jÖubaubhD)rÞ}rß(h$X,The HTTP status code returned by the server.ràh%jÂh&h)h+hHh-}rá(h/]h0]h1]h2]h4]uh6Mh]râh@X,The HTTP status code returned by the server.rã…rä}rå(h$jàh%jÞubaubeubhD)ræ}rç(h$Xberesp.storagerèh%jàh&h)h+hHh-}ré(h/]h0]h1]h2]h4]uh6Mh7hh]rêh@Xberesp.storagerë…rì}rí(h$jèh%jæubaubhN)rî}rï(h$Uh%jàh&h)h+hQh-}rð(h/]h0]h1]h2]h4]uh6Nh7hh]rñ(hD)rò}ró(h$X Type: STRINGrôh%jîh&h)h+hHh-}rõ(h/]h0]h1]h2]h4]uh6Mh]röh@X Type: STRINGr÷…rø}rù(h$jôh%jòubaubhD)rú}rû(h$X#Readable from: vcl_backend_responserüh%jîh&h)h+hHh-}rý(h/]h0]h1]h2]h4]uh6Mh]rþh@X#Readable from: vcl_backend_responserÿ…r}r(h$jüh%júubaubhD)r}r(h$X%Writeable frome: vcl_backend_responserh%jîh&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6Mh]rh@X%Writeable frome: vcl_backend_responser…r}r (h$jh%jubaubhD)r }r (h$XISet to force Varnish to save this object to a particular storage backend.r h%jîh&h)h+hHh-}r (h/]h0]h1]h2]h4]uh6Mh]rh@XISet to force Varnish to save this object to a particular storage backend.r…r}r(h$j h%j ubaubeubhD)r}r(h$X beresp.ttlrh%jàh&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6M h7hh]rh@X beresp.ttlr…r}r(h$jh%jubaubhN)r}r(h$Uh%jàh&h)h+hQh-}r(h/]h0]h1]h2]h4]uh6Nh7hh]r(hD)r}r(h$XType: DURATIONr h%jh&h)h+hHh-}r!(h/]h0]h1]h2]h4]uh6M"h]r"h@XType: DURATIONr#…r$}r%(h$j h%jubaubhD)r&}r'(h$X#Readable from: vcl_backend_responser(h%jh&h)h+hHh-}r)(h/]h0]h1]h2]h4]uh6M$h]r*h@X#Readable from: vcl_backend_responser+…r,}r-(h$j(h%j&ubaubhD)r.}r/(h$X%Writeable frome: vcl_backend_responser0h%jh&h)h+hHh-}r1(h/]h0]h1]h2]h4]uh6M&h]r2h@X%Writeable frome: vcl_backend_responser3…r4}r5(h$j0h%j.ubaubhD)r6}r7(h$XHThe object's remaining time to live, in seconds. beresp.ttl is writable.r8h%jh&h)h+hHh-}r9(h/]h0]h1]h2]h4]uh6M)h]r:h@XHThe object's remaining time to live, in seconds. beresp.ttl is writable.r;…r<}r=(h$j8h%j6ubaubeubhD)r>}r?(h$Xberesp.uncacheabler@h%jàh&h)h+hHh-}rA(h/]h0]h1]h2]h4]uh6M-h7hh]rBh@Xberesp.uncacheablerC…rD}rE(h$j@h%j>ubaubhN)rF}rG(h$Uh%jàh&h)h+hQh-}rH(h/]h0]h1]h2]h4]uh6Nh7hh]rI(hD)rJ}rK(h$X Type: BOOLrLh%jFh&h)h+hHh-}rM(h/]h0]h1]h2]h4]uh6M/h]rNh@X Type: BOOLrO…rP}rQ(h$jLh%jJubaubhD)rR}rS(h$X#Readable from: vcl_backend_responserTh%jFh&h)h+hHh-}rU(h/]h0]h1]h2]h4]uh6M1h]rVh@X#Readable from: vcl_backend_responserW…rX}rY(h$jTh%jRubaubhD)rZ}r[(h$X%Writeable frome: vcl_backend_responser\h%jFh&h)h+hHh-}r](h/]h0]h1]h2]h4]uh6M3h]r^h@X%Writeable frome: vcl_backend_responser_…r`}ra(h$j\h%jZubaubeubeubh!)rb}rc(h$Uh%hh&h)h+h,h-}rd(h/]h0]h1]h2]rehah4]rfh auh6M9h7hh]rg(h9)rh}ri(h$Xclientrjh%jbh&h)h+h=h-}rk(h/]h0]h1]h2]h4]uh6M9h7hh]rlh@Xclientrm…rn}ro(h$jjh%jhubaubhD)rp}rq(h$Xclient.identityrrh%jbh&h)h+hHh-}rs(h/]h0]h1]h2]h4]uh6M;h7hh]rth@Xclient.identityru…rv}rw(h$jrh%jpubaubhN)rx}ry(h$Uh%jbh&h)h+hQh-}rz(h/]h0]h1]h2]h4]uh6Nh7hh]r{(hD)r|}r}(h$X Type: STRINGr~h%jxh&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6M=h]r€h@X Type: STRINGr…r‚}rƒ(h$j~h%j|ubaubhD)r„}r…(h$XReadable from: client, backendr†h%jxh&h)h+hHh-}r‡(h/]h0]h1]h2]h4]uh6M?h]rˆh@XReadable from: client, backendr‰…rŠ}r‹(h$j†h%j„ubaubhD)rŒ}r(h$X Writeable frome: client, backendrŽh%jxh&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6MAh]rh@X Writeable frome: client, backendr‘…r’}r“(h$jŽh%jŒubaubhD)r”}r•(h$XJIdentification of the client, used to load balance in the client director.r–h%jxh&h)h+hHh-}r—(h/]h0]h1]h2]h4]uh6MDh]r˜h@XJIdentification of the client, used to load balance in the client director.r™…rš}r›(h$j–h%j”ubaubeubhD)rœ}r(h$X client.ipržh%jbh&h)h+hHh-}rŸ(h/]h0]h1]h2]h4]uh6MHh7hh]r h@X client.ipr¡…r¢}r£(h$jžh%jœubaubhN)r¤}r¥(h$Uh%jbh&h)h+hQh-}r¦(h/]h0]h1]h2]h4]uh6Nh7hh]r§(hD)r¨}r©(h$XType: IPrªh%j¤h&h)h+hHh-}r«(h/]h0]h1]h2]h4]uh6MJh]r¬h@XType: IPr­…r®}r¯(h$jªh%j¨ubaubhD)r°}r±(h$XReadable from: client, backendr²h%j¤h&h)h+hHh-}r³(h/]h0]h1]h2]h4]uh6MLh]r´h@XReadable from: client, backendrµ…r¶}r·(h$j²h%j°ubaubhD)r¸}r¹(h$XThe client's IP address.rºh%j¤h&h)h+hHh-}r»(h/]h0]h1]h2]h4]uh6MOh]r¼h@XThe client's IP address.r½…r¾}r¿(h$jºh%j¸ubaubeubeubh!)rÀ}rÁ(h$Uh%hh&h)h+h,h-}rÂ(h/]h0]h1]h2]rÃhah4]rÄh auh6MSh7hh]rÅ(h9)rÆ}rÇ(h$XnowrÈh%jÀh&h)h+h=h-}rÉ(h/]h0]h1]h2]h4]uh6MSh7hh]rÊh@XnowrË…rÌ}rÍ(h$jÈh%jÆubaubhD)rÎ}rÏ(h$XnowrÐh%jÀh&h)h+hHh-}rÑ(h/]h0]h1]h2]h4]uh6MUh7hh]rÒh@XnowrÓ…rÔ}rÕ(h$jÐh%jÎubaubhN)rÖ}r×(h$Uh%jÀh&h)h+hQh-}rØ(h/]h0]h1]h2]h4]uh6Nh7hh]rÙ(hD)rÚ}rÛ(h$X Type: TIMErÜh%jÖh&h)h+hHh-}rÝ(h/]h0]h1]h2]h4]uh6MWh]rÞh@X Type: TIMErß…rà}rá(h$jÜh%jÚubaubhD)râ}rã(h$XReadable from: vcl_allräh%jÖh&h)h+hHh-}rå(h/]h0]h1]h2]h4]uh6MYh]ræh@XReadable from: vcl_allrç…rè}ré(h$jäh%jâubaubhD)rê}rë(h$XhThe current time, in seconds since the epoch. When used in string context it returns a formatted string.rìh%jÖh&h)h+hHh-}rí(h/]h0]h1]h2]h4]uh6M\h]rîh@XhThe current time, in seconds since the epoch. When used in string context it returns a formatted string.rï…rð}rñ(h$jìh%jêubaubeubeubh!)rò}ró(h$Uh%hh&h)h+h,h-}rô(h/]h0]h1]h2]rõhah4]röhauh6Mah7hh]r÷(h9)rø}rù(h$Xobjrúh%jòh&h)h+h=h-}rû(h/]h0]h1]h2]h4]uh6Mah7hh]rüh@Xobjrý…rþ}rÿ(h$júh%jøubaubhD)r}r(h$X obj.gracerh%jòh&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6Mch7hh]rh@X obj.gracer…r}r(h$jh%jubaubhN)r}r (h$Uh%jòh&h)h+hQh-}r (h/]h0]h1]h2]h4]uh6Nh7hh]r (hD)r }r (h$XType: DURATIONrh%jh&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6Meh]rh@XType: DURATIONr…r}r(h$jh%j ubaubhD)r}r(h$X!Readable from: vcl_hit, vcl_errorrh%jh&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6Mgh]rh@X!Readable from: vcl_hit, vcl_errorr…r}r(h$jh%jubaubhD)r}r(h$X#Writeable frome: vcl_hit, vcl_errorrh%jh&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6Mih]r h@X#Writeable frome: vcl_hit, vcl_errorr!…r"}r#(h$jh%jubaubhD)r$}r%(h$X<The object's grace period in seconds. obj.grace is writable.r&h%jh&h)h+hHh-}r'(h/]h0]h1]h2]h4]uh6Mlh]r(h@X<The object's grace period in seconds. obj.grace is writable.r)…r*}r+(h$j&h%j$ubaubeubhD)r,}r-(h$Xobj.hitsr.h%jòh&h)h+hHh-}r/(h/]h0]h1]h2]h4]uh6Moh7hh]r0h@Xobj.hitsr1…r2}r3(h$j.h%j,ubaubhN)r4}r5(h$Uh%jòh&h)h+hQh-}r6(h/]h0]h1]h2]h4]uh6Nh7hh]r7(hD)r8}r9(h$X Type: INTr:h%j4h&h)h+hHh-}r;(h/]h0]h1]h2]h4]uh6Mqh]r<h@X Type: INTr=…r>}r?(h$j:h%j8ubaubhD)r@}rA(h$X#Readable from: vcl_hit, vcl_deliverrBh%j4h&h)h+hHh-}rC(h/]h0]h1]h2]h4]uh6Msh]rDh@X#Readable from: vcl_hit, vcl_deliverrE…rF}rG(h$jBh%j@ubaubhD)rH}rI(h$X%Writeable frome: vcl_hit, vcl_deliverrJh%j4h&h)h+hHh-}rK(h/]h0]h1]h2]h4]uh6Muh]rLh@X%Writeable frome: vcl_hit, vcl_deliverrM…rN}rO(h$jJh%jHubaubhD)rP}rQ(h$X“The approximate number of times the object has been delivered. A value of 0 indicates a cache miss. This variable is also available in vcl_deliver.rRh%j4h&h)h+hHh-}rS(h/]h0]h1]h2]h4]uh6Mxh]rTh@X“The approximate number of times the object has been delivered. A value of 0 indicates a cache miss. This variable is also available in vcl_deliver.rU…rV}rW(h$jRh%jPubaubeubhD)rX}rY(h$X obj.http.rZh%jòh&h)h+hHh-}r[(h/]h0]h1]h2]h4]uh6M}h7hh]r\h@X obj.http.r]…r^}r_(h$jZh%jXubaubhN)r`}ra(h$Uh%jòh&h)h+hQh-}rb(h/]h0]h1]h2]h4]uh6Nh7hh]rc(hD)rd}re(h$X Type: HEADERrfh%j`h&h)h+hHh-}rg(h/]h0]h1]h2]h4]uh6Mh]rhh@X Type: HEADERri…rj}rk(h$jfh%jdubaubhD)rl}rm(h$X!Readable from: vcl_hit, vcl_errorrnh%j`h&h)h+hHh-}ro(h/]h0]h1]h2]h4]uh6Mh]rph@X!Readable from: vcl_hit, vcl_errorrq…rr}rs(h$jnh%jlubaubhD)rt}ru(h$XWriteable frome: vcl_errorrvh%j`h&h)h+hHh-}rw(h/]h0]h1]h2]h4]uh6Mƒh]rxh@XWriteable frome: vcl_errorry…rz}r{(h$jvh%jtubaubhD)r|}r}(h$XThe corresponding HTTP header.r~h%j`h&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6M†h]r€h@XThe corresponding HTTP header.r…r‚}rƒ(h$j~h%j|ubaubeubhD)r„}r…(h$Xobj.keepr†h%jòh&h)h+hHh-}r‡(h/]h0]h1]h2]h4]uh6M‰h7hh]rˆh@Xobj.keepr‰…rŠ}r‹(h$j†h%j„ubaubhN)rŒ}r(h$Uh%jòh&h)h+hQh-}rŽ(h/]h0]h1]h2]h4]uh6Nh7hh]r(hD)r}r‘(h$XType: DURATIONr’h%jŒh&h)h+hHh-}r“(h/]h0]h1]h2]h4]uh6M‹h]r”h@XType: DURATIONr•…r–}r—(h$j’h%jubaubhD)r˜}r™(h$X!Readable from: vcl_hit, vcl_errorršh%jŒh&h)h+hHh-}r›(h/]h0]h1]h2]h4]uh6Mh]rœh@X!Readable from: vcl_hit, vcl_errorr…rž}rŸ(h$jšh%j˜ubaubhD)r }r¡(h$X#Writeable frome: vcl_hit, vcl_errorr¢h%jŒh&h)h+hHh-}r£(h/]h0]h1]h2]h4]uh6Mh]r¤h@X#Writeable frome: vcl_hit, vcl_errorr¥…r¦}r§(h$j¢h%j ubaubeubhD)r¨}r©(h$X obj.last_userªh%jòh&h)h+hHh-}r«(h/]h0]h1]h2]h4]uh6M”h7hh]r¬h@X obj.last_user­…r®}r¯(h$jªh%j¨ubaubhN)r°}r±(h$Uh%jòh&h)h+hQh-}r²(h/]h0]h1]h2]h4]uh6Nh7hh]r³(hD)r´}rµ(h$X Type: TIMEr¶h%j°h&h)h+hHh-}r·(h/]h0]h1]h2]h4]uh6M–h]r¸h@X Type: TIMEr¹…rº}r»(h$j¶h%j´ubaubhD)r¼}r½(h$X#Readable from: vcl_hit, vcl_deliverr¾h%j°h&h)h+hHh-}r¿(h/]h0]h1]h2]h4]uh6M˜h]rÀh@X#Readable from: vcl_hit, vcl_deliverrÁ…rÂ}rÃ(h$j¾h%j¼ubaubhD)rÄ}rÅ(h$X%Writeable frome: vcl_hit, vcl_deliverrÆh%j°h&h)h+hHh-}rÇ(h/]h0]h1]h2]h4]uh6Mšh]rÈh@X%Writeable frome: vcl_hit, vcl_deliverrÉ…rÊ}rË(h$jÆh%jÄubaubhD)rÌ}rÍ(h$X|The approximate time elapsed since the object was last requests, in seconds. This variable is also available in vcl_deliver.rÎh%j°h&h)h+hHh-}rÏ(h/]h0]h1]h2]h4]uh6Mh]rÐh@X|The approximate time elapsed since the object was last requests, in seconds. This variable is also available in vcl_deliver.rÑ…rÒ}rÓ(h$jÎh%jÌubaubeubhD)rÔ}rÕ(h$X obj.protorÖh%jòh&h)h+hHh-}r×(h/]h0]h1]h2]h4]uh6M¢h7hh]rØh@X obj.protorÙ…rÚ}rÛ(h$jÖh%jÔubaubhN)rÜ}rÝ(h$Uh%jòh&h)h+hQh-}rÞ(h/]h0]h1]h2]h4]uh6Nh7hh]rß(hD)rà}rá(h$X Type: STRINGrâh%jÜh&h)h+hHh-}rã(h/]h0]h1]h2]h4]uh6M¤h]räh@X Type: STRINGrå…ræ}rç(h$jâh%jàubaubhD)rè}ré(h$X!Readable from: vcl_hit, vcl_errorrêh%jÜh&h)h+hHh-}rë(h/]h0]h1]h2]h4]uh6M¦h]rìh@X!Readable from: vcl_hit, vcl_errorrí…rî}rï(h$jêh%jèubaubhD)rð}rñ(h$X#Writeable frome: vcl_hit, vcl_errorròh%jÜh&h)h+hHh-}ró(h/]h0]h1]h2]h4]uh6M¨h]rôh@X#Writeable frome: vcl_hit, vcl_errorrõ…rö}r÷(h$jòh%jðubaubhD)rø}rù(h$X=The HTTP protocol version used when the object was retrieved.rúh%jÜh&h)h+hHh-}rû(h/]h0]h1]h2]h4]uh6M«h]rüh@X=The HTTP protocol version used when the object was retrieved.rý…rþ}rÿ(h$júh%jøubaubeubhD)r}r(h$X obj.reasonrh%jòh&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6M®h7hh]rh@X obj.reasonr…r}r(h$jh%jubaubhN)r}r (h$Uh%jòh&h)h+hQh-}r (h/]h0]h1]h2]h4]uh6Nh7hh]r (hD)r }r (h$X Type: STRINGrh%jh&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6M°h]rh@X Type: STRINGr…r}r(h$jh%j ubaubhD)r}r(h$XReadable from: vcl_errorrh%jh&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6M²h]rh@XReadable from: vcl_errorr…r}r(h$jh%jubaubhD)r}r(h$XWriteable frome: vcl_errorrh%jh&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6M´h]r h@XWriteable frome: vcl_errorr!…r"}r#(h$jh%jubaubhD)r$}r%(h$X/The HTTP status message returned by the server.r&h%jh&h)h+hHh-}r'(h/]h0]h1]h2]h4]uh6M·h]r(h@X/The HTTP status message returned by the server.r)…r*}r+(h$j&h%j$ubaubeubhD)r,}r-(h$X obj.statusr.h%jòh&h)h+hHh-}r/(h/]h0]h1]h2]h4]uh6Mºh7hh]r0h@X obj.statusr1…r2}r3(h$j.h%j,ubaubhN)r4}r5(h$Uh%jòh&h)h+hQh-}r6(h/]h0]h1]h2]h4]uh6Nh7hh]r7(hD)r8}r9(h$X Type: INTr:h%j4h&h)h+hHh-}r;(h/]h0]h1]h2]h4]uh6M¼h]r<h@X Type: INTr=…r>}r?(h$j:h%j8ubaubhD)r@}rA(h$XReadable from: vcl_errorrBh%j4h&h)h+hHh-}rC(h/]h0]h1]h2]h4]uh6M¾h]rDh@XReadable from: vcl_errorrE…rF}rG(h$jBh%j@ubaubhD)rH}rI(h$XWriteable frome: vcl_errorrJh%j4h&h)h+hHh-}rK(h/]h0]h1]h2]h4]uh6MÀh]rLh@XWriteable frome: vcl_errorrM…rN}rO(h$jJh%jHubaubhD)rP}rQ(h$X,The HTTP status code returned by the server.rRh%j4h&h)h+hHh-}rS(h/]h0]h1]h2]h4]uh6MÃh]rTh@X,The HTTP status code returned by the server.rU…rV}rW(h$jRh%jPubaubeubhD)rX}rY(h$Xobj.ttlrZh%jòh&h)h+hHh-}r[(h/]h0]h1]h2]h4]uh6MÆh7hh]r\h@Xobj.ttlr]…r^}r_(h$jZh%jXubaubhN)r`}ra(h$Uh%jòh&h)h+hQh-}rb(h/]h0]h1]h2]h4]uh6Nh7hh]rc(hD)rd}re(h$XType: DURATIONrfh%j`h&h)h+hHh-}rg(h/]h0]h1]h2]h4]uh6MÈh]rhh@XType: DURATIONri…rj}rk(h$jfh%jdubaubhD)rl}rm(h$X!Readable from: vcl_hit, vcl_errorrnh%j`h&h)h+hHh-}ro(h/]h0]h1]h2]h4]uh6MÊh]rph@X!Readable from: vcl_hit, vcl_errorrq…rr}rs(h$jnh%jlubaubhD)rt}ru(h$X#Writeable frome: vcl_hit, vcl_errorrvh%j`h&h)h+hHh-}rw(h/]h0]h1]h2]h4]uh6MÌh]rxh@X#Writeable frome: vcl_hit, vcl_errorry…rz}r{(h$jvh%jtubaubhD)r|}r}(h$XEThe object's remaining time to live, in seconds. obj.ttl is writable.r~h%j`h&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6MÏh]r€h@XEThe object's remaining time to live, in seconds. obj.ttl is writable.r…r‚}rƒ(h$j~h%j|ubaubeubhD)r„}r…(h$Xobj.uncacheabler†h%jòh&h)h+hHh-}r‡(h/]h0]h1]h2]h4]uh6MÓh7hh]rˆh@Xobj.uncacheabler‰…rŠ}r‹(h$j†h%j„ubaubhN)rŒ}r(h$Uh%jòh&h)h+hQh-}rŽ(h/]h0]h1]h2]h4]uh6Nh7hh]r(hD)r}r‘(h$X Type: BOOLr’h%jŒh&h)h+hHh-}r“(h/]h0]h1]h2]h4]uh6MÕh]r”h@X Type: BOOLr•…r–}r—(h$j’h%jubaubhD)r˜}r™(h$X.Readable from: vcl_hit, vcl_deliver, vcl_errorršh%jŒh&h)h+hHh-}r›(h/]h0]h1]h2]h4]uh6M×h]rœh@X.Readable from: vcl_hit, vcl_deliver, vcl_errorr…rž}rŸ(h$jšh%j˜ubaubeubeubh!)r }r¡(h$Uh%hh&h)h+h,h-}r¢(h/]h0]h1]h2]r£hah4]r¤h auh6MÝh7hh]r¥(h9)r¦}r§(h$Xreqr¨h%j h&h)h+h=h-}r©(h/]h0]h1]h2]h4]uh6MÝh7hh]rªh@Xreqr«…r¬}r­(h$j¨h%j¦ubaubhD)r®}r¯(h$X req.backendr°h%j h&h)h+hHh-}r±(h/]h0]h1]h2]h4]uh6Mßh7hh]r²h@X req.backendr³…r´}rµ(h$j°h%j®ubaubhN)r¶}r·(h$Uh%j h&h)h+hQh-}r¸(h/]h0]h1]h2]h4]uh6Nh7hh]r¹(hD)rº}r»(h$X Type: BACKENDr¼h%j¶h&h)h+hHh-}r½(h/]h0]h1]h2]h4]uh6Máh]r¾h@X Type: BACKENDr¿…rÀ}rÁ(h$j¼h%jºubaubhD)rÂ}rÃ(h$XReadable from: clientrÄh%j¶h&h)h+hHh-}rÅ(h/]h0]h1]h2]h4]uh6Mãh]rÆh@XReadable from: clientrÇ…rÈ}rÉ(h$jÄh%jÂubaubhD)rÊ}rË(h$XWriteable frome: clientrÌh%j¶h&h)h+hHh-}rÍ(h/]h0]h1]h2]h4]uh6Måh]rÎh@XWriteable frome: clientrÏ…rÐ}rÑ(h$jÌh%jÊubaubhD)rÒ}rÓ(h$X*The backend to use to service the request.rÔh%j¶h&h)h+hHh-}rÕ(h/]h0]h1]h2]h4]uh6Mèh]rÖh@X*The backend to use to service the request.r×…rØ}rÙ(h$jÔh%jÒubaubeubhD)rÚ}rÛ(h$X req.can_gziprÜh%j h&h)h+hHh-}rÝ(h/]h0]h1]h2]h4]uh6Mëh7hh]rÞh@X req.can_gziprß…rà}rá(h$jÜh%jÚubaubhN)râ}rã(h$Uh%j h&h)h+hQh-}rä(h/]h0]h1]h2]h4]uh6Nh7hh]rå(hD)ræ}rç(h$X Type: BOOLrèh%jâh&h)h+hHh-}ré(h/]h0]h1]h2]h4]uh6Míh]rêh@X Type: BOOLrë…rì}rí(h$jèh%jæubaubhD)rî}rï(h$XReadable from: clientrðh%jâh&h)h+hHh-}rñ(h/]h0]h1]h2]h4]uh6Mïh]ròh@XReadable from: clientró…rô}rõ(h$jðh%jîubaubhD)rö}r÷(h$X2Does the client accept the gzip transfer encoding.røh%jâh&h)h+hHh-}rù(h/]h0]h1]h2]h4]uh6Mòh]rúh@X2Does the client accept the gzip transfer encoding.rû…rü}rý(h$jøh%jöubaubeubhD)rþ}rÿ(h$Xreq.esirh%j h&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6Mõh7hh]rh@Xreq.esir…r}r(h$jh%jþubaubhN)r}r(h$Uh%j h&h)h+hQh-}r(h/]h0]h1]h2]h4]uh6Nh7hh]r (hD)r }r (h$X Type: BOOLr h%jh&h)h+hHh-}r (h/]h0]h1]h2]h4]uh6M÷h]rh@X Type: BOOLr…r}r(h$j h%j ubaubhD)r}r(h$XEReadable from: vcl_recv, vcl_backend_response, vcl_deliver, vcl_errorrh%jh&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6Mùh]rh@XEReadable from: vcl_recv, vcl_backend_response, vcl_deliver, vcl_errorr…r}r(h$jh%jubaubhD)r}r(h$XGWriteable frome: vcl_recv, vcl_backend_response, vcl_deliver, vcl_errorrh%jh&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6Mûh]rh@XGWriteable frome: vcl_recv, vcl_backend_response, vcl_deliver, vcl_errorr…r }r!(h$jh%jubaubhD)r"}r#(h$X½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.r$h%jh&h)h+hHh-}r%(h/]h0]h1]h2]h4]uh6Mþh]r&h@X½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.r'…r(}r)(h$j$h%j"ubaubeubhD)r*}r+(h$X req.esi_levelr,h%j h&h)h+hHh-}r-(h/]h0]h1]h2]h4]uh6Mh7hh]r.h@X req.esi_levelr/…r0}r1(h$j,h%j*ubaubhN)r2}r3(h$Uh%j h&h)h+hQh-}r4(h/]h0]h1]h2]h4]uh6Nh7hh]r5(hD)r6}r7(h$X Type: INTr8h%j2h&h)h+hHh-}r9(h/]h0]h1]h2]h4]uh6Mh]r:h@X Type: INTr;…r<}r=(h$j8h%j6ubaubhD)r>}r?(h$XReadable from: clientr@h%j2h&h)h+hHh-}rA(h/]h0]h1]h2]h4]uh6Mh]rBh@XReadable from: clientrC…rD}rE(h$j@h%j>ubaubhD)rF}rG(h$X>A count of how many levels of ESI requests we're currently at.rHh%j2h&h)h+hHh-}rI(h/]h0]h1]h2]h4]uh6M h]rJh@X>A count of how many levels of ESI requests we're currently at.rK…rL}rM(h$jHh%jFubaubeubhD)rN}rO(h$Xreq.hash_always_missrPh%j h&h)h+hHh-}rQ(h/]h0]h1]h2]h4]uh6Mh7hh]rRh@Xreq.hash_always_missrS…rT}rU(h$jPh%jNubaubhN)rV}rW(h$Uh%j h&h)h+hQh-}rX(h/]h0]h1]h2]h4]uh6Nh7hh]rY(hD)rZ}r[(h$X Type: BOOLr\h%jVh&h)h+hHh-}r](h/]h0]h1]h2]h4]uh6Mh]r^h@X Type: BOOLr_…r`}ra(h$j\h%jZubaubhD)rb}rc(h$XReadable from: vcl_recvrdh%jVh&h)h+hHh-}re(h/]h0]h1]h2]h4]uh6Mh]rfh@XReadable from: vcl_recvrg…rh}ri(h$jdh%jbubaubhD)rj}rk(h$XWriteable frome: vcl_recvrlh%jVh&h)h+hHh-}rm(h/]h0]h1]h2]h4]uh6Mh]rnh@XWriteable frome: vcl_recvro…rp}rq(h$jlh%jjubaubhD)rr}rs(h$X†Force a cache miss for this request. If set to true Varnish will disregard any existing objects and always (re)fetch from the backend.rth%jVh&h)h+hHh-}ru(h/]h0]h1]h2]h4]uh6Mh]rvh@X†Force a cache miss for this request. If set to true Varnish will disregard any existing objects and always (re)fetch from the backend.rw…rx}ry(h$jth%jrubaubeubhD)rz}r{(h$Xreq.hash_ignore_busyr|h%j h&h)h+hHh-}r}(h/]h0]h1]h2]h4]uh6Mh7hh]r~h@Xreq.hash_ignore_busyr…r€}r(h$j|h%jzubaubhN)r‚}rƒ(h$Uh%j h&h)h+hQh-}r„(h/]h0]h1]h2]h4]uh6Nh7hh]r…(hD)r†}r‡(h$X Type: BOOLrˆh%j‚h&h)h+hHh-}r‰(h/]h0]h1]h2]h4]uh6Mh]rŠh@X Type: BOOLr‹…rŒ}r(h$jˆh%j†ubaubhD)rŽ}r(h$XReadable from: vcl_recvrh%j‚h&h)h+hHh-}r‘(h/]h0]h1]h2]h4]uh6M h]r’h@XReadable from: vcl_recvr“…r”}r•(h$jh%jŽubaubhD)r–}r—(h$XWriteable frome: vcl_recvr˜h%j‚h&h)h+hHh-}r™(h/]h0]h1]h2]h4]uh6M"h]ršh@XWriteable frome: vcl_recvr›…rœ}r(h$j˜h%j–ubaubhD)rž}rŸ(h$XIgnore 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.r h%j‚h&h)h+hHh-}r¡(h/]h0]h1]h2]h4]uh6M%h]r¢h@XIgnore 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.r£…r¤}r¥(h$j h%jžubaubeubhD)r¦}r§(h$X req.http.r¨h%j h&h)h+hHh-}r©(h/]h0]h1]h2]h4]uh6M*h7hh]rªh@X req.http.r«…r¬}r­(h$j¨h%j¦ubaubhN)r®}r¯(h$Uh%j h&h)h+hQh-}r°(h/]h0]h1]h2]h4]uh6Nh7hh]r±(hD)r²}r³(h$X Type: HEADERr´h%j®h&h)h+hHh-}rµ(h/]h0]h1]h2]h4]uh6M,h]r¶h@X Type: HEADERr·…r¸}r¹(h$j´h%j²ubaubhD)rº}r»(h$XReadable from: clientr¼h%j®h&h)h+hHh-}r½(h/]h0]h1]h2]h4]uh6M.h]r¾h@XReadable from: clientr¿…rÀ}rÁ(h$j¼h%jºubaubhD)rÂ}rÃ(h$XWriteable frome: clientrÄh%j®h&h)h+hHh-}rÅ(h/]h0]h1]h2]h4]uh6M0h]rÆh@XWriteable frome: clientrÇ…rÈ}rÉ(h$jÄh%jÂubaubhD)rÊ}rË(h$XThe corresponding HTTP header.rÌh%j®h&h)h+hHh-}rÍ(h/]h0]h1]h2]h4]uh6M3h]rÎh@XThe corresponding HTTP header.rÏ…rÐ}rÑ(h$jÌh%jÊubaubeubhD)rÒ}rÓ(h$X req.methodrÔh%j h&h)h+hHh-}rÕ(h/]h0]h1]h2]h4]uh6M6h7hh]rÖh@X req.methodr×…rØ}rÙ(h$jÔh%jÒubaubhN)rÚ}rÛ(h$Uh%j h&h)h+hQh-}rÜ(h/]h0]h1]h2]h4]uh6Nh7hh]rÝ(hD)rÞ}rß(h$X Type: STRINGràh%jÚh&h)h+hHh-}rá(h/]h0]h1]h2]h4]uh6M8h]râh@X Type: STRINGrã…rä}rå(h$jàh%jÞubaubhD)ræ}rç(h$XReadable from: clientrèh%jÚh&h)h+hHh-}ré(h/]h0]h1]h2]h4]uh6M:h]rêh@XReadable from: clientrë…rì}rí(h$jèh%jæubaubhD)rî}rï(h$XWriteable frome: clientrðh%jÚh&h)h+hHh-}rñ(h/]h0]h1]h2]h4]uh6M<h]ròh@XWriteable frome: clientró…rô}rõ(h$jðh%jîubaubhD)rö}r÷(h$X&The request type (e.g. "GET", "HEAD").røh%jÚh&h)h+hHh-}rù(h/]h0]h1]h2]h4]uh6M?h]rúh@X&The request type (e.g. "GET", "HEAD").rû…rü}rý(h$jøh%jöubaubeubhD)rþ}rÿ(h$X req.protorh%j h&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6MBh7hh]rh@X req.protor…r}r(h$jh%jþubaubhN)r}r(h$Uh%j h&h)h+hQh-}r(h/]h0]h1]h2]h4]uh6Nh7hh]r (hD)r }r (h$X Type: STRINGr h%jh&h)h+hHh-}r (h/]h0]h1]h2]h4]uh6MDh]rh@X Type: STRINGr…r}r(h$j h%j ubaubhD)r}r(h$XReadable from: clientrh%jh&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6MFh]rh@XReadable from: clientr…r}r(h$jh%jubaubhD)r}r(h$XWriteable frome: clientrh%jh&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6MHh]rh@XWriteable frome: clientr…r }r!(h$jh%jubaubhD)r"}r#(h$X-The HTTP protocol version used by the client.r$h%jh&h)h+hHh-}r%(h/]h0]h1]h2]h4]uh6MKh]r&h@X-The HTTP protocol version used by the client.r'…r(}r)(h$j$h%j"ubaubeubhD)r*}r+(h$X req.restartsr,h%j h&h)h+hHh-}r-(h/]h0]h1]h2]h4]uh6MNh7hh]r.h@X req.restartsr/…r0}r1(h$j,h%j*ubaubhN)r2}r3(h$Uh%j h&h)h+hQh-}r4(h/]h0]h1]h2]h4]uh6Nh7hh]r5(hD)r6}r7(h$X Type: INTr8h%j2h&h)h+hHh-}r9(h/]h0]h1]h2]h4]uh6MPh]r:h@X Type: INTr;…r<}r=(h$j8h%j6ubaubhD)r>}r?(h$XReadable from: clientr@h%j2h&h)h+hHh-}rA(h/]h0]h1]h2]h4]uh6MRh]rBh@XReadable from: clientrC…rD}rE(h$j@h%j>ubaubhD)rF}rG(h$X:A count of how many times this request has been restarted.rHh%j2h&h)h+hHh-}rI(h/]h0]h1]h2]h4]uh6MUh]rJh@X:A count of how many times this request has been restarted.rK…rL}rM(h$jHh%jFubaubeubhD)rN}rO(h$Xreq.ttlrPh%j h&h)h+hHh-}rQ(h/]h0]h1]h2]h4]uh6MXh7hh]rRh@Xreq.ttlrS…rT}rU(h$jPh%jNubaubhN)rV}rW(h$Uh%j h&h)h+hQh-}rX(h/]h0]h1]h2]h4]uh6Nh7hh]rY(hD)rZ}r[(h$XType: DURATIONr\h%jVh&h)h+hHh-}r](h/]h0]h1]h2]h4]uh6MZh]r^h@XType: DURATIONr_…r`}ra(h$j\h%jZubaubhD)rb}rc(h$XReadable from: clientrdh%jVh&h)h+hHh-}re(h/]h0]h1]h2]h4]uh6M\h]rfh@XReadable from: clientrg…rh}ri(h$jdh%jbubaubhD)rj}rk(h$XWriteable frome: clientrlh%jVh&h)h+hHh-}rm(h/]h0]h1]h2]h4]uh6M^h]rnh@XWriteable frome: clientro…rp}rq(h$jlh%jjubaubeubhD)rr}rs(h$Xreq.urlrth%j h&h)h+hHh-}ru(h/]h0]h1]h2]h4]uh6Mch7hh]rvh@Xreq.urlrw…rx}ry(h$jth%jrubaubhN)rz}r{(h$Uh%j h&h)h+hQh-}r|(h/]h0]h1]h2]h4]uh6Nh7hh]r}(hD)r~}r(h$X Type: STRINGr€h%jzh&h)h+hHh-}r(h/]h0]h1]h2]h4]uh6Meh]r‚h@X Type: STRINGrƒ…r„}r…(h$j€h%j~ubaubhD)r†}r‡(h$XReadable from: clientrˆh%jzh&h)h+hHh-}r‰(h/]h0]h1]h2]h4]uh6Mgh]rŠh@XReadable from: clientr‹…rŒ}r(h$jˆh%j†ubaubhD)rŽ}r(h$XWriteable frome: clientrh%jzh&h)h+hHh-}r‘(h/]h0]h1]h2]h4]uh6Mih]r’h@XWriteable frome: clientr“…r”}r•(h$jh%jŽubaubhD)r–}r—(h$XThe requested URL.r˜h%jzh&h)h+hHh-}r™(h/]h0]h1]h2]h4]uh6Mlh]ršh@XThe requested URL.r›…rœ}r(h$j˜h%j–ubaubeubhD)rž}rŸ(h$Xreq.xidr h%j h&h)h+hHh-}r¡(h/]h0]h1]h2]h4]uh6Moh7hh]r¢h@Xreq.xidr£…r¤}r¥(h$j h%jžubaubhN)r¦}r§(h$Uh%j h&h)h+hQh-}r¨(h/]h0]h1]h2]h4]uh6Nh7hh]r©(hD)rª}r«(h$X Type: STRINGr¬h%j¦h&h)h+hHh-}r­(h/]h0]h1]h2]h4]uh6Mqh]r®h@X Type: STRINGr¯…r°}r±(h$j¬h%jªubaubhD)r²}r³(h$XReadable from: clientr´h%j¦h&h)h+hHh-}rµ(h/]h0]h1]h2]h4]uh6Msh]r¶h@XReadable from: clientr·…r¸}r¹(h$j´h%j²ubaubhD)rº}r»(h$XUnique ID of this request.r¼h%j¦h&h)h+hHh-}r½(h/]h0]h1]h2]h4]uh6Mvh]r¾h@XUnique ID of this request.r¿…rÀ}rÁ(h$j¼h%jºubaubeubeubh!)rÂ}rÃ(h$Uh%hh&h)h+h,h-}rÄ(h/]h0]h1]h2]rÅhah4]rÆh auh6Mzh7hh]rÇ(h9)rÈ}rÉ(h$XresprÊh%jÂh&h)h+h=h-}rË(h/]h0]h1]h2]h4]uh6Mzh7hh]rÌh@XresprÍ…rÎ}rÏ(h$jÊh%jÈubaubhD)rÐ}rÑ(h$X resp.http.rÒh%jÂh&h)h+hHh-}rÓ(h/]h0]h1]h2]h4]uh6M|h7hh]rÔh@X resp.http.rÕ…rÖ}r×(h$jÒh%jÐubaubhN)rØ}rÙ(h$Uh%jÂh&h)h+hQh-}rÚ(h/]h0]h1]h2]h4]uh6Nh7hh]rÛ(hD)rÜ}rÝ(h$X Type: HEADERrÞh%jØh&h)h+hHh-}rß(h/]h0]h1]h2]h4]uh6M~h]ràh@X Type: HEADERrá…râ}rã(h$jÞh%jÜubaubhD)rä}rå(h$XReadable from: vcl_deliverræh%jØh&h)h+hHh-}rç(h/]h0]h1]h2]h4]uh6M€h]rèh@XReadable from: vcl_deliverré…rê}rë(h$jæh%jäubaubhD)rì}rí(h$XWriteable frome: vcl_deliverrîh%jØh&h)h+hHh-}rï(h/]h0]h1]h2]h4]uh6M‚h]rðh@XWriteable frome: vcl_deliverrñ…rò}ró(h$jîh%jìubaubhD)rô}rõ(h$XThe corresponding HTTP header.röh%jØh&h)h+hHh-}r÷(h/]h0]h1]h2]h4]uh6M…h]røh@XThe corresponding HTTP header.rù…rú}rû(h$jöh%jôubaubeubhD)rü}rý(h$X resp.protorþh%jÂh&h)h+hHh-}rÿ(h/]h0]h1]h2]h4]uh6Mˆh7hh]r h@X resp.protor …r }r (h$jþh%jüubaubhN)r }r (h$Uh%jÂh&h)h+hQh-}r (h/]h0]h1]h2]h4]uh6Nh7hh]r (hD)r }r (h$X Type: STRINGr h%j h&h)h+hHh-}r (h/]h0]h1]h2]h4]uh6MŠh]r h@X Type: STRINGr …r }r (h$j h%j ubaubhD)r }r (h$XReadable from: vcl_deliverr h%j h&h)h+hHh-}r (h/]h0]h1]h2]h4]uh6MŒh]r h@XReadable from: vcl_deliverr …r }r (h$j h%j ubaubhD)r }r (h$XWriteable frome: vcl_deliverr h%j h&h)h+hHh-}r (h/]h0]h1]h2]h4]uh6MŽh]r h@XWriteable frome: vcl_deliverr …r }r (h$j h%j ubaubhD)r }r! (h$X2The HTTP protocol version to use for the response.r" h%j h&h)h+hHh-}r# (h/]h0]h1]h2]h4]uh6M‘h]r$ h@X2The HTTP protocol version to use for the response.r% …r& }r' (h$j" h%j ubaubeubhD)r( }r) (h$X resp.reasonr* h%jÂh&h)h+hHh-}r+ (h/]h0]h1]h2]h4]uh6M”h7hh]r, h@X resp.reasonr- …r. }r/ (h$j* h%j( ubaubhN)r0 }r1 (h$Uh%jÂh&h)h+hQh-}r2 (h/]h0]h1]h2]h4]uh6Nh7hh]r3 (hD)r4 }r5 (h$X Type: STRINGr6 h%j0 h&h)h+hHh-}r7 (h/]h0]h1]h2]h4]uh6M–h]r8 h@X Type: STRINGr9 …r: }r; (h$j6 h%j4 ubaubhD)r< }r= (h$XReadable from: vcl_deliverr> h%j0 h&h)h+hHh-}r? (h/]h0]h1]h2]h4]uh6M˜h]r@ h@XReadable from: vcl_deliverrA …rB }rC (h$j> h%j< ubaubhD)rD }rE (h$XWriteable frome: vcl_deliverrF h%j0 h&h)h+hHh-}rG (h/]h0]h1]h2]h4]uh6Mšh]rH h@XWriteable frome: vcl_deliverrI …rJ }rK (h$jF h%jD ubaubhD)rL }rM (h$X.The HTTP status message that will be returned.rN h%j0 h&h)h+hHh-}rO (h/]h0]h1]h2]h4]uh6Mh]rP h@X.The HTTP status message that will be returned.rQ …rR }rS (h$jN h%jL ubaubeubhD)rT }rU (h$X resp.statusrV h%jÂh&h)h+hHh-}rW (h/]h0]h1]h2]h4]uh6M h7hh]rX h@X resp.statusrY …rZ }r[ (h$jV h%jT ubaubhN)r\ }r] (h$Uh%jÂh&h)h+hQh-}r^ (h/]h0]h1]h2]h4]uh6Nh7hh]r_ (hD)r` }ra (h$X Type: INTrb h%j\ h&h)h+hHh-}rc (h/]h0]h1]h2]h4]uh6M¢h]rd h@X Type: INTre …rf }rg (h$jb h%j` ubaubhD)rh }ri (h$XReadable from: vcl_deliverrj h%j\ h&h)h+hHh-}rk (h/]h0]h1]h2]h4]uh6M¤h]rl h@XReadable from: vcl_deliverrm …rn }ro (h$jj h%jh ubaubhD)rp }rq (h$XWriteable frome: vcl_deliverrr h%j\ h&h)h+hHh-}rs (h/]h0]h1]h2]h4]uh6M¦h]rt h@XWriteable frome: vcl_deliverru …rv }rw (h$jr h%jp ubaubhD)rx }ry (h$X+The HTTP status code that will be returned.rz h%j\ h&h)h+hHh-}r{ (h/]h0]h1]h2]h4]uh6M©h]r| h@X+The HTTP status code that will be returned.r} …r~ }r (h$jz h%jx ubaubeubeubh!)r€ }r (h$Uh%hh&h)h+h,h-}r‚ (h/]h0]h1]h2]rƒ hah4]r„ h auh6M­h7hh]r… (h9)r† }r‡ (h$Xserverrˆ h%j€ h&h)h+h=h-}r‰ (h/]h0]h1]h2]h4]uh6M­h7hh]rŠ h@Xserverr‹ …rŒ }r (h$jˆ h%j† ubaubhD)rŽ }r (h$Xserver.hostnamer h%j€ h&h)h+hHh-}r‘ (h/]h0]h1]h2]h4]uh6M¯h7hh]r’ h@Xserver.hostnamer“ …r” }r• (h$j h%jŽ ubaubhN)r– }r— (h$Uh%j€ h&h)h+hQh-}r˜ (h/]h0]h1]h2]h4]uh6Nh7hh]r™ (hD)rš }r› (h$X Type: STRINGrœ h%j– h&h)h+hHh-}r (h/]h0]h1]h2]h4]uh6M±h]rž h@X Type: STRINGrŸ …r  }r¡ (h$jœ h%jš ubaubhD)r¢ }r£ (h$XReadable from: clientr¤ h%j– h&h)h+hHh-}r¥ (h/]h0]h1]h2]h4]uh6M³h]r¦ h@XReadable from: clientr§ …r¨ }r© (h$j¤ h%j¢ ubaubhD)rª }r« (h$XThe host name of the server.r¬ h%j– h&h)h+hHh-}r­ (h/]h0]h1]h2]h4]uh6M¶h]r® h@XThe host name of the server.r¯ …r° }r± (h$j¬ h%jª ubaubeubhD)r² }r³ (h$Xserver.identityr´ h%j€ h&h)h+hHh-}rµ (h/]h0]h1]h2]h4]uh6M¹h7hh]r¶ h@Xserver.identityr· …r¸ }r¹ (h$j´ h%j² ubaubhN)rº }r» (h$Uh%j€ h&h)h+hQh-}r¼ (h/]h0]h1]h2]h4]uh6Nh7hh]r½ (hD)r¾ }r¿ (h$X Type: STRINGrÀ h%jº h&h)h+hHh-}rÁ (h/]h0]h1]h2]h4]uh6M»h]r h@X Type: STRINGrà …rÄ }rÅ (h$jÀ h%j¾ ubaubhD)rÆ }rÇ (h$XReadable from: clientrÈ h%jº h&h)h+hHh-}rÉ (h/]h0]h1]h2]h4]uh6M½h]rÊ h@XReadable from: clientrË …rÌ }rÍ (h$jÈ h%jÆ ubaubhD)rÎ }rÏ (h$XÂ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.rÐ h%jº h&h)h+hHh-}rÑ (h/]h0]h1]h2]h4]uh6MÀh]rÒ h@XÂ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.rÓ …rÔ }rÕ (h$jÐ h%jÎ ubaubeubhD)rÖ }r× (h$X server.iprØ h%j€ h&h)h+hHh-}rÙ (h/]h0]h1]h2]h4]uh6MÆh7hh]rÚ h@X server.iprÛ …rÜ }rÝ (h$jØ h%jÖ ubaubhN)rÞ }rß (h$Uh%j€ h&h)h+hQh-}rà (h/]h0]h1]h2]h4]uh6Nh7hh]rá (hD)râ }rã (h$XType: IPrä h%jÞ h&h)h+hHh-}rå (h/]h0]h1]h2]h4]uh6MÈh]ræ h@XType: IPrç …rè }ré (h$jä h%jâ ubaubhD)rê }rë (h$XReadable from: clientrì h%jÞ h&h)h+hHh-}rí (h/]h0]h1]h2]h4]uh6MÊh]rî h@XReadable from: clientrï …rð }rñ (h$jì h%jê ubaubhD)rò }ró (h$XIThe IP address of the socket on which the client connection was received.rô h%jÞ h&h)h+hHh-}rõ (h/]h0]h1]h2]h4]uh6MÍh]rö h@XIThe IP address of the socket on which the client connection was received.r÷ …rø }rù (h$jô h%jò ubaubeubeubeh$UU transformerrú NU footnote_refsrû }rü Urefnamesrý }rþ Usymbol_footnotesrÿ ]r Uautofootnote_refsr ]r Usymbol_footnote_refsr ]r U citationsr ]r h7hU current_liner NUtransform_messagesr ]r Ureporterr NUid_startr KU autofootnotesr ]r U citation_refsr }r Uindirect_targetsr ]r Usettingsr (cdocutils.frontend Values r or }r (Ufootnote_backlinksr KUrecord_dependenciesr NU rfc_base_urlr Uhttp://tools.ietf.org/html/r U tracebackr ˆUpep_referencesr NUstrip_commentsr NU toc_backlinksr Uentryr U language_coder Uenr U datestampr! NU report_levelr" KU _destinationr# NU halt_levelr$ KU strip_classesr% Nh=NUerror_encoding_error_handlerr& Ubackslashreplacer' Udebugr( NUembed_stylesheetr) ‰Uoutput_encoding_error_handlerr* Ustrictr+ U sectnum_xformr, KUdump_transformsr- NU docinfo_xformr. KUwarning_streamr/ NUpep_file_url_templater0 Upep-%04dr1 Uexit_status_levelr2 KUconfigr3 NUstrict_visitorr4 NUcloak_email_addressesr5 ˆUtrim_footnote_reference_spacer6 ‰Uenvr7 NUdump_pseudo_xmlr8 NUexpose_internalsr9 NUsectsubtitle_xformr: ‰U source_linkr; NUrfc_referencesr< NUoutput_encodingr= Uutf-8r> U source_urlr? NUinput_encodingr@ U utf-8-sigrA U_disable_configrB NU id_prefixrC UU tab_widthrD KUerror_encodingrE UUTF-8rF U_sourcerG U5/home/tfheen/varnish/doc/sphinx/reference/vcl_var.rstrH Ugettext_compactrI ˆU generatorrJ NUdump_internalsrK NU smart_quotesrL ‰U pep_base_urlrM Uhttp://www.python.org/dev/peps/rN Usyntax_highlightrO UlongrP Uinput_encoding_error_handlerrQ j+ Uauto_id_prefixrR UidrS Udoctitle_xformrT ‰Ustrip_elements_with_classesrU NU _config_filesrV ]Ufile_insertion_enabledrW KU raw_enabledrX KU dump_settingsrY NubUsymbol_footnote_startrZ KUidsr[ }r\ (hjàhjòhh"hjÂhj hj€ hjbhjÀuUsubstitution_namesr] }r^ h+h7h-}r_ (h/]h2]h1]Usourceh)h0]h4]uU footnotesr` ]ra Urefidsrb }rc ub.varnish-3.0.5/doc/sphinx/=build/doctrees/reference/vmod_std.doctree0000644000175000017500000011322612247037213022326 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(X functionsqNX descriptionqNX copyrightqNXcollectq NXdurationq NXrandomq NXfilereadq NXvarnish standard moduleq NXsyslogqNXsynopsisqNXlogqNXtoupperqNXintegerqNXvmod_stdqNX set_ip_tosqNXsee alsoqNXhistoryqNXtolowerqNuUsubstitution_defsq}qUparse_messagesq]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q (hU functionsq!hU descriptionq"hU copyrightq#h Ucollectq$h Udurationq%h Urandomq&h Ufilereadq'h Uvarnish-standard-moduleq(hUsyslogq)hUsynopsisq*hUlogq+hUtoupperq,hUintegerq-hUvmod-stdq.hU set-ip-tosq/hUsee-alsoq0hUhistoryq1hUtolowerq2uUchildrenq3]q4cdocutils.nodes section q5)q6}q7(U rawsourceq8UUparentq9hUsourceq:cdocutils.nodes reprunicode q;X6/home/tfheen/varnish/doc/sphinx/reference/vmod_std.rstq<…q=}q>bUtagnameq?Usectionq@U attributesqA}qB(UdupnamesqC]UclassesqD]UbackrefsqE]UidsqF]qGh.aUnamesqH]qIhauUlineqJKUdocumentqKhh3]qL(cdocutils.nodes title qM)qN}qO(h8Xvmod_stdqPh9h6h:h=h?UtitleqQhA}qR(hC]hD]hE]hF]hH]uhJKhKhh3]qScdocutils.nodes Text qTXvmod_stdqU…qV}qW(h8hPh9hNubaubh5)qX}qY(h8Uh9h6h:h=h?h@hA}qZ(hC]hD]hE]hF]q[h(ahH]q\h auhJKhKhh3]q](hM)q^}q_(h8XVarnish Standard Moduleq`h9hXh:h=h?hQhA}qa(hC]hD]hE]hF]hH]uhJKhKhh3]qbhTXVarnish Standard Moduleqc…qd}qe(h8h`h9h^ubaubcdocutils.nodes field_list qf)qg}qh(h8Uh9hXh:h=h?U field_listqihA}qj(hC]hD]hE]hF]hH]uhJK hKhh3]qk(cdocutils.nodes field ql)qm}qn(h8Uh9hgh:h=h?UfieldqohA}qp(hC]hD]hE]hF]hH]uhJK hKhh3]qq(cdocutils.nodes field_name qr)qs}qt(h8XAuthorquhA}qv(hC]hD]hE]hF]hH]uh9hmh3]qwhTXAuthorqx…qy}qz(h8huh9hsubah?U field_nameq{ubcdocutils.nodes field_body q|)q}}q~(h8XPer BuerqhA}q€(hC]hD]hE]hF]hH]uh9hmh3]qcdocutils.nodes paragraph q‚)qƒ}q„(h8hh9h}h:h=h?U paragraphq…hA}q†(hC]hD]hE]hF]hH]uhJK h3]q‡hTXPer Buerqˆ…q‰}qŠ(h8hh9hƒubaubah?U field_bodyq‹ubeubhl)qŒ}q(h8Uh9hgh:h=h?hohA}qŽ(hC]hD]hE]hF]hH]uhJK hKhh3]q(hr)q}q‘(h8XDateq’hA}q“(hC]hD]hE]hF]hH]uh9hŒh3]q”hTXDateq•…q–}q—(h8h’h9hubah?h{ubh|)q˜}q™(h8X 2011-05-19qšhA}q›(hC]hD]hE]hF]hH]uh9hŒh3]qœh‚)q}qž(h8hšh9h˜h:h=h?h…hA}qŸ(hC]hD]hE]hF]hH]uhJK h3]q hTX 2011-05-19q¡…q¢}q£(h8hšh9hubaubah?h‹ubeubhl)q¤}q¥(h8Uh9hgh:h=h?hohA}q¦(hC]hD]hE]hF]hH]uhJK hKhh3]q§(hr)q¨}q©(h8XVersionqªhA}q«(hC]hD]hE]hF]hH]uh9h¤h3]q¬hTXVersionq­…q®}q¯(h8hªh9h¨ubah?h{ubh|)q°}q±(h8X1.0q²hA}q³(hC]hD]hE]hF]hH]uh9h¤h3]q´h‚)qµ}q¶(h8h²h9h°h:h=h?h…hA}q·(hC]hD]hE]hF]hH]uhJK h3]q¸hTX1.0q¹…qº}q»(h8h²h9hµubaubah?h‹ubeubhl)q¼}q½(h8Uh9hgh:h=h?hohA}q¾(hC]hD]hE]hF]hH]uhJK hKhh3]q¿(hr)qÀ}qÁ(h8XManual sectionqÂhA}qÃ(hC]hD]hE]hF]hH]uh9h¼h3]qÄhTXManual sectionqÅ…qÆ}qÇ(h8hÂh9hÀubah?h{ubh|)qÈ}qÉ(h8X3 hA}qÊ(hC]hD]hE]hF]hH]uh9h¼h3]qËh‚)qÌ}qÍ(h8X3h9hÈh:h=h?h…hA}qÎ(hC]hD]hE]hF]hH]uhJK h3]qÏhTX3…qÐ}qÑ(h8X3h9hÌubaubah?h‹ubeubeubh5)qÒ}qÓ(h8Uh9hXh:h=h?h@hA}qÔ(hC]hD]hE]hF]qÕh*ahH]qÖhauhJKhKhh3]q×(hM)qØ}qÙ(h8XSYNOPSISqÚh9hÒh:h=h?hQhA}qÛ(hC]hD]hE]hF]hH]uhJKhKhh3]qÜhTXSYNOPSISqÝ…qÞ}qß(h8hÚh9hØubaubh‚)qà}qá(h8X import stdqâh9hÒh:h=h?h…hA}qã(hC]hD]hE]hF]hH]uhJKhKhh3]qähTX import stdqå…qæ}qç(h8hâh9hàubaubeubh5)qè}qé(h8Uh9hXh:h=h?h@hA}qê(hC]hD]hE]hF]qëh"ahH]qìhauhJKhKhh3]qí(hM)qî}qï(h8X DESCRIPTIONqðh9hèh:h=h?hQhA}qñ(hC]hD]hE]hF]hH]uhJKhKhh3]qòhTX DESCRIPTIONqó…qô}qõ(h8hðh9hîubaubh‚)qö}q÷(h8XThe Varnish standard module contains useful, generic function that don't quite fit in the VCL core, but are still considered very useful to a broad audience.qøh9hèh:h=h?h…hA}qù(hC]hD]hE]hF]hH]uhJKhKhh3]qúhTXThe Varnish standard module contains useful, generic function that don't quite fit in the VCL core, but are still considered very useful to a broad audience.qû…qü}qý(h8høh9höubaubeubh5)qþ}qÿ(h8Uh9hXh:h=h?h@hA}r(hC]hD]hE]hF]rh!ahH]rhauhJKhKhh3]r(hM)r}r(h8X FUNCTIONSrh9hþh:h=h?hQhA}r(hC]hD]hE]hF]hH]uhJKhKhh3]rhTX FUNCTIONSr …r }r (h8jh9jubaubh5)r }r (h8Uh9hþh:h=h?h@hA}r(hC]hD]hE]hF]rh,ahH]rhauhJKhKhh3]r(hM)r}r(h8Xtoupperrh9j h:h=h?hQhA}r(hC]hD]hE]hF]hH]uhJKhKhh3]rhTXtoupperr…r}r(h8jh9jubaubcdocutils.nodes definition_list r)r}r(h8Uh9j h:h=h?Udefinition_listrhA}r(hC]hD]hE]hF]hH]uhJNhKhh3]r(cdocutils.nodes definition_list_item r )r!}r"(h8XPrototype toupper(STRING s)h9jh:h=h?Udefinition_list_itemr#hA}r$(hC]hD]hE]hF]hH]uhJK!h3]r%(cdocutils.nodes term r&)r'}r((h8X Prototyper)h9j!h:h=h?Utermr*hA}r+(hC]hD]hE]hF]hH]uhJK!h3]r,hTX Prototyper-…r.}r/(h8j)h9j'ubaubcdocutils.nodes definition r0)r1}r2(h8UhA}r3(hC]hD]hE]hF]hH]uh9j!h3]r4h‚)r5}r6(h8Xtoupper(STRING s)r7h9j1h:h=h?h…hA}r8(hC]hD]hE]hF]hH]uhJK"h3]r9hTXtoupper(STRING s)r:…r;}r<(h8j7h9j5ubaubah?U definitionr=ubeubj )r>}r?(h8XReturn value Stringh9jh:h=h?j#hA}r@(hC]hD]hE]hF]hH]uhJK#hKhh3]rA(j&)rB}rC(h8X Return valuerDh9j>h:h=h?j*hA}rE(hC]hD]hE]hF]hH]uhJK#h3]rFhTX Return valuerG…rH}rI(h8jDh9jBubaubj0)rJ}rK(h8UhA}rL(hC]hD]hE]hF]hH]uh9j>h3]rMh‚)rN}rO(h8XStringrPh9jJh:h=h?h…hA}rQ(hC]hD]hE]hF]hH]uhJK$h3]rRhTXStringrS…rT}rU(h8jPh9jNubaubah?j=ubeubj )rV}rW(h8X2Description Converts the string *s* to upper case.h9jh:h=h?j#hA}rX(hC]hD]hE]hF]hH]uhJK%hKhh3]rY(j&)rZ}r[(h8X Descriptionr\h9jVh:h=h?j*hA}r](hC]hD]hE]hF]hH]uhJK%h3]r^hTX Descriptionr_…r`}ra(h8j\h9jZubaubj0)rb}rc(h8UhA}rd(hC]hD]hE]hF]hH]uh9jVh3]reh‚)rf}rg(h8X&Converts the string *s* to upper case.h9jbh:h=h?h…hA}rh(hC]hD]hE]hF]hH]uhJK&h3]ri(hTXConverts the string rj…rk}rl(h8XConverts the string h9jfubcdocutils.nodes emphasis rm)rn}ro(h8X*s*hA}rp(hC]hD]hE]hF]hH]uh9jfh3]rqhTXs…rr}rs(h8Uh9jnubah?UemphasisrtubhTX to upper case.ru…rv}rw(h8X to upper case.h9jfubeubah?j=ubeubj )rx}ry(h8X8Example set beresp.http.x-scream = std.toupper("yes!"); h9jh:h=h?j#hA}rz(hC]hD]hE]hF]hH]uhJK(hKhh3]r{(j&)r|}r}(h8XExampler~h9jxh:h=h?j*hA}r(hC]hD]hE]hF]hH]uhJK(h3]r€hTXExampler…r‚}rƒ(h8j~h9j|ubaubj0)r„}r…(h8UhA}r†(hC]hD]hE]hF]hH]uh9jxh3]r‡h‚)rˆ}r‰(h8X/set beresp.http.x-scream = std.toupper("yes!");rŠh9j„h:h=h?h…hA}r‹(hC]hD]hE]hF]hH]uhJK(h3]rŒhTX/set beresp.http.x-scream = std.toupper("yes!");r…rŽ}r(h8jŠh9jˆubaubah?j=ubeubeubeubh5)r}r‘(h8Uh9hþh:h=h?h@hA}r’(hC]hD]hE]hF]r“h2ahH]r”hauhJK+hKhh3]r•(hM)r–}r—(h8Xtolowerr˜h9jh:h=h?hQhA}r™(hC]hD]hE]hF]hH]uhJK+hKhh3]ršhTXtolowerr›…rœ}r(h8j˜h9j–ubaubj)rž}rŸ(h8Uh9jh:h=h?jhA}r (hC]hD]hE]hF]hH]uhJNhKhh3]r¡(j )r¢}r£(h8XPrototype tolower(STRING s)h9jžh:h=h?j#hA}r¤(hC]hD]hE]hF]hH]uhJK,h3]r¥(j&)r¦}r§(h8X Prototyper¨h9j¢h:h=h?j*hA}r©(hC]hD]hE]hF]hH]uhJK,h3]rªhTX Prototyper«…r¬}r­(h8j¨h9j¦ubaubj0)r®}r¯(h8UhA}r°(hC]hD]hE]hF]hH]uh9j¢h3]r±h‚)r²}r³(h8Xtolower(STRING s)r´h9j®h:h=h?h…hA}rµ(hC]hD]hE]hF]hH]uhJK-h3]r¶hTXtolower(STRING s)r·…r¸}r¹(h8j´h9j²ubaubah?j=ubeubj )rº}r»(h8XReturn value Stringh9jžh:h=h?j#hA}r¼(hC]hD]hE]hF]hH]uhJK.hKhh3]r½(j&)r¾}r¿(h8X Return valuerÀh9jºh:h=h?j*hA}rÁ(hC]hD]hE]hF]hH]uhJK.h3]rÂhTX Return valuerÃ…rÄ}rÅ(h8jÀh9j¾ubaubj0)rÆ}rÇ(h8UhA}rÈ(hC]hD]hE]hF]hH]uh9jºh3]rÉh‚)rÊ}rË(h8XStringrÌh9jÆh:h=h?h…hA}rÍ(hC]hD]hE]hF]hH]uhJK/h3]rÎhTXStringrÏ…rÐ}rÑ(h8jÌh9jÊubaubah?j=ubeubj )rÒ}rÓ(h8X2Description Converts the string *s* to lower case.h9jžh:h=h?j#hA}rÔ(hC]hD]hE]hF]hH]uhJK0hKhh3]rÕ(j&)rÖ}r×(h8X DescriptionrØh9jÒh:h=h?j*hA}rÙ(hC]hD]hE]hF]hH]uhJK0h3]rÚhTX DescriptionrÛ…rÜ}rÝ(h8jØh9jÖubaubj0)rÞ}rß(h8UhA}rà(hC]hD]hE]hF]hH]uh9jÒh3]ráh‚)râ}rã(h8X&Converts the string *s* to lower case.h9jÞh:h=h?h…hA}rä(hC]hD]hE]hF]hH]uhJK1h3]rå(hTXConverts the string ræ…rç}rè(h8XConverts the string h9jâubjm)ré}rê(h8X*s*hA}rë(hC]hD]hE]hF]hH]uh9jâh3]rìhTXs…rí}rî(h8Uh9jéubah?jtubhTX to lower case.rï…rð}rñ(h8X to lower case.h9jâubeubah?j=ubeubj )rò}ró(h8X6Example set beresp.http.x-nice = std.tolower("VerY"); h9jžh:h=h?j#hA}rô(hC]hD]hE]hF]hH]uhJK3hKhh3]rõ(j&)rö}r÷(h8XExamplerøh9jòh:h=h?j*hA}rù(hC]hD]hE]hF]hH]uhJK3h3]rúhTXExamplerû…rü}rý(h8jøh9jöubaubj0)rþ}rÿ(h8UhA}r(hC]hD]hE]hF]hH]uh9jòh3]rh‚)r}r(h8X-set beresp.http.x-nice = std.tolower("VerY");rh9jþh:h=h?h…hA}r(hC]hD]hE]hF]hH]uhJK3h3]rhTX-set beresp.http.x-nice = std.tolower("VerY");r…r}r (h8jh9jubaubah?j=ubeubeubeubh5)r }r (h8Uh9hþh:h=h?h@hA}r (hC]hD]hE]hF]r h/ahH]rhauhJK6hKhh3]r(hM)r}r(h8X set_ip_tosrh9j h:h=h?hQhA}r(hC]hD]hE]hF]hH]uhJK6hKhh3]rhTX set_ip_tosr…r}r(h8jh9jubaubj)r}r(h8Uh9j h:h=h?jhA}r(hC]hD]hE]hF]hH]uhJNhKhh3]r(j )r}r(h8XPrototype set_ip_tos(INT i)h9jh:h=h?j#hA}r(hC]hD]hE]hF]hH]uhJK7h3]r(j&)r }r!(h8X Prototyper"h9jh:h=h?j*hA}r#(hC]hD]hE]hF]hH]uhJK7h3]r$hTX Prototyper%…r&}r'(h8j"h9j ubaubj0)r(}r)(h8UhA}r*(hC]hD]hE]hF]hH]uh9jh3]r+h‚)r,}r-(h8Xset_ip_tos(INT i)r.h9j(h:h=h?h…hA}r/(hC]hD]hE]hF]hH]uhJK8h3]r0hTXset_ip_tos(INT i)r1…r2}r3(h8j.h9j,ubaubah?j=ubeubj )r4}r5(h8XReturn value Voidh9jh:h=h?j#hA}r6(hC]hD]hE]hF]hH]uhJK9hKhh3]r7(j&)r8}r9(h8X Return valuer:h9j4h:h=h?j*hA}r;(hC]hD]hE]hF]hH]uhJK9h3]r<hTX Return valuer=…r>}r?(h8j:h9j8ubaubj0)r@}rA(h8UhA}rB(hC]hD]hE]hF]hH]uh9j4h3]rCh‚)rD}rE(h8XVoidrFh9j@h:h=h?h…hA}rG(hC]hD]hE]hF]hH]uhJK:h3]rHhTXVoidrI…rJ}rK(h8jFh9jDubaubah?j=ubeubj )rL}rM(h8XÌDescription Sets the Type-of-Service flag for the current session. Please note that the TOS flag is not removed by the end of the request so probably want to set it on every request should you utilize it.h9jh:h=h?j#hA}rN(hC]hD]hE]hF]hH]uhJK>hKhh3]rO(j&)rP}rQ(h8X DescriptionrRh9jLh:h=h?j*hA}rS(hC]hD]hE]hF]hH]uhJK>h3]rThTX DescriptionrU…rV}rW(h8jRh9jPubaubj0)rX}rY(h8UhA}rZ(hC]hD]hE]hF]hH]uh9jLh3]r[h‚)r\}r](h8XÀSets the Type-of-Service flag for the current session. Please note that the TOS flag is not removed by the end of the request so probably want to set it on every request should you utilize it.r^h9jXh:h=h?h…hA}r_(hC]hD]hE]hF]hH]uhJKExample set beresp.http.x-random-number = std.random(1, 100); h9j¤h:h=h?j#hA}r(hC]hD]hE]hF]hH]uhJKNhKhh3]r(j&)r}r(h8XExamplerh9jh:h=h?j*hA}r(hC]hD]hE]hF]hH]uhJKNh3]rhTXExampler …r }r (h8jh9jubaubj0)r }r (h8UhA}r(hC]hD]hE]hF]hH]uh9jh3]rh‚)r}r(h8X5set beresp.http.x-random-number = std.random(1, 100);rh9j h:h=h?h…hA}r(hC]hD]hE]hF]hH]uhJKNh3]rhTX5set beresp.http.x-random-number = std.random(1, 100);r…r}r(h8jh9jubaubah?j=ubeubeubeubh5)r}r(h8Uh9hþh:h=h?h@hA}r(hC]hD]hE]hF]rh+ahH]rhauhJKQhKhh3]r(hM)r}r(h8Xlogr h9jh:h=h?hQhA}r!(hC]hD]hE]hF]hH]uhJKQhKhh3]r"hTXlogr#…r$}r%(h8j h9jubaubj)r&}r'(h8Uh9jh:h=h?jhA}r((hC]hD]hE]hF]hH]uhJNhKhh3]r)(j )r*}r+(h8XPrototype log(STRING string)h9j&h:h=h?j#hA}r,(hC]hD]hE]hF]hH]uhJKRh3]r-(j&)r.}r/(h8X Prototyper0h9j*h:h=h?j*hA}r1(hC]hD]hE]hF]hH]uhJKRh3]r2hTX Prototyper3…r4}r5(h8j0h9j.ubaubj0)r6}r7(h8UhA}r8(hC]hD]hE]hF]hH]uh9j*h3]r9h‚)r:}r;(h8Xlog(STRING string)r<h9j6h:h=h?h…hA}r=(hC]hD]hE]hF]hH]uhJKSh3]r>hTXlog(STRING string)r?…r@}rA(h8j<h9j:ubaubah?j=ubeubj )rB}rC(h8XReturn value Voidh9j&h:h=h?j#hA}rD(hC]hD]hE]hF]hH]uhJKThKhh3]rE(j&)rF}rG(h8X Return valuerHh9jBh:h=h?j*hA}rI(hC]hD]hE]hF]hH]uhJKTh3]rJhTX Return valuerK…rL}rM(h8jHh9jFubaubj0)rN}rO(h8UhA}rP(hC]hD]hE]hF]hH]uh9jBh3]rQh‚)rR}rS(h8XVoidrTh9jNh:h=h?h…hA}rU(hC]hD]hE]hF]hH]uhJKUh3]rVhTXVoidrW…rX}rY(h8jTh9jRubaubah?j=ubeubj )rZ}r[(h8X3Description Logs *string* to the shared memory log.h9j&h:h=h?j#hA}r\(hC]hD]hE]hF]hH]uhJKVhKhh3]r](j&)r^}r_(h8X Descriptionr`h9jZh:h=h?j*hA}ra(hC]hD]hE]hF]hH]uhJKVh3]rbhTX Descriptionrc…rd}re(h8j`h9j^ubaubj0)rf}rg(h8UhA}rh(hC]hD]hE]hF]hH]uh9jZh3]rih‚)rj}rk(h8X'Logs *string* to the shared memory log.h9jfh:h=h?h…hA}rl(hC]hD]hE]hF]hH]uhJKWh3]rm(hTXLogs rn…ro}rp(h8XLogs h9jjubjm)rq}rr(h8X*string*hA}rs(hC]hD]hE]hF]hH]uh9jjh3]rthTXstringru…rv}rw(h8Uh9jqubah?jtubhTX to the shared memory log.rx…ry}rz(h8X to the shared memory log.h9jjubeubah?j=ubeubj )r{}r|(h8XKExample std.log("Something fishy is going on with the vhost " + req.host); h9j&h:h=h?j#hA}r}(hC]hD]hE]hF]hH]uhJKYhKhh3]r~(j&)r}r€(h8XExamplerh9j{h:h=h?j*hA}r‚(hC]hD]hE]hF]hH]uhJKYh3]rƒhTXExampler„…r…}r†(h8jh9jubaubj0)r‡}rˆ(h8UhA}r‰(hC]hD]hE]hF]hH]uh9j{h3]rŠh‚)r‹}rŒ(h8XBstd.log("Something fishy is going on with the vhost " + req.host);rh9j‡h:h=h?h…hA}rŽ(hC]hD]hE]hF]hH]uhJKYh3]rhTXBstd.log("Something fishy is going on with the vhost " + req.host);r…r‘}r’(h8jh9j‹ubaubah?j=ubeubeubeubh5)r“}r”(h8Uh9hþh:h=h?h@hA}r•(hC]hD]hE]hF]r–h)ahH]r—hauhJK\hKhh3]r˜(hM)r™}rš(h8Xsyslogr›h9j“h:h=h?hQhA}rœ(hC]hD]hE]hF]hH]uhJK\hKhh3]rhTXsyslogrž…rŸ}r (h8j›h9j™ubaubj)r¡}r¢(h8Uh9j“h:h=h?jhA}r£(hC]hD]hE]hF]hH]uhJNhKhh3]r¤(j )r¥}r¦(h8X-Prototype syslog(INT priority, STRING string)h9j¡h:h=h?j#hA}r§(hC]hD]hE]hF]hH]uhJK]h3]r¨(j&)r©}rª(h8X Prototyper«h9j¥h:h=h?j*hA}r¬(hC]hD]hE]hF]hH]uhJK]h3]r­hTX Prototyper®…r¯}r°(h8j«h9j©ubaubj0)r±}r²(h8UhA}r³(hC]hD]hE]hF]hH]uh9j¥h3]r´h‚)rµ}r¶(h8X#syslog(INT priority, STRING string)r·h9j±h:h=h?h…hA}r¸(hC]hD]hE]hF]hH]uhJK^h3]r¹hTX#syslog(INT priority, STRING string)rº…r»}r¼(h8j·h9jµubaubah?j=ubeubj )r½}r¾(h8XReturn value Voidh9j¡h:h=h?j#hA}r¿(hC]hD]hE]hF]hH]uhJK_hKhh3]rÀ(j&)rÁ}rÂ(h8X Return valuerÃh9j½h:h=h?j*hA}rÄ(hC]hD]hE]hF]hH]uhJK_h3]rÅhTX Return valuerÆ…rÇ}rÈ(h8jÃh9jÁubaubj0)rÉ}rÊ(h8UhA}rË(hC]hD]hE]hF]hH]uh9j½h3]rÌh‚)rÍ}rÎ(h8XVoidrÏh9jÉh:h=h?h…hA}rÐ(hC]hD]hE]hF]hH]uhJK`h3]rÑhTXVoidrÒ…rÓ}rÔ(h8jÏh9jÍubaubah?j=ubeubj )rÕ}rÖ(h8X;Description Logs *string* to syslog marked with *priority*.h9j¡h:h=h?j#hA}r×(hC]hD]hE]hF]hH]uhJKahKhh3]rØ(j&)rÙ}rÚ(h8X DescriptionrÛh9jÕh:h=h?j*hA}rÜ(hC]hD]hE]hF]hH]uhJKah3]rÝhTX DescriptionrÞ…rß}rà(h8jÛh9jÙubaubj0)rá}râ(h8UhA}rã(hC]hD]hE]hF]hH]uh9jÕh3]räh‚)rå}ræ(h8X/Logs *string* to syslog marked with *priority*.h9jáh:h=h?h…hA}rç(hC]hD]hE]hF]hH]uhJKbh3]rè(hTXLogs ré…rê}rë(h8XLogs h9jåubjm)rì}rí(h8X*string*hA}rî(hC]hD]hE]hF]hH]uh9jåh3]rïhTXstringrð…rñ}rò(h8Uh9jìubah?jtubhTX to syslog marked with ró…rô}rõ(h8X to syslog marked with h9jåubjm)rö}r÷(h8X *priority*hA}rø(hC]hD]hE]hF]hH]uh9jåh3]rùhTXpriorityrú…rû}rü(h8Uh9jöubah?jtubhTX.…rý}rþ(h8X.h9jåubeubah?j=ubeubj )rÿ}r(h8XDExample std.syslog( LOG_USER|LOG_ALERT, "There is serious troble"); h9j¡h:h=h?j#hA}r(hC]hD]hE]hF]hH]uhJKdhKhh3]r(j&)r}r(h8XExamplerh9jÿh:h=h?j*hA}r(hC]hD]hE]hF]hH]uhJKdh3]rhTXExampler…r }r (h8jh9jubaubj0)r }r (h8UhA}r (hC]hD]hE]hF]hH]uh9jÿh3]rh‚)r}r(h8X;std.syslog( LOG_USER|LOG_ALERT, "There is serious troble");rh9j h:h=h?h…hA}r(hC]hD]hE]hF]hH]uhJKdh3]rhTX;std.syslog( LOG_USER|LOG_ALERT, "There is serious troble");r…r}r(h8jh9jubaubah?j=ubeubeubeubh5)r}r(h8Uh9hþh:h=h?h@hA}r(hC]hD]hE]hF]rh'ahH]rh auhJKghKhh3]r(hM)r}r(h8Xfilereadrh9jh:h=h?hQhA}r (hC]hD]hE]hF]hH]uhJKghKhh3]r!hTXfilereadr"…r#}r$(h8jh9jubaubj)r%}r&(h8Uh9jh:h=h?jhA}r'(hC]hD]hE]hF]hH]uhJNhKhh3]r((j )r)}r*(h8X#Prototype fileread(STRING filename)h9j%h:h=h?j#hA}r+(hC]hD]hE]hF]hH]uhJKhh3]r,(j&)r-}r.(h8X Prototyper/h9j)h:h=h?j*hA}r0(hC]hD]hE]hF]hH]uhJKhh3]r1hTX Prototyper2…r3}r4(h8j/h9j-ubaubj0)r5}r6(h8UhA}r7(hC]hD]hE]hF]hH]uh9j)h3]r8h‚)r9}r:(h8Xfileread(STRING filename)r;h9j5h:h=h?h…hA}r<(hC]hD]hE]hF]hH]uhJKih3]r=hTXfileread(STRING filename)r>…r?}r@(h8j;h9j9ubaubah?j=ubeubj )rA}rB(h8XReturn value Stringh9j%h:h=h?j#hA}rC(hC]hD]hE]hF]hH]uhJKjhKhh3]rD(j&)rE}rF(h8X Return valuerGh9jAh:h=h?j*hA}rH(hC]hD]hE]hF]hH]uhJKjh3]rIhTX Return valuerJ…rK}rL(h8jGh9jEubaubj0)rM}rN(h8UhA}rO(hC]hD]hE]hF]hH]uh9jAh3]rPh‚)rQ}rR(h8XStringrSh9jMh:h=h?h…hA}rT(hC]hD]hE]hF]hH]uhJKkh3]rUhTXStringrV…rW}rX(h8jSh9jQubaubah?j=ubeubj )rY}rZ(h8Xâ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.h9j%h:h=h?j#hA}r[(hC]hD]hE]hF]hH]uhJKohKhh3]r\(j&)r]}r^(h8X Descriptionr_h9jYh:h=h?j*hA}r`(hC]hD]hE]hF]hH]uhJKoh3]rahTX Descriptionrb…rc}rd(h8j_h9j]ubaubj0)re}rf(h8UhA}rg(hC]hD]hE]hF]hH]uh9jYh3]rhh‚)ri}rj(h8XÖ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.rkh9jeh:h=h?h…hA}rl(hC]hD]hE]hF]hH]uhJKmh3]rmhTXÖ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.rn…ro}rp(h8jkh9jiubaubah?j=ubeubj )rq}rr(h8XEExample set beresp.http.x-served-by = std.fileread("/etc/hostname"); h9j%h:h=h?j#hA}rs(hC]hD]hE]hF]hH]uhJKrhKhh3]rt(j&)ru}rv(h8XExamplerwh9jqh:h=h?j*hA}rx(hC]hD]hE]hF]hH]uhJKrh3]ryhTXExamplerz…r{}r|(h8jwh9juubaubj0)r}}r~(h8UhA}r(hC]hD]hE]hF]hH]uh9jqh3]r€h‚)r}r‚(h8X<set beresp.http.x-served-by = std.fileread("/etc/hostname");rƒh9j}h:h=h?h…hA}r„(hC]hD]hE]hF]hH]uhJKrh3]r…hTX<set beresp.http.x-served-by = std.fileread("/etc/hostname");r†…r‡}rˆ(h8jƒh9jubaubah?j=ubeubeubeubh5)r‰}rŠ(h8Uh9hþh:h=h?h@hA}r‹(hC]hD]hE]hF]rŒh%ahH]rh auhJKuhKhh3]rŽ(hM)r}r(h8Xdurationr‘h9j‰h:h=h?hQhA}r’(hC]hD]hE]hF]hH]uhJKuhKhh3]r“hTXdurationr”…r•}r–(h8j‘h9jubaubj)r—}r˜(h8Uh9j‰h:h=h?jhA}r™(hC]hD]hE]hF]hH]uhJNhKhh3]rš(j )r›}rœ(h8X/Prototype duration(STRING s, DURATION fallback)h9j—h:h=h?j#hA}r(hC]hD]hE]hF]hH]uhJKvh3]rž(j&)rŸ}r (h8X Prototyper¡h9j›h:h=h?j*hA}r¢(hC]hD]hE]hF]hH]uhJKvh3]r£hTX Prototyper¤…r¥}r¦(h8j¡h9jŸubaubj0)r§}r¨(h8UhA}r©(hC]hD]hE]hF]hH]uh9j›h3]rªh‚)r«}r¬(h8X%duration(STRING s, DURATION fallback)r­h9j§h:h=h?h…hA}r®(hC]hD]hE]hF]hH]uhJKwh3]r¯hTX%duration(STRING s, DURATION fallback)r°…r±}r²(h8j­h9j«ubaubah?j=ubeubj )r³}r´(h8XReturn value Durationh9j—h:h=h?j#hA}rµ(hC]hD]hE]hF]hH]uhJKxhKhh3]r¶(j&)r·}r¸(h8X Return valuer¹h9j³h:h=h?j*hA}rº(hC]hD]hE]hF]hH]uhJKxh3]r»hTX Return valuer¼…r½}r¾(h8j¹h9j·ubaubj0)r¿}rÀ(h8UhA}rÁ(hC]hD]hE]hF]hH]uh9j³h3]rÂh‚)rÃ}rÄ(h8XDurationrÅh9j¿h:h=h?h…hA}rÆ(hC]hD]hE]hF]hH]uhJKyh3]rÇhTXDurationrÈ…rÉ}rÊ(h8jÅh9jÃubaubah?j=ubeubj )rË}rÌ(h8XÇDescription Converts the string *s* to seconds. *s* can be quantified with the usual s (seconds), m (minutes), h (hours), d (days) and w (weeks) units. If *s* fails to parse, *fallback* will be used.h9j—h:h=h?j#hA}rÍ(hC]hD]hE]hF]hH]uhJK|hKhh3]rÎ(j&)rÏ}rÐ(h8X DescriptionrÑh9jËh:h=h?j*hA}rÒ(hC]hD]hE]hF]hH]uhJK|h3]rÓhTX DescriptionrÔ…rÕ}rÖ(h8jÑh9jÏubaubj0)r×}rØ(h8UhA}rÙ(hC]hD]hE]hF]hH]uh9jËh3]rÚh‚)rÛ}rÜ(h8X»Converts the string *s* to seconds. *s* can be quantified with the usual s (seconds), m (minutes), h (hours), d (days) and w (weeks) units. If *s* fails to parse, *fallback* will be used.h9j×h:h=h?h…hA}rÝ(hC]hD]hE]hF]hH]uhJK{h3]rÞ(hTXConverts the string rß…rà}rá(h8XConverts the string h9jÛubjm)râ}rã(h8X*s*hA}rä(hC]hD]hE]hF]hH]uh9jÛh3]råhTXs…ræ}rç(h8Uh9jâubah?jtubhTX to seconds. rè…ré}rê(h8X to seconds. h9jÛubjm)rë}rì(h8X*s*hA}rí(hC]hD]hE]hF]hH]uh9jÛh3]rîhTXs…rï}rð(h8Uh9jëubah?jtubhTXh can be quantified with the usual s (seconds), m (minutes), h (hours), d (days) and w (weeks) units. If rñ…rò}ró(h8Xh can be quantified with the usual s (seconds), m (minutes), h (hours), d (days) and w (weeks) units. If h9jÛubjm)rô}rõ(h8X*s*hA}rö(hC]hD]hE]hF]hH]uh9jÛh3]r÷hTXs…rø}rù(h8Uh9jôubah?jtubhTX fails to parse, rú…rû}rü(h8X fails to parse, h9jÛubjm)rý}rþ(h8X *fallback*hA}rÿ(hC]hD]hE]hF]hH]uh9jÛh3]rhTXfallbackr…r}r(h8Uh9jýubah?jtubhTX will be used.r…r}r(h8X will be used.h9jÛubeubah?j=ubeubj )r}r(h8X4Example set beresp.ttl = std.duration("1w", 3600s); h9j—h:h=h?j#hA}r (hC]hD]hE]hF]hH]uhJKhKhh3]r (j&)r }r (h8XExampler h9jh:h=h?j*hA}r(hC]hD]hE]hF]hH]uhJKh3]rhTXExampler…r}r(h8j h9j ubaubj0)r}r(h8UhA}r(hC]hD]hE]hF]hH]uh9jh3]rh‚)r}r(h8X+set beresp.ttl = std.duration("1w", 3600s);rh9jh:h=h?h…hA}r(hC]hD]hE]hF]hH]uhJKh3]rhTX+set beresp.ttl = std.duration("1w", 3600s);r…r}r(h8jh9jubaubah?j=ubeubeubeubh5)r}r (h8Uh9hþh:h=h?h@hA}r!(hC]hD]hE]hF]r"h-ahH]r#hauhJK‚hKhh3]r$(hM)r%}r&(h8Xintegerr'h9jh:h=h?hQhA}r((hC]hD]hE]hF]hH]uhJK‚hKhh3]r)hTXintegerr*…r+}r,(h8j'h9j%ubaubj)r-}r.(h8Uh9jh:h=h?jhA}r/(hC]hD]hE]hF]hH]uhJNhKhh3]r0(j )r1}r2(h8X)Prototype integer(STRING s, INT fallback)h9j-h:h=h?j#hA}r3(hC]hD]hE]hF]hH]uhJKƒh3]r4(j&)r5}r6(h8X Prototyper7h9j1h:h=h?j*hA}r8(hC]hD]hE]hF]hH]uhJKƒh3]r9hTX Prototyper:…r;}r<(h8j7h9j5ubaubj0)r=}r>(h8UhA}r?(hC]hD]hE]hF]hH]uh9j1h3]r@h‚)rA}rB(h8Xinteger(STRING s, INT fallback)rCh9j=h:h=h?h…hA}rD(hC]hD]hE]hF]hH]uhJK„h3]rEhTXinteger(STRING s, INT fallback)rF…rG}rH(h8jCh9jAubaubah?j=ubeubj )rI}rJ(h8XReturn value Inth9j-h:h=h?j#hA}rK(hC]hD]hE]hF]hH]uhJK…hKhh3]rL(j&)rM}rN(h8X Return valuerOh9jIh:h=h?j*hA}rP(hC]hD]hE]hF]hH]uhJK…h3]rQhTX Return valuerR…rS}rT(h8jOh9jMubaubj0)rU}rV(h8UhA}rW(hC]hD]hE]hF]hH]uh9jIh3]rXh‚)rY}rZ(h8XIntr[h9jUh:h=h?h…hA}r\(hC]hD]hE]hF]hH]uhJK†h3]r]hTXIntr^…r_}r`(h8j[h9jYubaubah?j=ubeubj )ra}rb(h8XbDescription Converts the string *s* to an integer. If *s* fails to parse, *fallback* will be usedh9j-h:h=h?j#hA}rc(hC]hD]hE]hF]hH]uhJKˆhKhh3]rd(j&)re}rf(h8X Descriptionrgh9jah:h=h?j*hA}rh(hC]hD]hE]hF]hH]uhJKˆh3]rihTX Descriptionrj…rk}rl(h8jgh9jeubaubj0)rm}rn(h8UhA}ro(hC]hD]hE]hF]hH]uh9jah3]rph‚)rq}rr(h8XVConverts the string *s* to an integer. If *s* fails to parse, *fallback* will be usedh9jmh:h=h?h…hA}rs(hC]hD]hE]hF]hH]uhJKˆh3]rt(hTXConverts the string ru…rv}rw(h8XConverts the string h9jqubjm)rx}ry(h8X*s*hA}rz(hC]hD]hE]hF]hH]uh9jqh3]r{hTXs…r|}r}(h8Uh9jxubah?jtubhTX to an integer. If r~…r}r€(h8X to an integer. If h9jqubjm)r}r‚(h8X*s*hA}rƒ(hC]hD]hE]hF]hH]uh9jqh3]r„hTXs…r…}r†(h8Uh9jubah?jtubhTX fails to parse, r‡…rˆ}r‰(h8X fails to parse, h9jqubjm)rŠ}r‹(h8X *fallback*hA}rŒ(hC]hD]hE]hF]hH]uh9jqh3]rhTXfallbackrŽ…r}r(h8Uh9jŠubah?jtubhTX will be usedr‘…r’}r“(h8X will be usedh9jqubeubah?j=ubeubj )r”}r•(h8X;Example if (std.integer(beresp.http.x-foo, 0) > 5) { ... } h9j-h:h=h?j#hA}r–(hC]hD]hE]hF]hH]uhJK‹hKhh3]r—(j&)r˜}r™(h8XExampleršh9j”h:h=h?j*hA}r›(hC]hD]hE]hF]hH]uhJK‹h3]rœhTXExampler…rž}rŸ(h8jšh9j˜ubaubj0)r }r¡(h8UhA}r¢(hC]hD]hE]hF]hH]uh9j”h3]r£h‚)r¤}r¥(h8X2if (std.integer(beresp.http.x-foo, 0) > 5) { ... }r¦h9j h:h=h?h…hA}r§(hC]hD]hE]hF]hH]uhJK‹h3]r¨hTX2if (std.integer(beresp.http.x-foo, 0) > 5) { ... }r©…rª}r«(h8j¦h9j¤ubaubah?j=ubeubeubeubh5)r¬}r­(h8Uh9hþh:h=h?h@hA}r®(hC]hD]hE]hF]r¯h$ahH]r°h auhJKŽhKhh3]r±(hM)r²}r³(h8Xcollectr´h9j¬h:h=h?hQhA}rµ(hC]hD]hE]hF]hH]uhJKŽhKhh3]r¶hTXcollectr·…r¸}r¹(h8j´h9j²ubaubj)rº}r»(h8Uh9j¬h:h=h?jhA}r¼(hC]hD]hE]hF]hH]uhJNhKhh3]r½(j )r¾}r¿(h8X Prototype collect(HEADER header)h9jºh:h=h?j#hA}rÀ(hC]hD]hE]hF]hH]uhJKh3]rÁ(j&)rÂ}rÃ(h8X PrototyperÄh9j¾h:h=h?j*hA}rÅ(hC]hD]hE]hF]hH]uhJKh3]rÆhTX PrototyperÇ…rÈ}rÉ(h8jÄh9jÂubaubj0)rÊ}rË(h8UhA}rÌ(hC]hD]hE]hF]hH]uh9j¾h3]rÍh‚)rÎ}rÏ(h8Xcollect(HEADER header)rÐh9jÊh:h=h?h…hA}rÑ(hC]hD]hE]hF]hH]uhJKh3]rÒhTXcollect(HEADER header)rÓ…rÔ}rÕ(h8jÐh9jÎubaubah?j=ubeubj )rÖ}r×(h8XReturn value Voidh9jºh:h=h?j#hA}rØ(hC]hD]hE]hF]hH]uhJK‘hKhh3]rÙ(j&)rÚ}rÛ(h8X Return valuerÜh9jÖh:h=h?j*hA}rÝ(hC]hD]hE]hF]hH]uhJK‘h3]rÞhTX Return valuerß…rà}rá(h8jÜh9jÚubaubj0)râ}rã(h8UhA}rä(hC]hD]hE]hF]hH]uh9jÖh3]råh‚)ræ}rç(h8XVoidrèh9jâh:h=h?h…hA}ré(hC]hD]hE]hF]hH]uhJK’h3]rêhTXVoidrë…rì}rí(h8jèh9jæubaubah?j=ubeubj )rî}rï(h8X?Description Collapses the header, joining the headers into one.h9jºh:h=h?j#hA}rð(hC]hD]hE]hF]hH]uhJK“hKhh3]rñ(j&)rò}ró(h8X Descriptionrôh9jîh:h=h?j*hA}rõ(hC]hD]hE]hF]hH]uhJK“h3]röhTX Descriptionr÷…rø}rù(h8jôh9jòubaubj0)rú}rû(h8UhA}rü(hC]hD]hE]hF]hH]uh9jîh3]rýh‚)rþ}rÿ(h8X3Collapses the header, joining the headers into one.rh9júh:h=h?h…hA}r(hC]hD]hE]hF]hH]uhJK”h3]rhTX3Collapses the header, joining the headers into one.r…r}r(h8jh9jþubaubah?j=ubeubj )r}r(h8XpExample std.collect(req.http.cookie); This will collapse several Cookie: headers into one, long cookie header. h9jºh:h=h?j#hA}r(hC]hD]hE]hF]hH]uhJK™hKhh3]r (j&)r }r (h8XExampler h9jh:h=h?j*hA}r (hC]hD]hE]hF]hH]uhJK™h3]rhTXExampler…r}r(h8j h9j ubaubj0)r}r(h8UhA}r(hC]hD]hE]hF]hH]uh9jh3]rh‚)r}r(h8Xfstd.collect(req.http.cookie); This will collapse several Cookie: headers into one, long cookie header.rh9jh:h=h?h…hA}r(hC]hD]hE]hF]hH]uhJK–h3]rhTXfstd.collect(req.http.cookie); This will collapse several Cookie: headers into one, long cookie header.r…r}r(h8jh9jubaubah?j=ubeubeubeubeubh5)r}r(h8Uh9hXh:h=h?h@hA}r (hC]hD]hE]hF]r!h0ahH]r"hauhJKœhKhh3]r#(hM)r$}r%(h8XSEE ALSOr&h9jh:h=h?hQhA}r'(hC]hD]hE]hF]hH]uhJKœhKhh3]r(hTXSEE ALSOr)…r*}r+(h8j&h9j$ubaubcdocutils.nodes bullet_list r,)r-}r.(h8Uh9jh:h=h?U bullet_listr/hA}r0(Ubulletr1X*hF]hE]hC]hD]hH]uhJKžhKhh3]r2(cdocutils.nodes list_item r3)r4}r5(h8Xvcl(7)r6h9j-h:h=h?U list_itemr7hA}r8(hC]hD]hE]hF]hH]uhJNhKhh3]r9h‚)r:}r;(h8j6h9j4h:h=h?h…hA}r<(hC]hD]hE]hF]hH]uhJKžh3]r=hTXvcl(7)r>…r?}r@(h8j6h9j:ubaubaubj3)rA}rB(h8X varnishd(1) h9j-h:h=h?j7hA}rC(hC]hD]hE]hF]hH]uhJNhKhh3]rDh‚)rE}rF(h8X varnishd(1)rGh9jAh:h=h?h…hA}rH(hC]hD]hE]hF]hH]uhJKŸh3]rIhTX varnishd(1)rJ…rK}rL(h8jGh9jEubaubaubeubeubh5)rM}rN(h8Uh9hXh:h=h?h@hA}rO(hC]hD]hE]hF]rPh1ahH]rQhauhJK¢hKhh3]rR(hM)rS}rT(h8XHISTORYrUh9jMh:h=h?hQhA}rV(hC]hD]hE]hF]hH]uhJK¢hKhh3]rWhTXHISTORYrX…rY}rZ(h8jUh9jSubaubh‚)r[}r\(h8X•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.r]h9jMh:h=h?h…hA}r^(hC]hD]hE]hF]hH]uhJK¤hKhh3]r_hTX•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.r`…ra}rb(h8j]h9j[ubaubeubh5)rc}rd(h8Uh9hXh:h=h?h@hA}re(hC]hD]hE]hF]rfh#ahH]rghauhJK©hKhh3]rh(hM)ri}rj(h8X COPYRIGHTrkh9jch:h=h?hQhA}rl(hC]hD]hE]hF]hH]uhJK©hKhh3]rmhTX COPYRIGHTrn…ro}rp(h8jkh9jiubaubh‚)rq}rr(h8X\This document is licensed under the same licence as Varnish itself. See LICENCE for details.rsh9jch:h=h?h…hA}rt(hC]hD]hE]hF]hH]uhJK«hKhh3]ruhTX\This document is licensed under the same licence as Varnish itself. See LICENCE for details.rv…rw}rx(h8jsh9jqubaubj,)ry}rz(h8Uh9jch:h=h?j/hA}r{(j1X*hF]hE]hC]hD]hH]uhJK®hKhh3]r|j3)r}}r~(h8X#Copyright (c) 2011 Varnish Softwarerh9jyh:h=h?j7hA}r€(hC]hD]hE]hF]hH]uhJNhKhh3]rh‚)r‚}rƒ(h8jh9j}h:h=h?h…hA}r„(hC]hD]hE]hF]hH]uhJK®h3]r…hTX#Copyright (c) 2011 Varnish Softwarer†…r‡}rˆ(h8jh9j‚ubaubaubaubeubeubeubah8UU transformerr‰NU footnote_refsrŠ}r‹UrefnamesrŒ}rUsymbol_footnotesrŽ]rUautofootnote_refsr]r‘Usymbol_footnote_refsr’]r“U citationsr”]r•hKhU current_liner–NUtransform_messagesr—]r˜Ureporterr™NUid_startršKU autofootnotesr›]rœU citation_refsr}ržUindirect_targetsrŸ]r Usettingsr¡(cdocutils.frontend Values r¢or£}r¤(Ufootnote_backlinksr¥KUrecord_dependenciesr¦NU rfc_base_urlr§Uhttp://tools.ietf.org/html/r¨U tracebackr©ˆUpep_referencesrªNUstrip_commentsr«NU toc_backlinksr¬Uentryr­U language_coder®Uenr¯U datestampr°NU report_levelr±KU _destinationr²NU halt_levelr³KU strip_classesr´NhQNUerror_encoding_error_handlerrµUbackslashreplacer¶Udebugr·NUembed_stylesheetr¸‰Uoutput_encoding_error_handlerr¹UstrictrºU sectnum_xformr»KUdump_transformsr¼NU docinfo_xformr½KUwarning_streamr¾NUpep_file_url_templater¿Upep-%04drÀUexit_status_levelrÁKUconfigrÂNUstrict_visitorrÃNUcloak_email_addressesrĈUtrim_footnote_reference_spacerʼnUenvrÆNUdump_pseudo_xmlrÇNUexpose_internalsrÈNUsectsubtitle_xformrɉU source_linkrÊNUrfc_referencesrËNUoutput_encodingrÌUutf-8rÍU source_urlrÎNUinput_encodingrÏU utf-8-sigrÐU_disable_configrÑNU id_prefixrÒUU tab_widthrÓKUerror_encodingrÔUUTF-8rÕU_sourcerÖU6/home/tfheen/varnish/doc/sphinx/reference/vmod_std.rstr×Ugettext_compactr؈U generatorrÙNUdump_internalsrÚNU smart_quotesrÛ‰U pep_base_urlrÜUhttp://www.python.org/dev/peps/rÝUsyntax_highlightrÞUlongrßUinput_encoding_error_handlerràjºUauto_id_prefixráUidrâUdoctitle_xformrã‰Ustrip_elements_with_classesräNU _config_filesrå]Ufile_insertion_enabledræKU raw_enabledrçKU dump_settingsrèNubUsymbol_footnote_startréKUidsrê}rë(h!hþh0jh"hèh#jch)j“h(hXh.h6h&j–h'jh/j h*hÒh+jh,j h$j¬h%j‰h-jh1jMh2juUsubstitution_namesrì}ríh?hKhA}rî(hC]hF]hE]Usourceh=hD]hH]uU footnotesrï]rðUrefidsrñ}ròub.varnish-3.0.5/doc/sphinx/=build/doctrees/reference/varnish-cli.doctree0000644000175000017500000014647012247037213022735 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(XcommandsqNX descriptionqNX copyrightqNXvarnishq NXsyntaxq NXexamplesq NXdetails on authenticationq NXban expressionsq NXsee alsoqNXvarnish command line interfaceqNX scriptingqNXhistoryqNuUsubstitution_defsq}qUparse_messagesq]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hUcommandsqhU descriptionqhU copyrightqh Uvarnishqh Usyntaxqh Uexamplesq h Udetails-on-authenticationq!h Uban-expressionsq"hUsee-alsoq#hUvarnish-command-line-interfaceq$hU scriptingq%hUhistoryq&uUchildrenq']q(cdocutils.nodes section q))q*}q+(U rawsourceq,UUparentq-hUsourceq.cdocutils.nodes reprunicode q/X9/home/tfheen/varnish/doc/sphinx/reference/varnish-cli.rstq0…q1}q2bUtagnameq3Usectionq4U attributesq5}q6(Udupnamesq7]Uclassesq8]Ubackrefsq9]Uidsq:]q;haUnamesq<]q=h auUlineq>KUdocumentq?hh']q@(cdocutils.nodes title qA)qB}qC(h,XvarnishqDh-h*h.h1h3UtitleqEh5}qF(h7]h8]h9]h:]h<]uh>Kh?hh']qGcdocutils.nodes Text qHXvarnishqI…qJ}qK(h,hDh-hBubaubh))qL}qM(h,Uh-h*h.h1h3h4h5}qN(h7]h8]h9]h:]qOh$ah<]qPhauh>Kh?hh']qQ(hA)qR}qS(h,XVarnish Command Line InterfaceqTh-hLh.h1h3hEh5}qU(h7]h8]h9]h:]h<]uh>Kh?hh']qVhHXVarnish Command Line InterfaceqW…qX}qY(h,hTh-hRubaubcdocutils.nodes field_list qZ)q[}q\(h,Uh-hLh.h1h3U field_listq]h5}q^(h7]h8]h9]h:]h<]uh>K h?hh']q_(cdocutils.nodes field q`)qa}qb(h,Uh-h[h.h1h3Ufieldqch5}qd(h7]h8]h9]h:]h<]uh>K h?hh']qe(cdocutils.nodes field_name qf)qg}qh(h,XAuthorqih5}qj(h7]h8]h9]h:]h<]uh-hah']qkhHXAuthorql…qm}qn(h,hih-hgubah3U field_nameqoubcdocutils.nodes field_body qp)qq}qr(h,XPer Buerqsh5}qt(h7]h8]h9]h:]h<]uh-hah']qucdocutils.nodes paragraph qv)qw}qx(h,hsh-hqh.h1h3U paragraphqyh5}qz(h7]h8]h9]h:]h<]uh>K h']q{hHXPer Buerq|…q}}q~(h,hsh-hwubaubah3U field_bodyqubeubh`)q€}q(h,Uh-h[h.h1h3hch5}q‚(h7]h8]h9]h:]h<]uh>K h?hh']qƒ(hf)q„}q…(h,XDateq†h5}q‡(h7]h8]h9]h:]h<]uh-h€h']qˆhHXDateq‰…qŠ}q‹(h,h†h-h„ubah3houbhp)qŒ}q(h,X 2011-03-23qŽh5}q(h7]h8]h9]h:]h<]uh-h€h']qhv)q‘}q’(h,hŽh-hŒh.h1h3hyh5}q“(h7]h8]h9]h:]h<]uh>K h']q”hHX 2011-03-23q•…q–}q—(h,hŽh-h‘ubaubah3hubeubh`)q˜}q™(h,Uh-h[h.h1h3hch5}qš(h7]h8]h9]h:]h<]uh>K h?hh']q›(hf)qœ}q(h,XVersionqžh5}qŸ(h7]h8]h9]h:]h<]uh-h˜h']q hHXVersionq¡…q¢}q£(h,hžh-hœubah3houbhp)q¤}q¥(h,X0.1q¦h5}q§(h7]h8]h9]h:]h<]uh-h˜h']q¨hv)q©}qª(h,h¦h-h¤h.h1h3hyh5}q«(h7]h8]h9]h:]h<]uh>K h']q¬hHX0.1q­…q®}q¯(h,h¦h-h©ubaubah3hubeubh`)q°}q±(h,Uh-h[h.h1h3hch5}q²(h7]h8]h9]h:]h<]uh>K h?hh']q³(hf)q´}qµ(h,XManual sectionq¶h5}q·(h7]h8]h9]h:]h<]uh-h°h']q¸hHXManual sectionq¹…qº}q»(h,h¶h-h´ubah3houbhp)q¼}q½(h,X7 h5}q¾(h7]h8]h9]h:]h<]uh-h°h']q¿hv)qÀ}qÁ(h,X7h-h¼h.h1h3hyh5}qÂ(h7]h8]h9]h:]h<]uh>K h']qÃhHX7…qÄ}qÅ(h,X7h-hÀubaubah3hubeubeubh))qÆ}qÇ(h,Uh-hLh.h1h3h4h5}qÈ(h7]h8]h9]h:]qÉhah<]qÊhauh>Kh?hh']qË(hA)qÌ}qÍ(h,X DESCRIPTIONqÎh-hÆh.h1h3hEh5}qÏ(h7]h8]h9]h:]h<]uh>Kh?hh']qÐhHX DESCRIPTIONqÑ…qÒ}qÓ(h,hÎh-hÌubaubhv)qÔ}qÕ(h,Xµ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.qÖh-hÆh.h1h3hyh5}q×(h7]h8]h9]h:]h<]uh>Kh?hh']qØhHXµ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.qÙ…qÚ}qÛ(h,hÖh-hÔubaubhv)qÜ}qÝ(h,X,The CLI can be used for the following tasks:qÞh-hÆh.h1h3hyh5}qß(h7]h8]h9]h:]h<]uh>Kh?hh']qàhHX,The CLI can be used for the following tasks:qá…qâ}qã(h,hÞh-hÜubaubcdocutils.nodes definition_list qä)qå}qæ(h,Uh-hÆh.h1h3Udefinition_listqçh5}qè(h7]h8]h9]h:]h<]uh>Nh?hh']qé(cdocutils.nodes definition_list_item qê)që}qì(h,XHconfiguration You can upload, change and delete VCL files from the CLI. h-håh.h1h3Udefinition_list_itemqíh5}qî(h7]h8]h9]h:]h<]uh>Kh']qï(cdocutils.nodes term qð)qñ}qò(h,X configurationqóh-hëh.h1h3Utermqôh5}qõ(h7]h8]h9]h:]h<]uh>Kh']qöhHX configurationq÷…qø}qù(h,hóh-hñubaubcdocutils.nodes definition qú)qû}qü(h,Uh5}qý(h7]h8]h9]h:]h<]uh-hëh']qþhv)qÿ}r(h,X9You can upload, change and delete VCL files from the CLI.rh-hûh.h1h3hyh5}r(h7]h8]h9]h:]h<]uh>Kh']rhHX9You can upload, change and delete VCL files from the CLI.r…r}r(h,jh-hÿubaubah3U definitionrubeubhê)r}r (h,Xª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. h-håh.h1h3híh5}r (h7]h8]h9]h:]h<]uh>Kh?hh']r (hð)r }r (h,X parametersrh-jh.h1h3hôh5}r(h7]h8]h9]h:]h<]uh>Kh']rhHX parametersr…r}r(h,jh-j ubaubhú)r}r(h,Uh5}r(h7]h8]h9]h:]h<]uh-jh']rhv)r}r(h,Xž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.rh-jh.h1h3hyh5}r(h7]h8]h9]h:]h<]uh>Kh']rhHXž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.r…r}r(h,jh-jubaubah3jubeubhê)r }r!(h,XÐ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. h-håh.h1h3híh5}r"(h7]h8]h9]h:]h<]uh>K#h?hh']r#(hð)r$}r%(h,Xbansr&h-j h.h1h3hôh5}r'(h7]h8]h9]h:]h<]uh>K#h']r(hHXbansr)…r*}r+(h,j&h-j$ubaubhú)r,}r-(h,Uh5}r.(h7]h8]h9]h:]h<]uh-j h']r/hv)r0}r1(h,XÊ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.h-j,h.h1h3hyh5}r2(h7]h8]h9]h:]h<]uh>K h']r3(hHX~Bans are filters that are applied to keep Varnish from serving stale content. When you issue a ban Varnish will not serve any r4…r5}r6(h,X~Bans are filters that are applied to keep Varnish from serving stale content. When you issue a ban Varnish will not serve any h-j0ubcdocutils.nodes emphasis r7)r8}r9(h,X*banned*h5}r:(h7]h8]h9]h:]h<]uh-j0h']r;hHXbannedr<…r=}r>(h,Uh-j8ubah3Uemphasisr?ubhHXD object from cache, but rather re-fetch it from its backend servers.r@…rA}rB(h,XD object from cache, but rather re-fetch it from its backend servers.h-j0ubeubah3jubeubhê)rC}rD(h,X£process management You can stop and start the cache (child) process though the CLI. You can also retrieve the lastst stack trace if the child process has crashed. h-håh.h1h3híh5}rE(h7]h8]h9]h:]h<]uh>K(h?hh']rF(hð)rG}rH(h,Xprocess managementrIh-jCh.h1h3hôh5}rJ(h7]h8]h9]h:]h<]uh>K(h']rKhHXprocess managementrL…rM}rN(h,jIh-jGubaubhú)rO}rP(h,Uh5}rQ(h7]h8]h9]h:]h<]uh-jCh']rRhv)rS}rT(h,XYou can stop and start the cache (child) process though the CLI. You can also retrieve the lastst stack trace if the child process has crashed.rUh-jOh.h1h3hyh5}rV(h7]h8]h9]h:]h<]uh>K&h']rWhHXYou can stop and start the cache (child) process though the CLI. You can also retrieve the lastst stack trace if the child process has crashed.rX…rY}rZ(h,jUh-jSubaubah3jubeubeubhv)r[}r\(h,X9If 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(1) for details.h-hÆh.h1h3hyh5}r](h7]h8]h9]h:]h<]uh>K*h?hh']r^(hHXó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 r_…r`}ra(h,Xó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 h-j[ubj7)rb}rc(h,X *pushing*h5}rd(h7]h8]h9]h:]h<]uh-j[h']rehHXpushingrf…rg}rh(h,Uh-jbubah3j?ubhHX= the CLI to that service. Please see varnishd(1) for details.ri…rj}rk(h,X= the CLI to that service. Please see varnishd(1) for details.h-j[ubeubh))rl}rm(h,Uh-hÆh.h1h3h4h5}rn(h7]h8]h9]h:]rohah<]rph auh>K2h?hh']rq(hA)rr}rs(h,XSyntaxrth-jlh.h1h3hEh5}ru(h7]h8]h9]h:]h<]uh>K2h?hh']rvhHXSyntaxrw…rx}ry(h,jth-jrubaubhv)rz}r{(h,XŽCommands are usually terminated with a newline. Long command can be entered using sh style *here documents*. The format of here-documents is::h-jlh.h1h3hyh5}r|(h7]h8]h9]h:]h<]uh>K4h?hh']r}(hHX[Commands are usually terminated with a newline. Long command can be entered using sh style r~…r}r€(h,X[Commands are usually terminated with a newline. Long command can be entered using sh style h-jzubj7)r}r‚(h,X*here documents*h5}rƒ(h7]h8]h9]h:]h<]uh-jzh']r„hHXhere documentsr……r†}r‡(h,Uh-jubah3j?ubhHX". The format of here-documents is:rˆ…r‰}rŠ(h,X". The format of here-documents is:h-jzubeubcdocutils.nodes literal_block r‹)rŒ}r(h,X<< word here document wordh-jlh.h1h3U literal_blockrŽh5}r(U xml:spacerUpreserver‘h:]h9]h7]h8]h<]uh>K8h?hh']r’hHX<< word here document wordr“…r”}r•(h,Uh-jŒubaubhv)r–}r—(h,Xv*word* can be any continuous string choosen to make sure it doesn't appear naturally in the following *here document*.h-jlh.h1h3hyh5}r˜(h7]h8]h9]h:]h<]uh>KK?h?hh']r°(hHX¬When using the here document style of input there are no restrictions on lenght. When using newline-terminated commands maximum lenght is limited by the varnishd parameter r±…r²}r³(h,X¬When using the here document style of input there are no restrictions on lenght. When using newline-terminated commands maximum lenght is limited by the varnishd parameter h-j­ubj7)r´}rµ(h,X *cli_buffer*h5}r¶(h7]h8]h9]h:]h<]uh-j­h']r·hHX cli_bufferr¸…r¹}rº(h,Uh-j´ubah3j?ubhHX.…r»}r¼(h,X.h-j­ubeubhv)r½}r¾(h,XHWhen 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, carrage returns and tabs. Double quotes themselves can be escaped with a backslash.h-jlh.h1h3hyh5}r¿(h7]h8]h9]h:]h<]uh>KCh?hh']rÀ(hHX.When commands are newline terminated they get rÁ…rÂ}rÃ(h,X.When commands are newline terminated they get h-j½ubj7)rÄ}rÅ(h,X *tokenized*h5}rÆ(h7]h8]h9]h:]h<]uh-j½h']rÇhHX tokenizedrÈ…rÉ}rÊ(h,Uh-jÄubah3j?ubhHX  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, carrage returns and tabs. Double quotes themselves can be escaped with a backslash.rË…rÌ}rÍ(h,X 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, carrage returns and tabs. Double quotes themselves can be escaped with a backslash.h-j½ubeubhv)rÎ}rÏ(h,XfTo enter characters in octals use the \\nnn syntax. Hexadecimals can be entered with the \\xnn syntax.h-jlh.h1h3hyh5}rÐ(h7]h8]h9]h:]h<]uh>KIh?hh']rÑhHXdTo enter characters in octals use the \nnn syntax. Hexadecimals can be entered with the \xnn syntax.rÒ…rÓ}rÔ(h,XfTo enter characters in octals use the \\nnn syntax. Hexadecimals can be entered with the \\xnn syntax.h-jÎubaubeubh))rÕ}rÖ(h,Uh-hÆh.h1h3h4h5}r×(h7]h8]h9]h:]rØhah<]rÙhauh>KMh?hh']rÚ(hA)rÛ}rÜ(h,XCommandsrÝh-jÕh.h1h3hEh5}rÞ(h7]h8]h9]h:]h<]uh>KMh?hh']rßhHXCommandsrà…rá}râ(h,jÝh-jÛubaubcsphinx.addnodes glossary rã)rä}rå(h,Uh-jÕh.h1h3Uglossaryræh5}rç(h7]h8]h9]h:]h<]uh>Nh?hh']rèhä)ré}rê(h,Uh-jäh.h1h3hçh5}rë(h7]h8]rìjæah9]h:]h<]uh>Nh?hh']rí(hê)rî}rï(h,Uh5}rð(h7]h8]h9]h:]h<]uh-jéh']rñ(hð)rò}ró(h,Uh5}rô(h7]h8]h9]h:]rõUterm-backend-liströah<]r÷jöauh-jîh']rø(csphinx.addnodes index rù)rú}rû(h,Uh5}rü(h:]h9]h7]h8]h<]Uentriesrý]rþ(UsinglerÿX backend.listrjöUmainrtrauh-jòh']h3UindexrubhHX backend.listr…r}r(h,X backend.listh-jòubeh3hôubhú)r}r(h,Uh5}r (h7]h8]h9]h:]h<]uh-jîh']r hv)r }r (h,X2Lists the defined backends including health state.r h-jh.h1h3hyh5}r(h7]h8]h9]h:]h<]uh>K»h']rhHX2Lists the defined backends including health state.r…r}r(h,j h-j ubaubah3jubeh3híubhê)r}r(h,Uh5}r(h7]h8]h9]h:]h<]uh-jéh']r(hð)r}r(h,Uh5}r(h7]h8]h9]h:]rU%term-backend-set-health-matcher-staterah<]rjauh-jh']r(jù)r}r(h,Uh5}r (h:]h9]h7]h8]h<]jý]r!(jÿX backend.set_health matcher stater"jjtr#auh-jh']h3jubhHX backend.set_health matcher stater$…r%}r&(h,X backend.set_health matcher stateh-jubeh3hôubhú)r'}r((h,Uh5}r)(h7]h8]h9]h:]h<]uh-jh']r*hv)r+}r,(h,XvSets the health state on a specific backend. This is useful if you want to take a certain backend out of sirculations.r-h-j'h.h1h3hyh5}r.(h7]h8]h9]h:]h<]uh>K¾h']r/hHXvSets the health state on a specific backend. This is useful if you want to take a certain backend out of sirculations.r0…r1}r2(h,j-h-j+ubaubah3jubeh3híubhê)r3}r4(h,Uh5}r5(h7]h8]h9]h:]h<]uh-jéh']r6(hð)r7}r8(h,Uh5}r9(h7]h8]h9]h:]r:U8term-ban-field-operator-argument-field-operator-argumentr;ah<]r<j;auh-j3h']r=(jù)r>}r?(h,Uh5}r@(h:]h9]h7]h8]h<]jý]rA(jÿX@ban field operator argument [&& field operator argument [...]]rBj;jtrCauh-j7h']h3jubhHXban rD…rE}rF(h,Xban h-j7ubj7)rG}rH(h,X*field operator argument*h5}rI(h7]h8]h9]h:]h<]uh-j7h']rJhHXfield operator argumentrK…rL}rM(h,Uh-jGubah3j?ubhHX# [&& field operator argument [...]]rN…rO}rP(h,X# [&& field operator argument [...]]h-j7ubeh3hôubhú)rQ}rR(h,Uh5}rS(h7]h8]h9]h:]h<]uh-j3h']rThv)rU}rV(h,X}Immediately invalidate all documents matching the ban expression. See *Ban Expressions* for more documentation and examples.h-jQh.h1h3hyh5}rW(h7]h8]h9]h:]h<]uh>Kgh']rX(hHXGImmediately invalidate all documents matching the ban expression. See rY…rZ}r[(h,XGImmediately invalidate all documents matching the ban expression. See h-jUubj7)r\}r](h,X*Ban Expressions*h5}r^(h7]h8]h9]h:]h<]uh-jUh']r_hHXBan Expressionsr`…ra}rb(h,Uh-j\ubah3j?ubhHX% for more documentation and examples.rc…rd}re(h,X% for more documentation and examples.h-jUubeubah3jubeh3híubhê)rf}rg(h,Uh5}rh(h7]h8]h9]h:]h<]uh-jéh']ri(hð)rj}rk(h,Uh5}rl(h7]h8]h9]h:]rmU term-ban-listrnah<]rojnauh-jfh']rp(jù)rq}rr(h,Uh5}rs(h:]h9]h7]h8]h<]jý]rt(jÿXban.listrujnjtrvauh-jjh']h3jubhHXban.listrw…rx}ry(h,Xban.listh-jjubeh3hôubhú)rz}r{(h,Uh5}r|(h7]h8]h9]h:]h<]uh-jfh']r}(hv)r~}r(h,XÞAll requests for objects from the cache are matched against items on the ban list. If an object in the cache is older than a matching ban list item, it is considered "banned", and will be fetched from the backend instead.r€h-jzh.h1h3hyh5}r(h7]h8]h9]h:]h<]uh>Klh']r‚hHXÞAll requests for objects from the cache are matched against items on the ban list. If an object in the cache is older than a matching ban list item, it is considered "banned", and will be fetched from the backend instead.rƒ…r„}r…(h,j€h-j~ubaubhv)r†}r‡(h,X^When a ban expression is older than all the objects in the cache, it is removed from the list.rˆh-jzh.h1h3hyh5}r‰(h7]h8]h9]h:]h<]uh>Kqh']rŠhHX^When a ban expression is older than all the objects in the cache, it is removed from the list.r‹…rŒ}r(h,jˆh-j†ubaubhv)rŽ}r(h,X]ban.list displays the ban list. The output looks something like this (broken into two lines):rh-jzh.h1h3hyh5}r‘(h7]h8]h9]h:]h<]uh>Kth']r’hHX]ban.list displays the ban list. The output looks something like this (broken into two lines):r“…r”}r•(h,jh-jŽubaubhv)r–}r—(h,X_0x7fea4fcb0580 1303835108.618863 131G req.http.host ~ www.myhost.com && req.url ~ /some/urlr˜h-jzh.h1h3hyh5}r™(h7]h8]h9]h:]h<]uh>Kwh']ršhHX_0x7fea4fcb0580 1303835108.618863 131G req.http.host ~ www.myhost.com && req.url ~ /some/urlr›…rœ}r(h,j˜h-j–ubaubhv)rž}rŸ(h,X*The first field is the address of the ban.r h-jzh.h1h3hyh5}r¡(h7]h8]h9]h:]h<]uh>Kzh']r¢hHX*The first field is the address of the ban.r£…r¤}r¥(h,j h-jžubaubhv)r¦}r§(h,XSThe second is the time of entry into the list, given as a high precision timestamp.r¨h-jzh.h1h3hyh5}r©(h7]h8]h9]h:]h<]uh>K|h']rªhHXSThe second is the time of entry into the list, given as a high precision timestamp.r«…r¬}r­(h,j¨h-j¦ubaubhv)r®}r¯(h,XÞThe third field describes many objects point to this ban. When an object is compared to a ban the object is marked with a reference to the newest ban it was tested against. This isn't really useful unless you're debugging.r°h-jzh.h1h3hyh5}r±(h7]h8]h9]h:]h<]uh>Kh']r²hHXÞThe third field describes many objects point to this ban. When an object is compared to a ban the object is marked with a reference to the newest ban it was tested against. This isn't really useful unless you're debugging.r³…r´}rµ(h,j°h-j®ubaubhv)r¶}r·(h,X’A "G" marks that the ban is "Gone". Meaning it has been marked as a duplicate or it is no longer valid. It stays in the list for effiency reasons.r¸h-jzh.h1h3hyh5}r¹(h7]h8]h9]h:]h<]uh>K„h']rºhHX’A "G" marks that the ban is "Gone". Meaning it has been marked as a duplicate or it is no longer valid. It stays in the list for effiency reasons.r»…r¼}r½(h,j¸h-j¶ubaubhv)r¾}r¿(h,X$Then follows the actual ban it self.rÀh-jzh.h1h3hyh5}rÁ(h7]h8]h9]h:]h<]uh>Kˆh']rÂhHX$Then follows the actual ban it self.rÃ…rÄ}rÅ(h,jÀh-j¾ubaubeh3jubeh3híubhê)rÆ}rÇ(h,Uh5}rÈ(h7]h8]h9]h:]h<]uh-jéh']rÉ(hð)rÊ}rË(h,Uh5}rÌ(h7]h8]h9]h:]rÍUterm-ban-url-regexprÎah<]rÏjÎauh-jÆh']rÐ(jù)rÑ}rÒ(h,Uh5}rÓ(h:]h9]h7]h8]h<]jý]rÔ(jÿXban.url regexprÕjÎjtrÖauh-jÊh']h3jubhHXban.url regexpr×…rØ}rÙ(h,Xban.url regexph-jÊubeh3hôubhú)rÚ}rÛ(h,Uh5}rÜ(h7]h8]h9]h:]h<]uh-jÆh']rÝhv)rÞ}rß(h,XImmediately invalidate all documents whose URL matches the specified regular expression. Please note that the Host part of the URL is ignored, so if you have several virtual hosts all of them will be banned. Use *ban* to specify a complete ban if you need to narrow it down.h-jÚh.h1h3hyh5}rà(h7]h8]h9]h:]h<]uh>K‹h']rá(hHXÔImmediately invalidate all documents whose URL matches the specified regular expression. Please note that the Host part of the URL is ignored, so if you have several virtual hosts all of them will be banned. Use râ…rã}rä(h,XÔImmediately invalidate all documents whose URL matches the specified regular expression. Please note that the Host part of the URL is ignored, so if you have several virtual hosts all of them will be banned. Use h-jÞubj7)rå}ræ(h,X*ban*h5}rç(h7]h8]h9]h:]h<]uh-jÞh']rèhHXbanré…rê}rë(h,Uh-jåubah3j?ubhHX9 to specify a complete ban if you need to narrow it down.rì…rí}rî(h,X9 to specify a complete ban if you need to narrow it down.h-jÞubeubah3jubeh3híubhê)rï}rð(h,Uh5}rñ(h7]h8]h9]h:]h<]uh-jéh']rò(hð)ró}rô(h,Uh5}rõ(h7]h8]h9]h:]röUterm-help-commandr÷ah<]røj÷auh-jïh']rù(jù)rú}rû(h,Uh5}rü(h:]h9]h7]h8]h<]jý]rý(jÿXhelp [command]rþj÷jtrÿauh-jóh']h3jubhHXhelp [command]r…r}r(h,Xhelp [command]h-jóubeh3hôubhú)r}r(h,Uh5}r(h7]h8]h9]h:]h<]uh-jïh']rhv)r}r(h,XaDisplay a list of available commands. If the command is specified, display help for this command.r h-jh.h1h3hyh5}r (h7]h8]h9]h:]h<]uh>KSh']r hHXaDisplay a list of available commands. If the command is specified, display help for this command.r …r }r(h,j h-jubaubah3jubeh3híubhê)r}r(h,Uh5}r(h7]h8]h9]h:]h<]uh-jéh']r(hð)r}r(h,Uh5}r(h7]h8]h9]h:]rUterm-param-set-param-valuerah<]rjauh-jh']r(jù)r}r(h,Uh5}r(h:]h9]h7]h8]h<]jý]r(jÿXparam.set param valuerjjtrauh-jh']h3jubhHXparam.set param valuer …r!}r"(h,Xparam.set param valueh-jubeh3hôubhú)r#}r$(h,Uh5}r%(h7]h8]h9]h:]h<]uh-jh']r&hv)r'}r((h,XrSet the parameter specified by param to the specified value. See Run-Time Parameters for a list of parame†ters.r)h-j#h.h1h3hyh5}r*(h7]h8]h9]h:]h<]uh>KWh']r+hHXrSet the parameter specified by param to the specified value. See Run-Time Parameters for a list of parame†ters.r,…r-}r.(h,j)h-j'ubaubah3jubeh3híubhê)r/}r0(h,Uh5}r1(h7]h8]h9]h:]h<]uh-jéh']r2(hð)r3}r4(h,Uh5}r5(h7]h8]h9]h:]r6Uterm-param-show-l-paramr7ah<]r8j7auh-j/h']r9(jù)r:}r;(h,Uh5}r<(h:]h9]h7]h8]h<]jý]r=(jÿXparam.show [-l] [param]r>j7jtr?auh-j3h']h3jubhHXparam.show [-l] [param]r@…rA}rB(h,Xparam.show [-l] [param]h-j3ubeh3hôubhú)rC}rD(h,Uh5}rE(h7]h8]h9]h:]h<]uh-j/h']rF(hv)rG}rH(h,X7Display a list if run-time parameters and their values.rIh-jCh.h1h3hyh5}rJ(h7]h8]h9]h:]h<]uh>K[h']rKhHX7Display a list if run-time parameters and their values.rL…rM}rN(h,jIh-jGubaubhv)rO}rP(h,XWIf the -l option is specified, the list includes a brief explanation of each parameter.rQh-jCh.h1h3hyh5}rR(h7]h8]h9]h:]h<]uh>K]h']rShHXWIf the -l option is specified, the list includes a brief explanation of each parameter.rT…rU}rV(h,jQh-jOubaubhv)rW}rX(h,XSIf a param is specified, display only the value and explanation for this parameter.rYh-jCh.h1h3hyh5}rZ(h7]h8]h9]h:]h<]uh>K`h']r[hHXSIf a param is specified, display only the value and explanation for this parameter.r\…r]}r^(h,jYh-jWubaubeh3jubeh3híubhê)r_}r`(h,Uh5}ra(h7]h8]h9]h:]h<]uh-jéh']rb(hð)rc}rd(h,Uh5}re(h7]h8]h9]h:]rfUterm-ping-timestamprgah<]rhjgauh-j_h']ri(jù)rj}rk(h,Uh5}rl(h:]h9]h7]h8]h<]jý]rm(jÿXping [timestamp]rnjgjtroauh-jch']h3jubhHXping [timestamp]rp…rq}rr(h,Xping [timestamp]h-jcubeh3hôubhú)rs}rt(h,Uh5}ru(h7]h8]h9]h:]h<]uh-j_h']rvhv)rw}rx(h,X=Ping the Varnish cache process, keeping the connection alive.ryh-jsh.h1h3hyh5}rz(h7]h8]h9]h:]h<]uh>Kdh']r{hHX=Ping the Varnish cache process, keeping the connection alive.r|…r}}r~(h,jyh-jwubaubah3jubeh3híubhê)r}r€(h,Uh5}r(h7]h8]h9]h:]h<]uh-jéh']r‚(hð)rƒ}r„(h,Uh5}r…(h7]h8]h9]h:]r†U term-quitr‡ah<]rˆj‡auh-jh']r‰(jù)rŠ}r‹(h,Uh5}rŒ(h:]h9]h7]h8]h<]jý]r(jÿXquitrŽj‡jtrauh-jƒh']h3jubhHXquitr…r‘}r’(h,Xquith-jƒubeh3hôubhú)r“}r”(h,Uh5}r•(h7]h8]h9]h:]h<]uh-jh']r–hv)r—}r˜(h,X/Close the connection to the varnish admin port.r™h-j“h.h1h3hyh5}rš(h7]h8]h9]h:]h<]uh>K’h']r›hHX/Close the connection to the varnish admin port.rœ…r}rž(h,j™h-j—ubaubah3jubeh3híubhê)rŸ}r (h,Uh5}r¡(h7]h8]h9]h:]h<]uh-jéh']r¢(hð)r£}r¤(h,Uh5}r¥(h7]h8]h9]h:]r¦U term-startr§ah<]r¨j§auh-jŸh']r©(jù)rª}r«(h,Uh5}r¬(h:]h9]h7]h8]h<]jý]r­(jÿXstartr®j§jtr¯auh-j£h']h3jubhHXstartr°…r±}r²(h,Xstarth-j£ubeh3hôubhú)r³}r´(h,Uh5}rµ(h7]h8]h9]h:]h<]uh-jŸh']r¶hv)r·}r¸(h,X=Start the Varnish cache process if it is not already running.r¹h-j³h.h1h3hyh5}rº(h7]h8]h9]h:]h<]uh>K•h']r»hHX=Start the Varnish cache process if it is not already running.r¼…r½}r¾(h,j¹h-j·ubaubah3jubeh3híubhê)r¿}rÀ(h,Uh5}rÁ(h7]h8]h9]h:]h<]uh-jéh']rÂ(hð)rÃ}rÄ(h,Uh5}rÅ(h7]h8]h9]h:]rÆU term-statusrÇah<]rÈjÇauh-j¿h']rÉ(jù)rÊ}rË(h,Uh5}rÌ(h:]h9]h7]h8]h<]jý]rÍ(jÿXstatusrÎjÇjtrÏauh-jÃh']h3jubhHXstatusrÐ…rÑ}rÒ(h,Xstatush-jÃubeh3hôubhú)rÓ}rÔ(h,Uh5}rÕ(h7]h8]h9]h:]h<]uh-j¿h']rÖhv)r×}rØ(h,X.Check the status of the Varnish cache process.rÙh-jÓh.h1h3hyh5}rÚ(h7]h8]h9]h:]h<]uh>K˜h']rÛhHX.Check the status of the Varnish cache process.rÜ…rÝ}rÞ(h,jÙh-j×ubaubah3jubeh3híubhê)rß}rà(h,Uh5}rá(h7]h8]h9]h:]h<]uh-jéh']râ(hð)rã}rä(h,Uh5}rå(h7]h8]h9]h:]ræU term-stoprçah<]rèjçauh-jßh']ré(jù)rê}rë(h,Uh5}rì(h:]h9]h7]h8]h<]jý]rí(jÿXstoprîjçjtrïauh-jãh']h3jubhHXstoprð…rñ}rò(h,Xstoph-jãubeh3hôubhú)ró}rô(h,Uh5}rõ(h7]h8]h9]h:]h<]uh-jßh']röhv)r÷}rø(h,XStop the Varnish cache process.rùh-jóh.h1h3hyh5}rú(h7]h8]h9]h:]h<]uh>K›h']rûhHXStop the Varnish cache process.rü…rý}rþ(h,jùh-j÷ubaubah3jubeh3híubhê)rÿ}r(h,Uh5}r(h7]h8]h9]h:]h<]uh-jéh']r(hð)r}r(h,Uh5}r(h7]h8]h9]h:]rUterm-storage-listrah<]rjauh-jÿh']r (jù)r }r (h,Uh5}r (h:]h9]h7]h8]h<]jý]r (jÿX storage.listrjjtrauh-jh']h3jubhHX storage.listr…r}r(h,X storage.listh-jubeh3hôubhú)r}r(h,Uh5}r(h7]h8]h9]h:]h<]uh-jÿh']rhv)r}r(h,X#Lists the defined storage backends.rh-jh.h1h3hyh5}r(h7]h8]h9]h:]h<]uh>K¸h']rhHX#Lists the defined storage backends.r…r}r(h,jh-jubaubah3jubeh3híubhê)r}r (h,Uh5}r!(h7]h8]h9]h:]h<]uh-jéh']r"(hð)r#}r$(h,Uh5}r%(h7]h8]h9]h:]r&Uterm-vcl-discard-confignamer'ah<]r(j'auh-jh']r)(jù)r*}r+(h,Uh5}r,(h:]h9]h7]h8]h<]jý]r-(jÿXvcl.discard confignamer.j'jtr/auh-j#h']h3jubhHXvcl.discard confignamer0…r1}r2(h,Xvcl.discard confignameh-j#ubeh3hôubhú)r3}r4(h,Uh5}r5(h7]h8]h9]h:]h<]uh-jh']r6hv)r7}r8(h,X‹Discard the configuration specified by configname. This will have no effect if the specified configuration has a non-zero reference count.r9h-j3h.h1h3hyh5}r:(h7]h8]h9]h:]h<]uh>Kžh']r;hHX‹Discard the configuration specified by configname. This will have no effect if the specified configuration has a non-zero reference count.r<…r=}r>(h,j9h-j7ubaubah3jubeh3híubhê)r?}r@(h,Uh5}rA(h7]h8]h9]h:]h<]uh-jéh']rB(hð)rC}rD(h,Uh5}rE(h7]h8]h9]h:]rFUterm-vcl-inline-configname-vclrGah<]rHjGauh-j?h']rI(jù)rJ}rK(h,Uh5}rL(h:]h9]h7]h8]h<]jý]rM(jÿXvcl.inline configname vclrNjGjtrOauh-jCh']h3jubhHXvcl.inline configname vclrP…rQ}rR(h,Xvcl.inline configname vclh-jCubeh3hôubhú)rS}rT(h,Uh5}rU(h7]h8]h9]h:]h<]uh-j?h']rVhv)rW}rX(h,XnCreate a new configuration named configname with the VCL code specified by vcl, which must be a quoted string.rYh-jSh.h1h3hyh5}rZ(h7]h8]h9]h:]h<]uh>K£h']r[hHXnCreate a new configuration named configname with the VCL code specified by vcl, which must be a quoted string.r\…r]}r^(h,jYh-jWubaubah3jubeh3híubhê)r_}r`(h,Uh5}ra(h7]h8]h9]h:]h<]uh-jéh']rb(hð)rc}rd(h,Uh5}re(h7]h8]h9]h:]rfU term-vcl-listrgah<]rhjgauh-j_h']ri(jù)rj}rk(h,Uh5}rl(h:]h9]h7]h8]h<]jý]rm(jÿXvcl.listrnjgjtroauh-jch']h3jubhHXvcl.listrp…rq}rr(h,Xvcl.listh-jcubeh3hôubhú)rs}rt(h,Uh5}ru(h7]h8]h9]h:]h<]uh-j_h']rvhv)rw}rx(h,XƒList available configurations and their respective reference counts. The active configuration is indicated with an asterisk ("*").h-jsh.h1h3hyh5}ry(h7]h8]h9]h:]h<]uh>K§h']rzhHXƒList available configurations and their respective reference counts. The active configuration is indicated with an asterisk ("*").r{…r|}r}(h,XƒList available configurations and their respective reference counts. The active configuration is indicated with an asterisk ("*").h-jwubaubah3jubeh3híubhê)r~}r(h,Uh5}r€(h7]h8]h9]h:]h<]uh-jéh']r(hð)r‚}rƒ(h,Uh5}r„(h7]h8]h9]h:]r…U!term-vcl-load-configname-filenamer†ah<]r‡j†auh-j~h']rˆ(jù)r‰}rŠ(h,Uh5}r‹(h:]h9]h7]h8]h<]jý]rŒ(jÿXvcl.load configname filenamerj†jtrŽauh-j‚h']h3jubhHXvcl.load configname filenamer…r}r‘(h,Xvcl.load configname filenameh-j‚ubeh3hôubhú)r’}r“(h,Uh5}r”(h7]h8]h9]h:]h<]uh-j~h']r•hv)r–}r—(h,XTCreate a new configuration named configname with the contents of the specified file.r˜h-j’h.h1h3hyh5}r™(h7]h8]h9]h:]h<]uh>K¬h']ršhHXTCreate a new configuration named configname with the contents of the specified file.r›…rœ}r(h,j˜h-j–ubaubah3jubeh3híubhê)rž}rŸ(h,Uh5}r (h7]h8]h9]h:]h<]uh-jéh']r¡(hð)r¢}r£(h,Uh5}r¤(h7]h8]h9]h:]r¥Uterm-vcl-show-confignamer¦ah<]r§j¦auh-jžh']r¨(jù)r©}rª(h,Uh5}r«(h:]h9]h7]h8]h<]jý]r¬(jÿXvcl.show confignamer­j¦jtr®auh-j¢h']h3jubhHXvcl.show confignamer¯…r°}r±(h,Xvcl.show confignameh-j¢ubeh3hôubhú)r²}r³(h,Uh5}r´(h7]h8]h9]h:]h<]uh-jžh']rµhv)r¶}r·(h,X8Display the source code for the specified configuration.r¸h-j²h.h1h3hyh5}r¹(h7]h8]h9]h:]h<]uh>K°h']rºhHX8Display the source code for the specified configuration.r»…r¼}r½(h,j¸h-j¶ubaubah3jubeh3híubhê)r¾}r¿(h,Uh5}rÀ(h7]h8]h9]h:]h<]uh-jéh']rÁ(hð)rÂ}rÃ(h,Uh5}rÄ(h7]h8]h9]h:]rÅUterm-vcl-use-confignamerÆah<]rÇjÆauh-j¾h']rÈ(jù)rÉ}rÊ(h,Uh5}rË(h:]h9]h7]h8]h<]jý]rÌ(jÿXvcl.use confignamerÍjÆjtrÎauh-jÂh']h3jubhHXvcl.use confignamerÏ…rÐ}rÑ(h,Xvcl.use confignameh-jÂubeh3hôubhú)rÒ}rÓ(h,Uh5}rÔ(h7]h8]h9]h:]h<]uh-j¾h']rÕhv)rÖ}r×(h,X¬Start using the configuration specified by configname for all new requests. Existing requests will con†tinue using whichever configuration was in use when they arrived.rØh-jÒh.h1h3hyh5}rÙ(h7]h8]h9]h:]h<]uh>K³h']rÚhHX¬Start using the configuration specified by configname for all new requests. Existing requests will con†tinue using whichever configuration was in use when they arrived.rÛ…rÜ}rÝ(h,jØh-jÖubaubah3jubeh3híubeubaubeubh))rÞ}rß(h,Uh-hÆh.h1h3h4h5}rà(h7]h8]h9]h:]ráh"ah<]râh auh>KÃh?hh']rã(hA)rä}rå(h,XBan Expressionsræh-jÞh.h1h3hEh5}rç(h7]h8]h9]h:]h<]uh>KÃh?hh']rèhHXBan Expressionsré…rê}rë(h,jæh-jäubaubhv)rì}rí(h,X¡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 "&&".rîh-jÞh.h1h3hyh5}rï(h7]h8]h9]h:]h<]uh>KÅh?hh']rðhHX¡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 "&&".rñ…rò}ró(h,jîh-jìubaubhv)rô}rõ(h,XiA field can be any of the variables from VCL, for instance req.url, req.http.host or obj.http.set-cookie.röh-jÞh.h1h3hyh5}r÷(h7]h8]h9]h:]h<]uh>KÉh?hh']røhHXiA field can be any of the variables from VCL, for instance req.url, req.http.host or obj.http.set-cookie.rù…rú}rû(h,jöh-jôubaubhv)rü}rý(h,X¬Operators are "==" for direct comparision, "~" for a regular expression match, and ">" or "<" for size comparisons. Prepending an operator with "!" negates the expression.rþh-jÞh.h1h3hyh5}rÿ(h7]h8]h9]h:]h<]uh>KÌh?hh']rhHX¬Operators are "==" for direct comparision, "~" for a regular expression match, and ">" or "<" for size comparisons. Prepending an operator with "!" negates the expression.r…r}r(h,jþh-jüubaubhv)r}r(h,XŒ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.rh-jÞh.h1h3hyh5}r(h7]h8]h9]h:]h<]uh>KÐh?hh']rhHXŒ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.r …r }r (h,jh-jubaubeubh))r }r (h,Uh-hÆh.h1h3h4h5}r(h7]h8]h9]h:]rh%ah<]rhauh>KÖh?hh']r(hA)r}r(h,X Scriptingrh-j h.h1h3hEh5}r(h7]h8]h9]h:]h<]uh>KÖh?hh']rhHX Scriptingr…r}r(h,jh-jubaubhv)r}r(h,XuIf you are going to write a script that talks CLI to varnishd, the include/cli.h contains the relevant magic numbers.rh-j h.h1h3hyh5}r(h7]h8]h9]h:]h<]uh>KØh?hh']rhHXuIf you are going to write a script that talks CLI to varnishd, the include/cli.h contains the relevant magic numbers.r…r }r!(h,jh-jubaubhv)r"}r#(h,XOne 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.r$h-j h.h1h3hyh5}r%(h7]h8]h9]h:]h<]uh>KÛh?hh']r&hHXOne 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.r'…r(}r)(h,j$h-j"ubaubhv)r*}r+(h,X†For your reference the sourcefile lib/libvarnish/cli_common.h contains the functions varnish code uses to read and write CLI response.r,h-j h.h1h3hyh5}r-(h7]h8]h9]h:]h<]uh>Kßh?hh']r.hHX†For your reference the sourcefile lib/libvarnish/cli_common.h contains the functions varnish code uses to read and write CLI response.r/…r0}r1(h,j,h-j*ubaubeubh))r2}r3(h,Uh-hÆh.h1h3h4h5}r4(h7]h8]h9]h:]r5h!ah<]r6h auh>Kãh?hh']r7(hA)r8}r9(h,XDetails on authenticationr:h-j2h.h1h3hEh5}r;(h7]h8]h9]h:]h<]uh>Kãh?hh']r<hHXDetails on authenticationr=…r>}r?(h,j:h-j8ubaubhv)r@}rA(h,X–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.rBh-j2h.h1h3hyh5}rC(h7]h8]h9]h:]h<]uh>Kåh?hh']rDhHX–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.rE…rF}rG(h,jBh-j@ubaubhv)rH}rI(h,X”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.rJh-j2h.h1h3hyh5}rK(h7]h8]h9]h:]h<]uh>Kéh?hh']rLhHX”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.rM…rN}rO(h,jJh-jHubaubhv)rP}rQ(h,X<Use the unix file permissions to control access to the file.rRh-j2h.h1h3hyh5}rS(h7]h8]h9]h:]h<]uh>Kíh?hh']rThHX<Use the unix file permissions to control access to the file.rU…rV}rW(h,jRh-jPubaubhv)rX}rY(h,X*An authenticated session looks like this::rZh-j2h.h1h3hyh5}r[(h7]h8]h9]h:]h<]uh>Kïh?hh']r\hHX)An authenticated session looks like this:r]…r^}r_(h,X)An authenticated session looks like this:h-jXubaubj‹)r`}ra(h,XÈ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.h-j2h.h1h3jŽh5}rb(jj‘h:]h9]h7]h8]h<]uh>Kñh?hh']rchHXÈ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.rd…re}rf(h,Uh-j`ubaubhv)rg}rh(h,XñThe CLI status of 107 indicates that authentication is necessary. The first 32 characters of the reponse text is the challenge "ixsl...mpg". The challenge is randomly generated for each CLI connection, and changes each time a 107 is emitted.rih-j2h.h1h3hyh5}rj(h7]h8]h9]h:]h<]uh>Mh?hh']rkhHXñThe CLI status of 107 indicates that authentication is necessary. The first 32 characters of the reponse text is the challenge "ixsl...mpg". The challenge is randomly generated for each CLI connection, and changes each time a 107 is emitted.rl…rm}rn(h,jih-jgubaubhv)ro}rp(h,XaThe most recently emitted challenge must be used for calculating the authenticator "455c...c89a".rqh-j2h.h1h3hyh5}rr(h7]h8]h9]h:]h<]uh>M h?hh']rshHXaThe most recently emitted challenge must be used for calculating the authenticator "455c...c89a".rt…ru}rv(h,jqh-joubaubhv)rw}rx(h,X_The authenticator is calculated by applying the SHA256 function to the following byte sequence:ryh-j2h.h1h3hyh5}rz(h7]h8]h9]h:]h<]uh>M h?hh']r{hHX_The authenticator is calculated by applying the SHA256 function to the following byte sequence:r|…r}}r~(h,jyh-jwubaubcdocutils.nodes bullet_list r)r€}r(h,Uh-j2h.h1h3U bullet_listr‚h5}rƒ(Ubulletr„X*h:]h9]h7]h8]h<]uh>Mh?hh']r…(cdocutils.nodes list_item r†)r‡}rˆ(h,XChallenge stringr‰h-j€h.h1h3U list_itemrŠh5}r‹(h7]h8]h9]h:]h<]uh>Nh?hh']rŒhv)r}rŽ(h,j‰h-j‡h.h1h3hyh5}r(h7]h8]h9]h:]h<]uh>Mh']rhHXChallenge stringr‘…r’}r“(h,j‰h-jubaubaubj†)r”}r•(h,XNewline (0x0a) character.r–h-j€h.h1h3jŠh5}r—(h7]h8]h9]h:]h<]uh>Nh?hh']r˜hv)r™}rš(h,j–h-j”h.h1h3hyh5}r›(h7]h8]h9]h:]h<]uh>Mh']rœhHXNewline (0x0a) character.r…rž}rŸ(h,j–h-j™ubaubaubj†)r }r¡(h,XContents of the secret filer¢h-j€h.h1h3jŠh5}r£(h7]h8]h9]h:]h<]uh>Nh?hh']r¤hv)r¥}r¦(h,j¢h-j h.h1h3hyh5}r§(h7]h8]h9]h:]h<]uh>Mh']r¨hHXContents of the secret filer©…rª}r«(h,j¢h-j¥ubaubaubj†)r¬}r­(h,XChallenge stringr®h-j€h.h1h3jŠh5}r¯(h7]h8]h9]h:]h<]uh>Nh?hh']r°hv)r±}r²(h,j®h-j¬h.h1h3hyh5}r³(h7]h8]h9]h:]h<]uh>Mh']r´hHXChallenge stringrµ…r¶}r·(h,j®h-j±ubaubaubj†)r¸}r¹(h,XNewline (0x0a) character. h-j€h.h1h3jŠh5}rº(h7]h8]h9]h:]h<]uh>Nh?hh']r»hv)r¼}r½(h,XNewline (0x0a) character.r¾h-j¸h.h1h3hyh5}r¿(h7]h8]h9]h:]h<]uh>Mh']rÀhHXNewline (0x0a) character.rÁ…rÂ}rÃ(h,j¾h-j¼ubaubaubeubhv)rÄ}rÅ(h,X3and dumping the resulting digest in lower-case hex.rÆh-j2h.h1h3hyh5}rÇ(h7]h8]h9]h:]h<]uh>Mh?hh']rÈhHX3and dumping the resulting digest in lower-case hex.rÉ…rÊ}rË(h,jÆh-jÄubaubhv)rÌ}rÍ(h,X@In the above example, the secret file contained foo\n and thus::rÎh-j2h.h1h3hyh5}rÏ(h7]h8]h9]h:]h<]uh>Mh?hh']rÐhHX>In the above example, the secret file contained foon and thus:rÑ…rÒ}rÓ(h,X?In the above example, the secret file contained foo\n and thus:h-jÌubaubj‹)rÔ}rÕ(h,XÌ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 < _ 455ce847f0073c7ab3b1465f74507b75d3dc064c1e7de3b71e00de9092fdc89ah-j2h.h1h3jŽh5}rÖ(jj‘h:]h9]h7]h8]h<]uh>Mh?hh']r×hHXÌ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 < _ 455ce847f0073c7ab3b1465f74507b75d3dc064c1e7de3b71e00de9092fdc89arØ…rÙ}rÚ(h,Uh-jÔubaubhv)rÛ}rÜ(h,X­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.rÝh-j2h.h1h3hyh5}rÞ(h7]h8]h9]h:]h<]uh>M*h?hh']rßhHX­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.rà…rá}râ(h,jÝh-jÛubaubeubeubh))rã}rä(h,Uh-hLh.h1h3h4h5}rå(h7]h8]h9]h:]ræh ah<]rçh auh>M/h?hh']rè(hA)ré}rê(h,XEXAMPLESrëh-jãh.h1h3hEh5}rì(h7]h8]h9]h:]h<]uh>M/h?hh']ríhHXEXAMPLESrî…rï}rð(h,jëh-jéubaubhv)rñ}rò(h,XgSimple example: All requests where req.url exactly matches the string /news are banned from the cache::h-jãh.h1h3hyh5}ró(h7]h8]h9]h:]h<]uh>M1h?hh']rôhHXfSimple example: All requests where req.url exactly matches the string /news are banned from the cache:rõ…rö}r÷(h,XfSimple example: All requests where req.url exactly matches the string /news are banned from the cache:h-jñubaubj‹)rø}rù(h,Xreq.url == "/news"h-jãh.h1h3jŽh5}rú(jj‘h:]h9]h7]h8]h<]uh>M4h?hh']rûhHXreq.url == "/news"rü…rý}rþ(h,Uh-jøubaubhv)rÿ}r(h,XƒExample: Ban all documents where the name does not end with ".ogg", and where the size of the object is greater than 10 megabytes::h-jãh.h1h3hyh5}r(h7]h8]h9]h:]h<]uh>M6h?hh']rhHX‚Example: Ban all documents where the name does not end with ".ogg", and where the size of the object is greater than 10 megabytes:r…r}r(h,X‚Example: Ban all documents where the name does not end with ".ogg", and where the size of the object is greater than 10 megabytes:h-jÿubaubj‹)r}r(h,X&req.url !~ "\.ogg$" && obj.size > 10MBh-jãh.h1h3jŽh5}r(jj‘h:]h9]h7]h8]h<]uh>M9h?hh']r hHX&req.url !~ "\.ogg$" && obj.size > 10MBr …r }r (h,Uh-jubaubhv)r }r(h,X«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"::h-jãh.h1h3hyh5}r(h7]h8]h9]h:]h<]uh>M;h?hh']rhHXª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":r…r}r(h,Xª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":h-j ubaubj‹)r}r(h,XQreq.http.host ~ "^(?i)(www\.)example.com$" && obj.http.set-cookie ~ "USERID=1663"h-jãh.h1h3jŽh5}r(jj‘h:]h9]h7]h8]h<]uh>M?h?hh']rhHXQreq.http.host ~ "^(?i)(www\.)example.com$" && obj.http.set-cookie ~ "USERID=1663"r…r}r(h,Uh-jubaubeubh))r}r(h,Uh-hLh.h1h3h4h5}r(h7]h8]h9]h:]rh#ah<]rhauh>MBh?hh']r (hA)r!}r"(h,XSEE ALSOr#h-jh.h1h3hEh5}r$(h7]h8]h9]h:]h<]uh>MBh?hh']r%hHXSEE ALSOr&…r'}r((h,j#h-j!ubaubj)r)}r*(h,Uh-jh.h1h3j‚h5}r+(j„X*h:]h9]h7]h8]h<]uh>MDh?hh']r,(j†)r-}r.(h,X varnishd(1)r/h-j)h.h1h3jŠh5}r0(h7]h8]h9]h:]h<]uh>Nh?hh']r1hv)r2}r3(h,j/h-j-h.h1h3hyh5}r4(h7]h8]h9]h:]h<]uh>MDh']r5hHX varnishd(1)r6…r7}r8(h,j/h-j2ubaubaubj†)r9}r:(h,X vanrishadm(1)r;h-j)h.h1h3jŠh5}r<(h7]h8]h9]h:]h<]uh>Nh?hh']r=hv)r>}r?(h,j;h-j9h.h1h3hyh5}r@(h7]h8]h9]h:]h<]uh>MEh']rAhHX vanrishadm(1)rB…rC}rD(h,j;h-j>ubaubaubj†)rE}rF(h,Xvcl(7) h-j)h.h1h3jŠh5}rG(h7]h8]h9]h:]h<]uh>Nh?hh']rHhv)rI}rJ(h,Xvcl(7)rKh-jEh.h1h3hyh5}rL(h7]h8]h9]h:]h<]uh>MFh']rMhHXvcl(7)rN…rO}rP(h,jKh-jIubaubaubeubeubh))rQ}rR(h,Uh-hLh.h1h3h4h5}rS(h7]h8]h9]h:]rTh&ah<]rUhauh>MIh?hh']rV(hA)rW}rX(h,XHISTORYrYh-jQh.h1h3hEh5}rZ(h7]h8]h9]h:]h<]uh>MIh?hh']r[hHXHISTORYr\…r]}r^(h,jYh-jWubaubhv)r_}r`(h,X¥The varnish manual page was written by Per Buer in 2011. Some of the text was taken from the Varnish Cache wiki, the varnishd(7) man page or the varnish source code.rah-jQh.h1h3hyh5}rb(h7]h8]h9]h:]h<]uh>MKh?hh']rchHX¥The varnish manual page was written by Per Buer in 2011. Some of the text was taken from the Varnish Cache wiki, the varnishd(7) man page or the varnish source code.rd…re}rf(h,jah-j_ubaubeubh))rg}rh(h,Uh-hLh.h1h3h4h5}ri(h7]h8]h9]h:]rjhah<]rkhauh>MPh?hh']rl(hA)rm}rn(h,X COPYRIGHTroh-jgh.h1h3hEh5}rp(h7]h8]h9]h:]h<]uh>MPh?hh']rqhHX COPYRIGHTrr…rs}rt(h,joh-jmubaubhv)ru}rv(h,X\This document is licensed under the same licence as Varnish itself. See LICENCE for details.rwh-jgh.h1h3hyh5}rx(h7]h8]h9]h:]h<]uh>MRh?hh']ryhHX\This document is licensed under the same licence as Varnish itself. See LICENCE for details.rz…r{}r|(h,jwh-juubaubj)r}}r~(h,Uh-jgh.h1h3j‚h5}r(j„X*h:]h9]h7]h8]h<]uh>MUh?hh']r€j†)r}r‚(h,X&Copyright (c) 2011 Varnish Software ASrƒh-j}h.h1h3jŠh5}r„(h7]h8]h9]h:]h<]uh>Nh?hh']r…hv)r†}r‡(h,jƒh-jh.h1h3hyh5}rˆ(h7]h8]h9]h:]h<]uh>MUh']r‰hHX&Copyright (c) 2011 Varnish Software ASrŠ…r‹}rŒ(h,jƒh-j†ubaubaubaubeubeubeubah,UU transformerrNU footnote_refsrŽ}rUrefnamesr}r‘Usymbol_footnotesr’]r“Uautofootnote_refsr”]r•Usymbol_footnote_refsr–]r—U citationsr˜]r™h?hU current_lineršNUtransform_messagesr›]rœUreporterrNUid_startržKU autofootnotesrŸ]r U citation_refsr¡}r¢Uindirect_targetsr£]r¤Usettingsr¥(cdocutils.frontend Values r¦or§}r¨(Ufootnote_backlinksr©KUrecord_dependenciesrªNU rfc_base_urlr«Uhttp://tools.ietf.org/html/r¬U tracebackr­ˆUpep_referencesr®NUstrip_commentsr¯NU toc_backlinksr°Uentryr±U language_coder²Uenr³U datestampr´NU report_levelrµKU _destinationr¶NU halt_levelr·KU strip_classesr¸NhENUerror_encoding_error_handlerr¹UbackslashreplacerºUdebugr»NUembed_stylesheetr¼‰Uoutput_encoding_error_handlerr½Ustrictr¾U sectnum_xformr¿KUdump_transformsrÀNU docinfo_xformrÁKUwarning_streamrÂNUpep_file_url_templaterÃUpep-%04drÄUexit_status_levelrÅKUconfigrÆNUstrict_visitorrÇNUcloak_email_addressesrȈUtrim_footnote_reference_spacerɉUenvrÊNUdump_pseudo_xmlrËNUexpose_internalsrÌNUsectsubtitle_xformr͉U source_linkrÎNUrfc_referencesrÏNUoutput_encodingrÐUutf-8rÑU source_urlrÒNUinput_encodingrÓU utf-8-sigrÔU_disable_configrÕNU id_prefixrÖUU tab_widthr×KUerror_encodingrØUUTF-8rÙU_sourcerÚU9/home/tfheen/varnish/doc/sphinx/reference/varnish-cli.rstrÛUgettext_compactr܈U generatorrÝNUdump_internalsrÞNU smart_quotesr߉U pep_base_urlràUhttp://www.python.org/dev/peps/ráUsyntax_highlightrâUlongrãUinput_encoding_error_handlerräj¾Uauto_id_prefixråUidræUdoctitle_xformrç‰Ustrip_elements_with_classesrèNU _config_filesré]Ufile_insertion_enabledrêKU raw_enabledrëKU dump_settingsrìNubUsymbol_footnote_startríKUidsrî}rï(h$hLhjÕhhÆhjgh#jhh*hjlh!j2h jãh"jÞh%j h&jQuUsubstitution_namesrð}rñh3h?h5}rò(h7]h:]h9]Usourceh1h8]h<]uU footnotesró]rôUrefidsrõ}röub.varnish-3.0.5/doc/sphinx/=build/doctrees/reference/varnishsizes.doctree0000644000175000017500000006023112247037213023234 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(X descriptionqNX copyrightqNXsynopsisqNX%varnish object size request histogramq NX varnishsizesq NXsee alsoq NXhistoryq NuUsubstitution_defsq }qUparse_messagesq]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hU descriptionqhU copyrightqhUsynopsisqh U%varnish-object-size-request-histogramqh U varnishsizesqh Usee-alsoqh UhistoryquUchildrenq]qcdocutils.nodes section q)q }q!(U rawsourceq"UUparentq#hUsourceq$cdocutils.nodes reprunicode q%X:/home/tfheen/varnish/doc/sphinx/reference/varnishsizes.rstq&…q'}q(bUtagnameq)Usectionq*U attributesq+}q,(Udupnamesq-]Uclassesq.]Ubackrefsq/]Uidsq0]q1haUnamesq2]q3h auUlineq4KUdocumentq5hh]q6(cdocutils.nodes title q7)q8}q9(h"X varnishsizesq:h#h h$h'h)Utitleq;h+}q<(h-]h.]h/]h0]h2]uh4Kh5hh]q=cdocutils.nodes Text q>X varnishsizesq?…q@}qA(h"h:h#h8ubaubh)qB}qC(h"Uh#h h$h'h)h*h+}qD(h-]h.]h/]h0]qEhah2]qFh auh4Kh5hh]qG(h7)qH}qI(h"X%Varnish object size request histogramqJh#hBh$h'h)h;h+}qK(h-]h.]h/]h0]h2]uh4Kh5hh]qLh>X%Varnish object size request histogramqM…qN}qO(h"hJh#hHubaubcdocutils.nodes field_list qP)qQ}qR(h"Uh#hBh$h'h)U field_listqSh+}qT(h-]h.]h/]h0]h2]uh4K h5hh]qU(cdocutils.nodes field qV)qW}qX(h"Uh#hQh$h'h)UfieldqYh+}qZ(h-]h.]h/]h0]h2]uh4K h5hh]q[(cdocutils.nodes field_name q\)q]}q^(h"XAuthorq_h+}q`(h-]h.]h/]h0]h2]uh#hWh]qah>XAuthorqb…qc}qd(h"h_h#h]ubah)U field_nameqeubcdocutils.nodes field_body qf)qg}qh(h"XDag Erling Smørgravqih+}qj(h-]h.]h/]h0]h2]uh#hWh]qkcdocutils.nodes paragraph ql)qm}qn(h"hih#hgh$h'h)U paragraphqoh+}qp(h-]h.]h/]h0]h2]uh4K h]qqh>XDag Erling Smørgravqr…qs}qt(h"hih#hmubaubah)U field_bodyquubeubhV)qv}qw(h"Uh#hQh$h'h)hYh+}qx(h-]h.]h/]h0]h2]uh4K h5hh]qy(h\)qz}q{(h"XAuthorq|h+}q}(h-]h.]h/]h0]h2]uh#hvh]q~h>XAuthorq…q€}q(h"h|h#hzubah)heubhf)q‚}qƒ(h"XKristian Lyngstølq„h+}q…(h-]h.]h/]h0]h2]uh#hvh]q†hl)q‡}qˆ(h"h„h#h‚h$h'h)hoh+}q‰(h-]h.]h/]h0]h2]uh4K h]qŠh>XKristian Lyngstølq‹…qŒ}q(h"h„h#h‡ubaubah)huubeubhV)qŽ}q(h"Uh#hQh$h'h)hYh+}q(h-]h.]h/]h0]h2]uh4K h5hh]q‘(h\)q’}q“(h"XAuthorq”h+}q•(h-]h.]h/]h0]h2]uh#hŽh]q–h>XAuthorq—…q˜}q™(h"h”h#h’ubah)heubhf)qš}q›(h"XPer Buerqœh+}q(h-]h.]h/]h0]h2]uh#hŽh]qžhl)qŸ}q (h"hœh#hšh$h'h)hoh+}q¡(h-]h.]h/]h0]h2]uh4K h]q¢h>XPer Buerq£…q¤}q¥(h"hœh#hŸubaubah)huubeubhV)q¦}q§(h"Uh#hQh$h'h)hYh+}q¨(h-]h.]h/]h0]h2]uh4K h5hh]q©(h\)qª}q«(h"XDateq¬h+}q­(h-]h.]h/]h0]h2]uh#h¦h]q®h>XDateq¯…q°}q±(h"h¬h#hªubah)heubhf)q²}q³(h"X 2010-05-31q´h+}qµ(h-]h.]h/]h0]h2]uh#h¦h]q¶hl)q·}q¸(h"h´h#h²h$h'h)hoh+}q¹(h-]h.]h/]h0]h2]uh4K h]qºh>X 2010-05-31q»…q¼}q½(h"h´h#h·ubaubah)huubeubhV)q¾}q¿(h"Uh#hQh$h'h)hYh+}qÀ(h-]h.]h/]h0]h2]uh4K h5hh]qÁ(h\)qÂ}qÃ(h"XVersionqÄh+}qÅ(h-]h.]h/]h0]h2]uh#h¾h]qÆh>XVersionqÇ…qÈ}qÉ(h"hÄh#hÂubah)heubhf)qÊ}qË(h"X1.0qÌh+}qÍ(h-]h.]h/]h0]h2]uh#h¾h]qÎhl)qÏ}qÐ(h"hÌh#hÊh$h'h)hoh+}qÑ(h-]h.]h/]h0]h2]uh4K h]qÒh>X1.0qÓ…qÔ}qÕ(h"hÌh#hÏubaubah)huubeubhV)qÖ}q×(h"Uh#hQh$h'h)hYh+}qØ(h-]h.]h/]h0]h2]uh4Kh5hh]qÙ(h\)qÚ}qÛ(h"XManual sectionqÜh+}qÝ(h-]h.]h/]h0]h2]uh#hÖh]qÞh>XManual sectionqß…qà}qá(h"hÜh#hÚubah)heubhf)qâ}qã(h"X1 h+}qä(h-]h.]h/]h0]h2]uh#hÖh]qåhl)qæ}qç(h"X1h#hâh$h'h)hoh+}qè(h-]h.]h/]h0]h2]uh4Kh]qéh>X1…qê}që(h"X1h#hæubaubah)huubeubeubh)qì}qí(h"Uh#hBh$h'h)h*h+}qî(h-]h.]h/]h0]qïhah2]qðhauh4Kh5hh]qñ(h7)qò}qó(h"XSYNOPSISqôh#hìh$h'h)h;h+}qõ(h-]h.]h/]h0]h2]uh4Kh5hh]qöh>XSYNOPSISq÷…qø}qù(h"hôh#hòubaubcdocutils.nodes definition_list qú)qû}qü(h"Uh#hìh$h'h)Udefinition_listqýh+}qþ(h-]h.]h/]h0]h2]uh4Nh5hh]qÿcdocutils.nodes definition_list_item r)r}r(h"Xˆvarnishsizes [-b] [-C] [-c] [-d] [-I regex] [-i tag] [-m tag:regex ...] [-n varnish_name] [-r file] [-V] [-w delay] [-X regex] [-x tag] h#hûh$h'h)Udefinition_list_itemrh+}r(h-]h.]h/]h0]h2]uh4Kh]r(cdocutils.nodes term r)r}r(h"XGvarnishsizes [-b] [-C] [-c] [-d] [-I regex] [-i tag] [-m tag:regex ...]r h#jh$h'h)Utermr h+}r (h-]h.]h/]h0]h2]uh4Kh]r (h>X9varnishsizes [-b] [-C] [-c] [-d] [-I regex] [-i tag] [-m r …r}r(h"X9varnishsizes [-b] [-C] [-c] [-d] [-I regex] [-i tag] [-m h#jubcdocutils.nodes reference r)r}r(h"X tag:regexrh+}r(Urefurijh0]h/]h-]h.]h2]uh#jh]rh>X tag:regexr…r}r(h"Uh#jubah)U referencerubh>X ...]r…r}r(h"X ...]h#jubeubcdocutils.nodes definition r)r}r(h"Uh+}r (h-]h.]h/]h0]h2]uh#jh]r!hl)r"}r#(h"X?[-n varnish_name] [-r file] [-V] [-w delay] [-X regex] [-x tag]r$h#jh$h'h)hoh+}r%(h-]h.]h/]h0]h2]uh4Kh]r&h>X?[-n varnish_name] [-r file] [-V] [-w delay] [-X regex] [-x tag]r'…r(}r)(h"j$h#j"ubaubah)U definitionr*ubeubaubeubh)r+}r,(h"Uh#hBh$h'h)h*h+}r-(h-]h.]h/]h0]r.hah2]r/hauh4Kh5hh]r0(h7)r1}r2(h"X DESCRIPTIONr3h#j+h$h'h)h;h+}r4(h-]h.]h/]h0]h2]uh4Kh5hh]r5h>X DESCRIPTIONr6…r7}r8(h"j3h#j1ubaubhl)r9}r:(h"XžThe varnishsizes 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 a logarithmic representation of bytes. Hits are marked with a pipe character ("|"), and misses are marked with a hash character ("#").h#j+h$h'h)hoh+}r;(h-]h.]h/]h0]h2]uh4Kh5hh]r<h>XžThe varnishsizes 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 a logarithmic representation of bytes. Hits are marked with a pipe character ("|"), and misses are marked with a hash character ("#").r=…r>}r?(h"XžThe varnishsizes 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 a logarithmic representation of bytes. Hits are marked with a pipe character ("|"), and misses are marked with a hash character ("#").h#j9ubaubhl)r@}rA(h"X$The following options are available:rBh#j+h$h'h)hoh+}rC(h-]h.]h/]h0]h2]uh4K!h5hh]rDh>X$The following options are available:rE…rF}rG(h"jBh#j@ubaubcdocutils.nodes option_list rH)rI}rJ(h"Uh#j+h$h'h)U option_listrKh+}rL(h-]h.]h/]h0]h2]uh4Nh5hh]rM(cdocutils.nodes option_list_item rN)rO}rP(h"Uh#jIh$h'h)Uoption_list_itemrQh+}rR(h-]h.]h/]h0]h2]uh4Nh5hh]rS(cdocutils.nodes option_group rT)rU}rV(h"Uh+}rW(h-]h.]h/]h0]h2]uh#jOh]rXcdocutils.nodes option rY)rZ}r[(h"X-br\h+}r](h-]h.]h/]h0]h2]uh#jUh]r^cdocutils.nodes option_string r_)r`}ra(h"j\h+}rb(h-]h.]h/]h0]h2]uh#jZh]rch>X-brd…re}rf(h"Uh#j`ubah)U option_stringrgubah)Uoptionrhubah)U option_groupriubcdocutils.nodes description rj)rk}rl(h"X–Include log entries which result from communication with a backend server. If neither -b nor -c is specified, varnishsizes acts as if they both were. h+}rm(h-]h.]h/]h0]h2]uh#jOh]rnhl)ro}rp(h"X•Include log entries which result from communication with a backend server. If neither -b nor -c is specified, varnishsizes acts as if they both were.rqh#jkh$h'h)hoh+}rr(h-]h.]h/]h0]h2]uh4K#h]rsh>X•Include log entries which result from communication with a backend server. If neither -b nor -c is specified, varnishsizes acts as if they both were.rt…ru}rv(h"jqh#joubaubah)U descriptionrwubeubjN)rx}ry(h"Uh#jIh$h'h)jQh+}rz(h-]h.]h/]h0]h2]uh4Nh5hh]r{(jT)r|}r}(h"Uh+}r~(h-]h.]h/]h0]h2]uh#jxh]rjY)r€}r(h"X-Cr‚h+}rƒ(h-]h.]h/]h0]h2]uh#j|h]r„j_)r…}r†(h"j‚h+}r‡(h-]h.]h/]h0]h2]uh#j€h]rˆh>X-Cr‰…rŠ}r‹(h"Uh#j…ubah)jgubah)jhubah)jiubjj)rŒ}r(h"X/Ignore case when matching regular expressions. h+}rŽ(h-]h.]h/]h0]h2]uh#jxh]rhl)r}r‘(h"X.Ignore case when matching regular expressions.r’h#jŒh$h'h)hoh+}r“(h-]h.]h/]h0]h2]uh4K&h]r”h>X.Ignore case when matching regular expressions.r•…r–}r—(h"j’h#jubaubah)jwubeubjN)r˜}r™(h"Uh#jIh$h'h)jQh+}rš(h-]h.]h/]h0]h2]uh4Nh5hh]r›(jT)rœ}r(h"Uh+}rž(h-]h.]h/]h0]h2]uh#j˜h]rŸjY)r }r¡(h"X-cr¢h+}r£(h-]h.]h/]h0]h2]uh#jœh]r¤j_)r¥}r¦(h"j¢h+}r§(h-]h.]h/]h0]h2]uh#j h]r¨h>X-cr©…rª}r«(h"Uh#j¥ubah)jgubah)jhubah)jiubjj)r¬}r­(h"XŽInclude log entries which result from communication with a client. If neither -b nor -c is specified, varnishsizes acts as if they both were. h+}r®(h-]h.]h/]h0]h2]uh#j˜h]r¯hl)r°}r±(h"XInclude log entries which result from communication with a client. If neither -b nor -c is specified, varnishsizes acts as if they both were.r²h#j¬h$h'h)hoh+}r³(h-]h.]h/]h0]h2]uh4K(h]r´h>XInclude log entries which result from communication with a client. If neither -b nor -c is specified, varnishsizes acts as if they both were.rµ…r¶}r·(h"j²h#j°ubaubah)jwubeubjN)r¸}r¹(h"Uh#jIh$h'h)jQh+}rº(h-]h.]h/]h0]h2]uh4Nh5hh]r»(jT)r¼}r½(h"Uh+}r¾(h-]h.]h/]h0]h2]uh#j¸h]r¿jY)rÀ}rÁ(h"X-drÂh+}rÃ(h-]h.]h/]h0]h2]uh#j¼h]rÄj_)rÅ}rÆ(h"jÂh+}rÇ(h-]h.]h/]h0]h2]uh#jÀh]rÈh>X-drÉ…rÊ}rË(h"Uh#jÅubah)jgubah)jhubah)jiubjj)rÌ}rÍ(h"X„Process old log entries on startup. Normally, varnishsizes will only process entries which are written to the log after it starts. h+}rÎ(h-]h.]h/]h0]h2]uh#j¸h]rÏhl)rÐ}rÑ(h"XƒProcess old log entries on startup. Normally, varnishsizes will only process entries which are written to the log after it starts.rÒh#jÌh$h'h)hoh+}rÓ(h-]h.]h/]h0]h2]uh4K+h]rÔh>XƒProcess old log entries on startup. Normally, varnishsizes will only process entries which are written to the log after it starts.rÕ…rÖ}r×(h"jÒh#jÐubaubah)jwubeubjN)rØ}rÙ(h"Uh#jIh$h'h)jQh+}rÚ(h-]h.]h/]h0]h2]uh4Nh5hh]rÛ(jT)rÜ}rÝ(h"Uh+}rÞ(h-]h.]h/]h0]h2]uh#jØh]rßjY)rà}rá(h"X-I regexh+}râ(h-]h.]h/]h0]h2]uh#jÜh]rã(j_)rä}rå(h"X-Ih+}ræ(h-]h.]h/]h0]h2]uh#jàh]rçh>X-Irè…ré}rê(h"Uh#jäubah)jgubcdocutils.nodes option_argument rë)rì}rí(h"Xregexh+}rî(h0]h/]h-]U delimiterU h.]h2]uh#jàh]rïh>Xregexrð…rñ}rò(h"Uh#jìubah)Uoption_argumentróubeh)jhubah)jiubjj)rô}rõ(h"XƒInclude log entries which match the specified regular expression. If neither -I nor -i is specified, all log entries are included. h+}rö(h-]h.]h/]h0]h2]uh#jØh]r÷hl)rø}rù(h"X‚Include log entries which match the specified regular expression. If neither -I nor -i is specified, all log entries are included.rúh#jôh$h'h)hoh+}rû(h-]h.]h/]h0]h2]uh4K.h]rüh>X‚Include log entries which match the specified regular expression. If neither -I nor -i is specified, all log entries are included.rý…rþ}rÿ(h"júh#jøubaubah)jwubeubjN)r}r(h"Uh#jIh$h'h)jQh+}r(h-]h.]h/]h0]h2]uh4Nh5hh]r(jT)r}r(h"Uh+}r(h-]h.]h/]h0]h2]uh#jh]rjY)r}r (h"X-i tagh+}r (h-]h.]h/]h0]h2]uh#jh]r (j_)r }r (h"X-ih+}r(h-]h.]h/]h0]h2]uh#jh]rh>X-ir…r}r(h"Uh#j ubah)jgubjë)r}r(h"Xtagh+}r(h0]h/]h-]U delimiterU h.]h2]uh#jh]rh>Xtagr…r}r(h"Uh#jubah)jóubeh)jhubah)jiubjj)r}r(h"XnInclude log entries with the specified tag. If neither -I nor -i is specified, all log entries are included. h+}r(h-]h.]h/]h0]h2]uh#jh]rhl)r}r(h"XmInclude log entries with the specified tag. If neither -I nor -i is specified, all log entries are included.r h#jh$h'h)hoh+}r!(h-]h.]h/]h0]h2]uh4K1h]r"h>XmInclude log entries with the specified tag. If neither -I nor -i is specified, all log entries are included.r#…r$}r%(h"j h#jubaubah)jwubeubeubhú)r&}r'(h"Uh#j+h$h'h)hýh+}r((h-]h.]h/]h0]h2]uh4Nh5hh]r)j)r*}r+(h"X`-m tag:regex only list record where tag matches regex. Multiple -m options are AND-ed together. h#j&h$h'h)jh+}r,(h-]h.]h/]h0]h2]uh4K5h]r-(j)r.}r/(h"XB-m tag:regex only list record where tag matches regex. Multiple -mr0h#j*h$h'h)j h+}r1(h-]h.]h/]h0]h2]uh4K5h]r2(h>X-m r3…r4}r5(h"X-m h#j.ubj)r6}r7(h"X tag:regexr8h+}r9(Urefurij8h0]h/]h-]h.]h2]uh#j.h]r:h>X tag:regexr;…r<}r=(h"Uh#j6ubah)jubh>X6 only list record where tag matches regex. Multiple -mr>…r?}r@(h"X6 only list record where tag matches regex. Multiple -mh#j.ubeubj)rA}rB(h"Uh+}rC(h-]h.]h/]h0]h2]uh#j*h]rDhl)rE}rF(h"Xoptions are AND-ed together.rGh#jAh$h'h)hoh+}rH(h-]h.]h/]h0]h2]uh4K5h]rIh>Xoptions are AND-ed together.rJ…rK}rL(h"jGh#jEubaubah)j*ubeubaubjH)rM}rN(h"Uh#j+h$h'h)jKh+}rO(h-]h.]h/]h0]h2]uh4Nh5hh]rP(jN)rQ}rR(h"Uh#jMh$h'h)jQh+}rS(h-]h.]h/]h0]h2]uh4Nh5hh]rT(jT)rU}rV(h"Uh+}rW(h-]h.]h/]h0]h2]uh#jQh]rXjY)rY}rZ(h"X-nr[h+}r\(h-]h.]h/]h0]h2]uh#jUh]r]j_)r^}r_(h"j[h+}r`(h-]h.]h/]h0]h2]uh#jYh]rah>X-nrb…rc}rd(h"Uh#j^ubah)jgubah)jhubah)jiubjj)re}rf(h"XmSpecifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used. h+}rg(h-]h.]h/]h0]h2]uh#jQh]rhhl)ri}rj(h"XlSpecifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used.rkh#jeh$h'h)hoh+}rl(h-]h.]h/]h0]h2]uh4K7h]rmh>XlSpecifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used.rn…ro}rp(h"jkh#jiubaubah)jwubeubjN)rq}rr(h"Uh#jMh$h'h)jQh+}rs(h-]h.]h/]h0]h2]uh4Nh5hh]rt(jT)ru}rv(h"Uh+}rw(h-]h.]h/]h0]h2]uh#jqh]rxjY)ry}rz(h"X-r fileh+}r{(h-]h.]h/]h0]h2]uh#juh]r|(j_)r}}r~(h"X-rh+}r(h-]h.]h/]h0]h2]uh#jyh]r€h>X-rr…r‚}rƒ(h"Uh#j}ubah)jgubjë)r„}r…(h"Xfileh+}r†(h0]h/]h-]U delimiterU h.]h2]uh#jyh]r‡h>Xfilerˆ…r‰}rŠ(h"Uh#j„ubah)jóubeh)jhubah)jiubjj)r‹}rŒ(h"X5Read log entries from file instead of shared memory. h+}r(h-]h.]h/]h0]h2]uh#jqh]rŽhl)r}r(h"X4Read log entries from file instead of shared memory.r‘h#j‹h$h'h)hoh+}r’(h-]h.]h/]h0]h2]uh4K:h]r“h>X4Read log entries from file instead of shared memory.r”…r•}r–(h"j‘h#jubaubah)jwubeubjN)r—}r˜(h"Uh#jMh$h'h)jQh+}r™(h-]h.]h/]h0]h2]uh4Nh5hh]rš(jT)r›}rœ(h"Uh+}r(h-]h.]h/]h0]h2]uh#j—h]ržjY)rŸ}r (h"X-Vr¡h+}r¢(h-]h.]h/]h0]h2]uh#j›h]r£j_)r¤}r¥(h"j¡h+}r¦(h-]h.]h/]h0]h2]uh#jŸh]r§h>X-Vr¨…r©}rª(h"Uh#j¤ubah)jgubah)jhubah)jiubjj)r«}r¬(h"X%Display the version number and exit. h+}r­(h-]h.]h/]h0]h2]uh#j—h]r®hl)r¯}r°(h"X$Display the version number and exit.r±h#j«h$h'h)hoh+}r²(h-]h.]h/]h0]h2]uh4KX$Display the version number and exit.r´…rµ}r¶(h"j±h#j¯ubaubah)jwubeubjN)r·}r¸(h"Uh#jMh$h'h)jQh+}r¹(h-]h.]h/]h0]h2]uh4Nh5hh]rº(jT)r»}r¼(h"Uh+}r½(h-]h.]h/]h0]h2]uh#j·h]r¾jY)r¿}rÀ(h"X-w delayh+}rÁ(h-]h.]h/]h0]h2]uh#j»h]rÂ(j_)rÃ}rÄ(h"X-wh+}rÅ(h-]h.]h/]h0]h2]uh#j¿h]rÆh>X-wrÇ…rÈ}rÉ(h"Uh#jÃubah)jgubjë)rÊ}rË(h"Xdelayh+}rÌ(h0]h/]h-]U delimiterU h.]h2]uh#j¿h]rÍh>XdelayrÎ…rÏ}rÐ(h"Uh#jÊubah)jóubeh)jhubah)jiubjj)rÑ}rÒ(h"X§Wait at least delay seconds between each update. The default is 1. file instead of displaying them. The file will be overwritten unless the -a option was specified. h+}rÓ(h-]h.]h/]h0]h2]uh#j·h]rÔhl)rÕ}rÖ(h"X¦Wait at least delay seconds between each update. The default is 1. file instead of displaying them. The file will be overwritten unless the -a option was specified.r×h#jÑh$h'h)hoh+}rØ(h-]h.]h/]h0]h2]uh4K>h]rÙh>X¦Wait at least delay seconds between each update. The default is 1. file instead of displaying them. The file will be overwritten unless the -a option was specified.rÚ…rÛ}rÜ(h"j×h#jÕubaubah)jwubeubjN)rÝ}rÞ(h"Uh#jMh$h'h)jQh+}rß(h-]h.]h/]h0]h2]uh4Nh5hh]rà(jT)rá}râ(h"Uh+}rã(h-]h.]h/]h0]h2]uh#jÝh]räjY)rå}ræ(h"X-X regexh+}rç(h-]h.]h/]h0]h2]uh#jáh]rè(j_)ré}rê(h"X-Xh+}rë(h-]h.]h/]h0]h2]uh#jåh]rìh>X-Xrí…rî}rï(h"Uh#jéubah)jgubjë)rð}rñ(h"Xregexh+}rò(h0]h/]h-]U delimiterU h.]h2]uh#jåh]róh>Xregexrô…rõ}rö(h"Uh#jðubah)jóubeh)jhubah)jiubjj)r÷}rø(h"XBExclude log entries which match the specified regular expression. h+}rù(h-]h.]h/]h0]h2]uh#jÝh]rúhl)rû}rü(h"XAExclude log entries which match the specified regular expression.rýh#j÷h$h'h)hoh+}rþ(h-]h.]h/]h0]h2]uh4KBh]rÿh>XAExclude log entries which match the specified regular expression.r…r}r(h"jýh#jûubaubah)jwubeubjN)r}r(h"Uh#jMh$h'h)jQh+}r(h-]h.]h/]h0]h2]uh4Nh5hh]r(jT)r}r(h"Uh+}r (h-]h.]h/]h0]h2]uh#jh]r jY)r }r (h"X-x tagh+}r (h-]h.]h/]h0]h2]uh#jh]r(j_)r}r(h"X-xh+}r(h-]h.]h/]h0]h2]uh#j h]rh>X-xr…r}r(h"Uh#jubah)jgubjë)r}r(h"Xtagh+}r(h0]h/]h-]U delimiterU h.]h2]uh#j h]rh>Xtagr…r}r(h"Uh#jubah)jóubeh)jhubah)jiubjj)r}r(h"X,Exclude log entries with the specified tag. h+}r(h-]h.]h/]h0]h2]uh#jh]r hl)r!}r"(h"X+Exclude log entries with the specified tag.r#h#jh$h'h)hoh+}r$(h-]h.]h/]h0]h2]uh4KDh]r%h>X+Exclude log entries with the specified tag.r&…r'}r((h"j#h#j!ubaubah)jwubeubeubeubh)r)}r*(h"Uh#hBh$h'h)h*h+}r+(h-]h.]h/]h0]r,hah2]r-h auh4KGh5hh]r.(h7)r/}r0(h"XSEE ALSOr1h#j)h$h'h)h;h+}r2(h-]h.]h/]h0]h2]uh4KGh5hh]r3h>XSEE ALSOr4…r5}r6(h"j1h#j/ubaubcdocutils.nodes bullet_list r7)r8}r9(h"Uh#j)h$h'h)U bullet_listr:h+}r;(Ubulletr<X*h0]h/]h-]h.]h2]uh4KIh5hh]r=(cdocutils.nodes list_item r>)r?}r@(h"X varnishd(1)rAh#j8h$h'h)U list_itemrBh+}rC(h-]h.]h/]h0]h2]uh4Nh5hh]rDhl)rE}rF(h"jAh#j?h$h'h)hoh+}rG(h-]h.]h/]h0]h2]uh4KIh]rHh>X varnishd(1)rI…rJ}rK(h"jAh#jEubaubaubj>)rL}rM(h"X varnishlog(1)rNh#j8h$h'h)jBh+}rO(h-]h.]h/]h0]h2]uh4Nh5hh]rPhl)rQ}rR(h"jNh#jLh$h'h)hoh+}rS(h-]h.]h/]h0]h2]uh4KJh]rTh>X varnishlog(1)rU…rV}rW(h"jNh#jQubaubaubj>)rX}rY(h"Xvarnishncsa(1)rZh#j8h$h'h)jBh+}r[(h-]h.]h/]h0]h2]uh4Nh5hh]r\hl)r]}r^(h"jZh#jXh$h'h)hoh+}r_(h-]h.]h/]h0]h2]uh4KKh]r`h>Xvarnishncsa(1)ra…rb}rc(h"jZh#j]ubaubaubj>)rd}re(h"Xvarnishstat(1)rfh#j8h$h'h)jBh+}rg(h-]h.]h/]h0]h2]uh4Nh5hh]rhhl)ri}rj(h"jfh#jdh$h'h)hoh+}rk(h-]h.]h/]h0]h2]uh4KLh]rlh>Xvarnishstat(1)rm…rn}ro(h"jfh#jiubaubaubj>)rp}rq(h"Xvarnishtop(1) h#j8h$h'h)jBh+}rr(h-]h.]h/]h0]h2]uh4Nh5hh]rshl)rt}ru(h"X varnishtop(1)rvh#jph$h'h)hoh+}rw(h-]h.]h/]h0]h2]uh4KMh]rxh>X varnishtop(1)ry…rz}r{(h"jvh#jtubaubaubeubeubh)r|}r}(h"Uh#hBh$h'h)h*h+}r~(h-]h.]h/]h0]rhah2]r€h auh4KPh5hh]r(h7)r‚}rƒ(h"XHISTORYr„h#j|h$h'h)h;h+}r…(h-]h.]h/]h0]h2]uh4KPh5hh]r†h>XHISTORYr‡…rˆ}r‰(h"j„h#j‚ubaubhl)rŠ}r‹(h"XªThe varnishsizes utility was developed by Kristian Lyngstøl based on varnishhist. This manual page was written by Kristian Lyngstøl, Dag-Erling Smørgrav and Per Buer.rŒh#j|h$h'h)hoh+}r(h-]h.]h/]h0]h2]uh4KRh5hh]rŽh>XªThe varnishsizes utility was developed by Kristian Lyngstøl based on varnishhist. This manual page was written by Kristian Lyngstøl, Dag-Erling Smørgrav and Per Buer.r…r}r‘(h"jŒh#jŠubaubeubh)r’}r“(h"Uh#hBh$h'h)h*h+}r”(h-]h.]h/]h0]r•hah2]r–hauh4KWh5hh]r—(h7)r˜}r™(h"X COPYRIGHTršh#j’h$h'h)h;h+}r›(h-]h.]h/]h0]h2]uh4KWh5hh]rœh>X COPYRIGHTr…rž}rŸ(h"jšh#j˜ubaubhl)r }r¡(h"X\This document is licensed under the same licence as Varnish itself. See LICENCE for details.r¢h#j’h$h'h)hoh+}r£(h-]h.]h/]h0]h2]uh4KYh5hh]r¤h>X\This document is licensed under the same licence as Varnish itself. See LICENCE for details.r¥…r¦}r§(h"j¢h#j ubaubj7)r¨}r©(h"Uh#j’h$h'h)j:h+}rª(j<X*h0]h/]h-]h.]h2]uh4K\h5hh]r«j>)r¬}r­(h"X&Copyright (c) 2010 Varnish Software ASr®h#j¨h$h'h)jBh+}r¯(h-]h.]h/]h0]h2]uh4Nh5hh]r°hl)r±}r²(h"j®h#j¬h$h'h)hoh+}r³(h-]h.]h/]h0]h2]uh4K\h]r´h>X&Copyright (c) 2010 Varnish Software ASrµ…r¶}r·(h"j®h#j±ubaubaubaubeubeubeubah"UU transformerr¸NU footnote_refsr¹}rºUrefnamesr»}r¼Usymbol_footnotesr½]r¾Uautofootnote_refsr¿]rÀUsymbol_footnote_refsrÁ]rÂU citationsrÃ]rÄh5hU current_linerÅNUtransform_messagesrÆ]rÇUreporterrÈNUid_startrÉKU autofootnotesrÊ]rËU citation_refsrÌ}rÍUindirect_targetsrÎ]rÏUsettingsrÐ(cdocutils.frontend Values rÑorÒ}rÓ(Ufootnote_backlinksrÔKUrecord_dependenciesrÕNU rfc_base_urlrÖUhttp://tools.ietf.org/html/r×U tracebackr؈Upep_referencesrÙNUstrip_commentsrÚNU toc_backlinksrÛUentryrÜU language_coderÝUenrÞU datestamprßNU report_levelràKU _destinationráNU halt_levelrâKU strip_classesrãNh;NUerror_encoding_error_handlerräUbackslashreplaceråUdebugræNUembed_stylesheetrç‰Uoutput_encoding_error_handlerrèUstrictréU sectnum_xformrêKUdump_transformsrëNU docinfo_xformrìKUwarning_streamríNUpep_file_url_templaterîUpep-%04drïUexit_status_levelrðKUconfigrñNUstrict_visitorròNUcloak_email_addressesróˆUtrim_footnote_reference_spacerô‰UenvrõNUdump_pseudo_xmlröNUexpose_internalsr÷NUsectsubtitle_xformrø‰U source_linkrùNUrfc_referencesrúNUoutput_encodingrûUutf-8rüU source_urlrýNUinput_encodingrþU utf-8-sigrÿU_disable_configrNU id_prefixrUU tab_widthrKUerror_encodingrUUTF-8rU_sourcerU:/home/tfheen/varnish/doc/sphinx/reference/varnishsizes.rstrUgettext_compactrˆU generatorrNUdump_internalsr NU smart_quotesr ‰U pep_base_urlr Uhttp://www.python.org/dev/peps/r Usyntax_highlightr UlongrUinput_encoding_error_handlerrjéUauto_id_prefixrUidrUdoctitle_xformr‰Ustrip_elements_with_classesrNU _config_filesr]Ufile_insertion_enabledrKU raw_enabledrKU dump_settingsrNubUsymbol_footnote_startrKUidsr}r(hj+hj’hj)hhìhh hhBhj|uUsubstitution_namesr}rh)h5h+}r(h-]h0]h/]Usourceh'h.]h2]uU footnotesr]rUrefidsr }r!ub.varnish-3.0.5/doc/sphinx/=build/doctrees/reference/varnishstat.doctree0000644000175000017500000005704412247037213023062 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(Xreference-varnishstatqˆXvarnish cache statisticsqNX descriptionqNX copyrightq NXsynopsisq NXsee alsoq NX varnishstatq NXhistoryq NuUsubstitution_defsq}qUparse_messagesq]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hUreference-varnishstatqhUvarnish-cache-statisticsqhU descriptionqh U copyrightqh Usynopsisqh Usee-alsoqh U varnishstatqh UhistoryquUchildrenq]q (cdocutils.nodes target q!)q"}q#(U rawsourceq$X.. _reference-varnishstat:Uparentq%hUsourceq&cdocutils.nodes reprunicode q'X9/home/tfheen/varnish/doc/sphinx/reference/varnishstat.rstq(…q)}q*bUtagnameq+Utargetq,U attributesq-}q.(Uidsq/]Ubackrefsq0]Udupnamesq1]Uclassesq2]Unamesq3]Urefidq4huUlineq5KUdocumentq6hh]ubcdocutils.nodes section q7)q8}q9(h$Uh%hh&h)Uexpect_referenced_by_nameq:}q;hh"sh+Usectionq(hheh3]q?(h heuh5Kh6hUexpect_referenced_by_idq@}qAhh"sh]qB(cdocutils.nodes title qC)qD}qE(h$X varnishstatqFh%h8h&h)h+UtitleqGh-}qH(h1]h2]h0]h/]h3]uh5Kh6hh]qIcdocutils.nodes Text qJX varnishstatqK…qL}qM(h$hFh%hDubaubh7)qN}qO(h$Uh%h8h&h)h+h}r?(h$X-1r@h-}rA(h1]h2]h0]h/]h3]uh%j9h]rBcdocutils.nodes option_string rC)rD}rE(h$j@h-}rF(h1]h2]h0]h/]h3]uh%j>h]rGhJX-1rH…rI}rJ(h$Uh%jDubah+U option_stringrKubah+UoptionrLubah+U option_grouprMubcdocutils.nodes description rN)rO}rP(h$XYInstead of presenting of a continuously updated display, print the statistics to stdout. h-}rQ(h1]h2]h0]h/]h3]uh%j3h]rRhx)rS}rT(h$XXInstead of presenting of a continuously updated display, print the statistics to stdout.rUh%jOh&h)h+h{h-}rV(h1]h2]h0]h/]h3]uh5Kh]rWhJXXInstead of presenting of a continuously updated display, print the statistics to stdout.rX…rY}rZ(h$jUh%jSubaubah+U descriptionr[ubeubj2)r\}r](h$Uh%j-h&h)h+j5h-}r^(h1]h2]h0]h/]h3]uh5Nh6hh]r_(j8)r`}ra(h$Uh-}rb(h1]h2]h0]h/]h3]uh%j\h]rcj=)rd}re(h$X-frfh-}rg(h1]h2]h0]h/]h3]uh%j`h]rhjC)ri}rj(h$jfh-}rk(h1]h2]h0]h/]h3]uh%jdh]rlhJX-frm…rn}ro(h$Uh%jiubah+jKubah+jLubah+jMubjN)rp}rq(h$XiA comma separated list of the fields to display. If it starts with '^' it is used as an exclusion list. h-}rr(h1]h2]h0]h/]h3]uh%j\h]rshx)rt}ru(h$XhA comma separated list of the fields to display. If it starts with '^' it is used as an exclusion list.rvh%jph&h)h+h{h-}rw(h1]h2]h0]h/]h3]uh5K!h]rxhJXhA comma separated list of the fields to display. If it starts with '^' it is used as an exclusion list.ry…rz}r{(h$jvh%jtubaubah+j[ubeubj2)r|}r}(h$Uh%j-h&h)h+j5h-}r~(h1]h2]h0]h/]h3]uh5Nh6hh]r(j8)r€}r(h$Uh-}r‚(h1]h2]h0]h/]h3]uh%j|h]rƒj=)r„}r…(h$X-lr†h-}r‡(h1]h2]h0]h/]h3]uh%j€h]rˆjC)r‰}rŠ(h$j†h-}r‹(h1]h2]h0]h/]h3]uh%j„h]rŒhJX-lr…rŽ}r(h$Uh%j‰ubah+jKubah+jLubah+jMubjN)r}r‘(h$X6Lists the available fields to use with the -f option. h-}r’(h1]h2]h0]h/]h3]uh%j|h]r“hx)r”}r•(h$X5Lists the available fields to use with the -f option.r–h%jh&h)h+h{h-}r—(h1]h2]h0]h/]h3]uh5K$h]r˜hJX5Lists the available fields to use with the -f option.r™…rš}r›(h$j–h%j”ubaubah+j[ubeubj2)rœ}r(h$Uh%j-h&h)h+j5h-}rž(h1]h2]h0]h/]h3]uh5Nh6hh]rŸ(j8)r }r¡(h$Uh-}r¢(h1]h2]h0]h/]h3]uh%jœh]r£j=)r¤}r¥(h$X-nr¦h-}r§(h1]h2]h0]h/]h3]uh%j h]r¨jC)r©}rª(h$j¦h-}r«(h1]h2]h0]h/]h3]uh%j¤h]r¬hJX-nr­…r®}r¯(h$Uh%j©ubah+jKubah+jLubah+jMubjN)r°}r±(h$XnSpecifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used. h-}r²(h1]h2]h0]h/]h3]uh%jœh]r³hx)r´}rµ(h$XmSpecifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used.r¶h%j°h&h)h+h{h-}r·(h1]h2]h0]h/]h3]uh5K&h]r¸hJXmSpecifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used.r¹…rº}r»(h$j¶h%j´ubaubah+j[ubeubj2)r¼}r½(h$Uh%j-h&h)h+j5h-}r¾(h1]h2]h0]h/]h3]uh5Nh6hh]r¿(j8)rÀ}rÁ(h$Uh-}rÂ(h1]h2]h0]h/]h3]uh%j¼h]rÃj=)rÄ}rÅ(h$X-VrÆh-}rÇ(h1]h2]h0]h/]h3]uh%jÀh]rÈjC)rÉ}rÊ(h$jÆh-}rË(h1]h2]h0]h/]h3]uh%jÄh]rÌhJX-VrÍ…rÎ}rÏ(h$Uh%jÉubah+jKubah+jLubah+jMubjN)rÐ}rÑ(h$X%Display the version number and exit. h-}rÒ(h1]h2]h0]h/]h3]uh%j¼h]rÓhx)rÔ}rÕ(h$X$Display the version number and exit.rÖh%jÐh&h)h+h{h-}r×(h1]h2]h0]h/]h3]uh5K)h]rØhJX$Display the version number and exit.rÙ…rÚ}rÛ(h$jÖh%jÔubaubah+j[ubeubj2)rÜ}rÝ(h$Uh%j-h&h)h+j5h-}rÞ(h1]h2]h0]h/]h3]uh5Nh6hh]rß(j8)rà}rá(h$Uh-}râ(h1]h2]h0]h/]h3]uh%jÜh]rãj=)rä}rå(h$X-w delayh-}ræ(h1]h2]h0]h/]h3]uh%jàh]rç(jC)rè}ré(h$X-wh-}rê(h1]h2]h0]h/]h3]uh%jäh]rëhJX-wrì…rí}rî(h$Uh%jèubah+jKubcdocutils.nodes option_argument rï)rð}rñ(h$Xdelayh-}rò(h/]h0]h1]U delimiterU h2]h3]uh%jäh]róhJXdelayrô…rõ}rö(h$Uh%jðubah+Uoption_argumentr÷ubeh+jLubah+jMubjN)rø}rù(h$XoWait delay seconds between updates. The default is 1. Can also be used with -1, -x or -j for repeated output. h-}rú(h1]h2]h0]h/]h3]uh%jÜh]rûhx)rü}rý(h$XnWait delay seconds between updates. The default is 1. Can also be used with -1, -x or -j for repeated output.rþh%jøh&h)h+h{h-}rÿ(h1]h2]h0]h/]h3]uh5K+h]rhJXnWait delay seconds between updates. The default is 1. Can also be used with -1, -x or -j for repeated output.r…r}r(h$jþh%jüubaubah+j[ubeubj2)r}r(h$Uh%j-h&h)h+j5h-}r(h1]h2]h0]h/]h3]uh5Nh6hh]r(j8)r}r (h$Uh-}r (h1]h2]h0]h/]h3]uh%jh]r j=)r }r (h$X-xrh-}r(h1]h2]h0]h/]h3]uh%jh]rjC)r}r(h$jh-}r(h1]h2]h0]h/]h3]uh%j h]rhJX-xr…r}r(h$Uh%jubah+jKubah+jLubah+jMubjN)r}r(h$XDisplays the result as XML. h-}r(h1]h2]h0]h/]h3]uh%jh]rhx)r}r(h$XDisplays the result as XML.rh%jh&h)h+h{h-}r(h1]h2]h0]h/]h3]uh5K-h]r hJXDisplays the result as XML.r!…r"}r#(h$jh%jubaubah+j[ubeubj2)r$}r%(h$Uh%j-h&h)h+j5h-}r&(h1]h2]h0]h/]h3]uh5Nh6hh]r'(j8)r(}r)(h$Uh-}r*(h1]h2]h0]h/]h3]uh%j$h]r+j=)r,}r-(h$X-jr.h-}r/(h1]h2]h0]h/]h3]uh%j(h]r0jC)r1}r2(h$j.h-}r3(h1]h2]h0]h/]h3]uh%j,h]r4hJX-jr5…r6}r7(h$Uh%j1ubah+jKubah+jLubah+jMubjN)r8}r9(h$XDisplays the result as JSON. h-}r:(h1]h2]h0]h/]h3]uh%j$h]r;hx)r<}r=(h$XDisplays the result as JSON.r>h%j8h&h)h+h{h-}r?(h1]h2]h0]h/]h3]uh5K/h]r@hJXDisplays the result as JSON.rA…rB}rC(h$j>h%j<ubaubah+j[ubeubeubhx)rD}rE(h$X8The columns in the main display are, from left to right:rFh%jh&h)h+h{h-}rG(h1]h2]h0]h/]h3]uh5K1h6hh]rHhJX8The columns in the main display are, from left to right:rI…rJ}rK(h$jFh%jDubaubcdocutils.nodes enumerated_list rL)rM}rN(h$Uh%jh&h)h+Uenumerated_listrOh-}rP(UsuffixrQU.h/]h0]h1]UprefixrRUh2]h3]UenumtyperSUarabicrTuh5K3h6hh]rU(cdocutils.nodes list_item rV)rW}rX(h$XValuerYh%jMh&h)h+U list_itemrZh-}r[(h1]h2]h0]h/]h3]uh5Nh6hh]r\hx)r]}r^(h$jYh%jWh&h)h+h{h-}r_(h1]h2]h0]h/]h3]uh5K3h]r`hJXValuera…rb}rc(h$jYh%j]ubaubaubjV)rd}re(h$X`Per-second average in the period since last update, or a period if the value can not be averagedrfh%jMh&h)h+jZh-}rg(h1]h2]h0]h/]h3]uh5Nh6hh]rhhx)ri}rj(h$jfh%jdh&h)h+h{h-}rk(h1]h2]h0]h/]h3]uh5K4h]rlhJX`Per-second average in the period since last update, or a period if the value can not be averagedrm…rn}ro(h$jfh%jiubaubaubjV)rp}rq(h$XVPer-second average over process lifetime, or a period if the value can not be averagedrrh%jMh&h)h+jZh-}rs(h1]h2]h0]h/]h3]uh5Nh6hh]rthx)ru}rv(h$jrh%jph&h)h+h{h-}rw(h1]h2]h0]h/]h3]uh5K5h]rxhJXVPer-second average over process lifetime, or a period if the value can not be averagedry…rz}r{(h$jrh%juubaubaubjV)r|}r}(h$XDescriptive text h%jMh&h)h+jZh-}r~(h1]h2]h0]h/]h3]uh5Nh6hh]rhx)r€}r(h$XDescriptive textr‚h%j|h&h)h+h{h-}rƒ(h1]h2]h0]h/]h3]uh5K6h]r„hJXDescriptive textr……r†}r‡(h$j‚h%j€ubaubaubeubhx)rˆ}r‰(h$XLWhen using the -1 option, the columns in the output are, from left to right:rŠh%jh&h)h+h{h-}r‹(h1]h2]h0]h/]h3]uh5K8h6hh]rŒhJXLWhen using the -1 option, the columns in the output are, from left to right:r…rŽ}r(h$jŠh%jˆubaubjL)r}r‘(h$Uh%jh&h)h+jOh-}r’(jQU.h/]h0]h1]jRUh2]h3]jSjTuh5K:h6hh]r“(jV)r”}r•(h$XSymbolic entry namer–h%jh&h)h+jZh-}r—(h1]h2]h0]h/]h3]uh5Nh6hh]r˜hx)r™}rš(h$j–h%j”h&h)h+h{h-}r›(h1]h2]h0]h/]h3]uh5K:h]rœhJXSymbolic entry namer…rž}rŸ(h$j–h%j™ubaubaubjV)r }r¡(h$XValuer¢h%jh&h)h+jZh-}r£(h1]h2]h0]h/]h3]uh5Nh6hh]r¤hx)r¥}r¦(h$j¢h%j h&h)h+h{h-}r§(h1]h2]h0]h/]h3]uh5K;h]r¨hJXValuer©…rª}r«(h$j¢h%j¥ubaubaubjV)r¬}r­(h$XVPer-second average over process lifetime, or a period if the value can not be averagedr®h%jh&h)h+jZh-}r¯(h1]h2]h0]h/]h3]uh5Nh6hh]r°hx)r±}r²(h$j®h%j¬h&h)h+h{h-}r³(h1]h2]h0]h/]h3]uh5K FIELD NAME FIELD VALUE FIELD DESCRIPTION h%jh&h)h+U literal_blockrÏh-}rÐ(U xml:spacerÑUpreserverÒh/]h0]h1]h2]h3]uh5KAh6hh]rÓhJXt FIELD NAME FIELD VALUE FIELD DESCRIPTION rÔ…rÕ}rÖ(h$Uh%jÍubaubhx)r×}rØ(h$XWith -j the output format is::rÙh%jh&h)h+h{h-}rÚ(h1]h2]h0]h/]h3]uh5KGh6hh]rÛhJXWith -j the output format is:rÜ…rÝ}rÞ(h$XWith -j the output format is:h%j×ubaubjÌ)rß}rà(h$X{ "timestamp": "YYYY-MM-DDTHH:mm:SS", "client_conn": { "value": 0, "flag": "a", "description": "Client connections accepted" }, "client_drop": { "value": 0, "flag": "a", "description": "Connection dropped, no sess/wrk" }, "LCK.backend.creat": { "type": "LCK", "ident": "backend", "value": 1, "flag": "a", "description": "Created locks" }, [..] }h%jh&h)h+jÏh-}rá(jÑjÒh/]h0]h1]h2]h3]uh5KIh6hh]râhJX{ "timestamp": "YYYY-MM-DDTHH:mm:SS", "client_conn": { "value": 0, "flag": "a", "description": "Client connections accepted" }, "client_drop": { "value": 0, "flag": "a", "description": "Connection dropped, no sess/wrk" }, "LCK.backend.creat": { "type": "LCK", "ident": "backend", "value": 1, "flag": "a", "description": "Created locks" }, [..] }rã…rä}rå(h$Uh%jßubaubhx)ræ}rç(h$XCTimestamp is the time when the report was generated by varnishstat.rèh%jh&h)h+h{h-}ré(h1]h2]h0]h/]h3]uh5KZh6hh]rêhJXCTimestamp is the time when the report was generated by varnishstat.rë…rì}rí(h$jèh%jæubaubhx)rî}rï(h$XcRepeated output with -1, -x or -j will have a single empty line (\\n) between each block of output.rðh%jh&h)h+h{h-}rñ(h1]h2]h0]h/]h3]uh5K\h6hh]ròhJXbRepeated output with -1, -x or -j will have a single empty line (\n) between each block of output.ró…rô}rõ(h$XcRepeated output with -1, -x or -j will have a single empty line (\\n) between each block of output.h%jîubaubeubh7)rö}r÷(h$Uh%hNh&h)h+h(h1]h2]h0]h/]h3]uh5Nh6hh]r?hx)r@}rA(h$j=h%j;h&h)h+h{h-}rB(h1]h2]h0]h/]h3]uh5Kfh]rChJX varnishtop(1)rD…rE}rF(h$j=h%j@ubaubaubjV)rG}rH(h$X curses(3) h%jh&h)h+jZh-}rI(h1]h2]h0]h/]h3]uh5Nh6hh]rJhx)rK}rL(h$X curses(3)rMh%jGh&h)h+h{h-}rN(h1]h2]h0]h/]h3]uh5Kgh]rOhJX curses(3)rP…rQ}rR(h$jMh%jKubaubaubeubeubh7)rS}rT(h$Uh%hNh&h)h+h(h/]h0]h1]h2]h4]uh6Kh7hh]q?cdocutils.nodes Text q@X varnishtopqA…qB}qC(h$h(h$j9h-}r?(h/]h0]h1]h2]h4]uh%j7h]r@h@X-1rA…rB}rC(h$Uh%j=ubah+U option_stringrDubah+UoptionrEubah+U option_grouprFubcdocutils.nodes description rG)rH}rI(h$XmInstead of presenting of a continuously updated display, print the statistics once and exit. Implies ``-d``. h-}rJ(h/]h0]h1]h2]h4]uh%j,h]rKhn)rL}rM(h$XlInstead of presenting of a continuously updated display, print the statistics once and exit. Implies ``-d``.h%jHh&h)h+hqh-}rN(h/]h0]h1]h2]h4]uh6K#h]rO(h@XeInstead of presenting of a continuously updated display, print the statistics once and exit. Implies rP…rQ}rR(h$XeInstead of presenting of a continuously updated display, print the statistics once and exit. Implies h%jLubhé)rS}rT(h$X``-d``h-}rU(h/]h0]h1]h2]h4]uh%jLh]rVh@X-drW…rX}rY(h$Uh%jSubah+hñubh@X.…rZ}r[(h$X.h%jLubeubah+U descriptionr\ubeubj+)r]}r^(h$Uh%j&h&h)h+j.h-}r_(h/]h0]h1]h2]h4]uh6Nh7hh]r`(j1)ra}rb(h$Uh-}rc(h/]h0]h1]h2]h4]uh%j]h]rdj6)re}rf(h$X-brgh-}rh(h/]h0]h1]h2]h4]uh%jah]rij<)rj}rk(h$jgh-}rl(h/]h0]h1]h2]h4]uh%jeh]rmh@X-brn…ro}rp(h$Uh%jjubah+jDubah+jEubah+jFubjG)rq}rr(h$XInclude log entries which result from communication with a backend server. If neither ``-b`` nor ``-c`` is specified, varnishtop acts as if they both were. h-}rs(h/]h0]h1]h2]h4]uh%j]h]rthn)ru}rv(h$XœInclude log entries which result from communication with a backend server. If neither ``-b`` nor ``-c`` is specified, varnishtop acts as if they both were.h%jqh&h)h+hqh-}rw(h/]h0]h1]h2]h4]uh6K&h]rx(h@XWInclude log entries which result from communication with a backend server. If neither ry…rz}r{(h$XWInclude log entries which result from communication with a backend server. If neither h%juubhé)r|}r}(h$X``-b``h-}r~(h/]h0]h1]h2]h4]uh%juh]rh@X-br€…r}r‚(h$Uh%j|ubah+hñubh@X nor rƒ…r„}r…(h$X nor h%juubhé)r†}r‡(h$X``-c``h-}rˆ(h/]h0]h1]h2]h4]uh%juh]r‰h@X-crŠ…r‹}rŒ(h$Uh%j†ubah+hñubh@X4 is specified, varnishtop acts as if they both were.r…rŽ}r(h$X4 is specified, varnishtop acts as if they both were.h%juubeubah+j\ubeubj+)r}r‘(h$Uh%j&h&h)h+j.h-}r’(h/]h0]h1]h2]h4]uh6Nh7hh]r“(j1)r”}r•(h$Uh-}r–(h/]h0]h1]h2]h4]uh%jh]r—j6)r˜}r™(h$X-Cršh-}r›(h/]h0]h1]h2]h4]uh%j”h]rœj<)r}rž(h$jšh-}rŸ(h/]h0]h1]h2]h4]uh%j˜h]r h@X-Cr¡…r¢}r£(h$Uh%jubah+jDubah+jEubah+jFubjG)r¤}r¥(h$X/Ignore case when matching regular expressions. h-}r¦(h/]h0]h1]h2]h4]uh%jh]r§hn)r¨}r©(h$X.Ignore case when matching regular expressions.rªh%j¤h&h)h+hqh-}r«(h/]h0]h1]h2]h4]uh6K*h]r¬h@X.Ignore case when matching regular expressions.r­…r®}r¯(h$jªh%j¨ubaubah+j\ubeubj+)r°}r±(h$Uh%j&h&h)h+j.h-}r²(h/]h0]h1]h2]h4]uh6Nh7hh]r³(j1)r´}rµ(h$Uh-}r¶(h/]h0]h1]h2]h4]uh%j°h]r·j6)r¸}r¹(h$X-crºh-}r»(h/]h0]h1]h2]h4]uh%j´h]r¼j<)r½}r¾(h$jºh-}r¿(h/]h0]h1]h2]h4]uh%j¸h]rÀh@X-crÁ…rÂ}rÃ(h$Uh%j½ubah+jDubah+jEubah+jFubjG)rÄ}rÅ(h$X•Include log entries which result from communication with a client. If neither ``-b`` nor ``-c`` is specified, varnishtop acts as if they both were. h-}rÆ(h/]h0]h1]h2]h4]uh%j°h]rÇhn)rÈ}rÉ(h$X”Include log entries which result from communication with a client. If neither ``-b`` nor ``-c`` is specified, varnishtop acts as if they both were.h%jÄh&h)h+hqh-}rÊ(h/]h0]h1]h2]h4]uh6K,h]rË(h@XOInclude log entries which result from communication with a client. If neither rÌ…rÍ}rÎ(h$XOInclude log entries which result from communication with a client. If neither h%jÈubhé)rÏ}rÐ(h$X``-b``h-}rÑ(h/]h0]h1]h2]h4]uh%jÈh]rÒh@X-brÓ…rÔ}rÕ(h$Uh%jÏubah+hñubh@X nor rÖ…r×}rØ(h$X nor h%jÈubhé)rÙ}rÚ(h$X``-c``h-}rÛ(h/]h0]h1]h2]h4]uh%jÈh]rÜh@X-crÝ…rÞ}rß(h$Uh%jÙubah+hñubh@X4 is specified, varnishtop acts as if they both were.rà…rá}râ(h$X4 is specified, varnishtop acts as if they both were.h%jÈubeubah+j\ubeubj+)rã}rä(h$Uh%j&h&h)h+j.h-}rå(h/]h0]h1]h2]h4]uh6Nh7hh]ræ(j1)rç}rè(h$Uh-}ré(h/]h0]h1]h2]h4]uh%jãh]rêj6)rë}rì(h$X-dríh-}rî(h/]h0]h1]h2]h4]uh%jçh]rïj<)rð}rñ(h$jíh-}rò(h/]h0]h1]h2]h4]uh%jëh]róh@X-drô…rõ}rö(h$Uh%jðubah+jDubah+jEubah+jFubjG)r÷}rø(h$X‚Process old log entries on startup. Normally, varnishtop will only process entries which are written to the log after it starts. h-}rù(h/]h0]h1]h2]h4]uh%jãh]rúhn)rû}rü(h$XProcess old log entries on startup. Normally, varnishtop will only process entries which are written to the log after it starts.rýh%j÷h&h)h+hqh-}rþ(h/]h0]h1]h2]h4]uh6K0h]rÿh@XProcess old log entries on startup. Normally, varnishtop will only process entries which are written to the log after it starts.r…r}r(h$jýh%jûubaubah+j\ubeubj+)r}r(h$Uh%j&h&h)h+j.h-}r(h/]h0]h1]h2]h4]uh6Nh7hh]r(j1)r}r(h$Uh-}r (h/]h0]h1]h2]h4]uh%jh]r j6)r }r (h$X-fr h-}r(h/]h0]h1]h2]h4]uh%jh]rj<)r}r(h$j h-}r(h/]h0]h1]h2]h4]uh%j h]rh@X-fr…r}r(h$Uh%jubah+jDubah+jEubah+jFubjG)r}r(h$X 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. h-}r(h/]h0]h1]h2]h4]uh%jh]rhn)r}r(h$XŸ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.rh%jh&h)h+hqh-}r(h/]h0]h1]h2]h4]uh6K4h]rh@XŸ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.r …r!}r"(h$jh%jubaubah+j\ubeubj+)r#}r$(h$Uh%j&h&h)h+j.h-}r%(h/]h0]h1]h2]h4]uh6Nh7hh]r&(j1)r'}r((h$Uh-}r)(h/]h0]h1]h2]h4]uh%j#h]r*j6)r+}r,(h$X-I regexh-}r-(h/]h0]h1]h2]h4]uh%j'h]r.(j<)r/}r0(h$X-Ih-}r1(h/]h0]h1]h2]h4]uh%j+h]r2h@X-Ir3…r4}r5(h$Uh%j/ubah+jDubcdocutils.nodes option_argument r6)r7}r8(h$Xregexh-}r9(h2]h1]h/]U delimiterU h0]h4]uh%j+h]r:h@Xregexr;…r<}r=(h$Uh%j7ubah+Uoption_argumentr>ubeh+jEubah+jFubjG)r?}r@(h$XŒInclude log entries which match the specified regular expression. If neither ``-I`` nor ``-i`` is specified, all log entries are included. h-}rA(h/]h0]h1]h2]h4]uh%j#h]rBhn)rC}rD(h$X‹Include log entries which match the specified regular expression. If neither ``-I`` nor ``-i`` is specified, all log entries are included.h%j?h&h)h+hqh-}rE(h/]h0]h1]h2]h4]uh6K8h]rF(h@XNInclude log entries which match the specified regular expression. If neither rG…rH}rI(h$XNInclude log entries which match the specified regular expression. If neither h%jCubhé)rJ}rK(h$X``-I``h-}rL(h/]h0]h1]h2]h4]uh%jCh]rMh@X-IrN…rO}rP(h$Uh%jJubah+hñubh@X nor rQ…rR}rS(h$X nor h%jCubhé)rT}rU(h$X``-i``h-}rV(h/]h0]h1]h2]h4]uh%jCh]rWh@X-irX…rY}rZ(h$Uh%jTubah+hñubh@X, is specified, all log entries are included.r[…r\}r](h$X, is specified, all log entries are included.h%jCubeubah+j\ubeubj+)r^}r_(h$Uh%j&h&h)h+j.h-}r`(h/]h0]h1]h2]h4]uh6Nh7hh]ra(j1)rb}rc(h$Uh-}rd(h/]h0]h1]h2]h4]uh%j^h]rej6)rf}rg(h$X-i tagh-}rh(h/]h0]h1]h2]h4]uh%jbh]ri(j<)rj}rk(h$X-ih-}rl(h/]h0]h1]h2]h4]uh%jfh]rmh@X-irn…ro}rp(h$Uh%jjubah+jDubj6)rq}rr(h$Xtagh-}rs(h2]h1]h/]U delimiterU h0]h4]uh%jfh]rth@Xtagru…rv}rw(h$Uh%jqubah+j>ubeh+jEubah+jFubjG)rx}ry(h$XvInclude log entries with the specified tag. If neither ``-I`` nor ``-i`` is specified, all log entries are included. h-}rz(h/]h0]h1]h2]h4]uh%j^h]r{hn)r|}r}(h$XuInclude log entries with the specified tag. If neither ``-I`` nor ``-i`` is specified, all log entries are included.h%jxh&h)h+hqh-}r~(h/]h0]h1]h2]h4]uh6Kubeh+jEubah+jFubjG)r±}r²(h$X§Specifies the number of seconds to measure over, the default is 60 seconds. The first number in the list is the average number of requests seen over this time period. h-}r³(h/]h0]h1]h2]h4]uh%j—h]r´hn)rµ}r¶(h$X¦Specifies the number of seconds to measure over, the default is 60 seconds. The first number in the list is the average number of requests seen over this time period.r·h%j±h&h)h+hqh-}r¸(h/]h0]h1]h2]h4]uh6K?h]r¹h@X¦Specifies the number of seconds to measure over, the default is 60 seconds. The first number in the list is the average number of requests seen over this time period.rº…r»}r¼(h$j·h%jµubaubah+j\ubeubj+)r½}r¾(h$Uh%j&h&h)h+j.h-}r¿(h/]h0]h1]h2]h4]uh6Nh7hh]rÀ(j1)rÁ}rÂ(h$Uh-}rÃ(h/]h0]h1]h2]h4]uh%j½h]rÄj6)rÅ}rÆ(h$X-nrÇh-}rÈ(h/]h0]h1]h2]h4]uh%jÁh]rÉj<)rÊ}rË(h$jÇh-}rÌ(h/]h0]h1]h2]h4]uh%jÅh]rÍh@X-nrÎ…rÏ}rÐ(h$Uh%jÊubah+jDubah+jEubah+jFubjG)rÑ}rÒ(h$XqSpecifies the name of the varnishd instance to get logs from. If ``-n`` is not specified, the host name is used. h-}rÓ(h/]h0]h1]h2]h4]uh%j½h]rÔhn)rÕ}rÖ(h$XpSpecifies the name of the varnishd instance to get logs from. If ``-n`` is not specified, the host name is used.h%jÑh&h)h+hqh-}r×(h/]h0]h1]h2]h4]uh6KCh]rØ(h@XASpecifies the name of the varnishd instance to get logs from. If rÙ…rÚ}rÛ(h$XASpecifies the name of the varnishd instance to get logs from. If h%jÕubhé)rÜ}rÝ(h$X``-n``h-}rÞ(h/]h0]h1]h2]h4]uh%jÕh]rßh@X-nrà…rá}râ(h$Uh%jÜubah+hñubh@X) is not specified, the host name is used.rã…rä}rå(h$X) is not specified, the host name is used.h%jÕubeubah+j\ubeubj+)ræ}rç(h$Uh%j&h&h)h+j.h-}rè(h/]h0]h1]h2]h4]uh6Nh7hh]ré(j1)rê}rë(h$Uh-}rì(h/]h0]h1]h2]h4]uh%jæh]ríj6)rî}rï(h$X-r fileh-}rð(h/]h0]h1]h2]h4]uh%jêh]rñ(j<)rò}ró(h$X-rh-}rô(h/]h0]h1]h2]h4]uh%jîh]rõh@X-rrö…r÷}rø(h$Uh%jòubah+jDubj6)rù}rú(h$Xfileh-}rû(h2]h1]h/]U delimiterU h0]h4]uh%jîh]rüh@Xfilerý…rþ}rÿ(h$Uh%jùubah+j>ubeh+jEubah+jFubjG)r}r(h$X5Read log entries from file instead of shared memory. h-}r(h/]h0]h1]h2]h4]uh%jæh]rhn)r}r(h$X4Read log entries from file instead of shared memory.rh%jh&h)h+hqh-}r(h/]h0]h1]h2]h4]uh6KFh]rh@X4Read log entries from file instead of shared memory.r …r }r (h$jh%jubaubah+j\ubeubj+)r }r (h$Uh%j&h&h)h+j.h-}r(h/]h0]h1]h2]h4]uh6Nh7hh]r(j1)r}r(h$Uh-}r(h/]h0]h1]h2]h4]uh%j h]rj6)r}r(h$X-Vrh-}r(h/]h0]h1]h2]h4]uh%jh]rj<)r}r(h$jh-}r(h/]h0]h1]h2]h4]uh%jh]rh@X-Vr…r}r(h$Uh%jubah+jDubah+jEubah+jFubjG)r }r!(h$X%Display the version number and exit. h-}r"(h/]h0]h1]h2]h4]uh%j h]r#hn)r$}r%(h$X$Display the version number and exit.r&h%j h&h)h+hqh-}r'(h/]h0]h1]h2]h4]uh6KHh]r(h@X$Display the version number and exit.r)…r*}r+(h$j&h%j$ubaubah+j\ubeubj+)r,}r-(h$Uh%j&h&h)h+j.h-}r.(h/]h0]h1]h2]h4]uh6Nh7hh]r/(j1)r0}r1(h$Uh-}r2(h/]h0]h1]h2]h4]uh%j,h]r3j6)r4}r5(h$X-X regexh-}r6(h/]h0]h1]h2]h4]uh%j0h]r7(j<)r8}r9(h$X-Xh-}r:(h/]h0]h1]h2]h4]uh%j4h]r;h@X-Xr<…r=}r>(h$Uh%j8ubah+jDubj6)r?}r@(h$Xregexh-}rA(h2]h1]h/]U delimiterU h0]h4]uh%j4h]rBh@XregexrC…rD}rE(h$Uh%j?ubah+j>ubeh+jEubah+jFubjG)rF}rG(h$XBExclude log entries which match the specified regular expression. h-}rH(h/]h0]h1]h2]h4]uh%j,h]rIhn)rJ}rK(h$XAExclude log entries which match the specified regular expression.rLh%jFh&h)h+hqh-}rM(h/]h0]h1]h2]h4]uh6KJh]rNh@XAExclude log entries which match the specified regular expression.rO…rP}rQ(h$jLh%jJubaubah+j\ubeubj+)rR}rS(h$Uh%j&h&h)h+j.h-}rT(h/]h0]h1]h2]h4]uh6Nh7hh]rU(j1)rV}rW(h$Uh-}rX(h/]h0]h1]h2]h4]uh%jRh]rYj6)rZ}r[(h$X-x tagh-}r\(h/]h0]h1]h2]h4]uh%jVh]r](j<)r^}r_(h$X-xh-}r`(h/]h0]h1]h2]h4]uh%jZh]rah@X-xrb…rc}rd(h$Uh%j^ubah+jDubj6)re}rf(h$Xtagh-}rg(h2]h1]h/]U delimiterU h0]h4]uh%jZh]rhh@Xtagri…rj}rk(h$Uh%jeubah+j>ubeh+jEubah+jFubjG)rl}rm(h$X,Exclude log entries with the specified tag. h-}rn(h/]h0]h1]h2]h4]uh%jRh]rohn)rp}rq(h$X+Exclude log entries with the specified tag.rrh%jlh&h)h+hqh-}rs(h/]h0]h1]h2]h4]uh6KLh]rth@X+Exclude log entries with the specified tag.ru…rv}rw(h$jrh%jpubaubah+j\ubeubeubeubh!)rx}ry(h$Uh%hDh&h)h+h,h-}rz(h/]h0]h1]h2]r{hah4]r|h auh6KOh7hh]r}(h9)r~}r(h$XEXAMPLESr€h%jxh&h)h+h=h-}r(h/]h0]h1]h2]h4]uh6KOh7hh]r‚h@XEXAMPLESrƒ…r„}r…(h$j€h%j~ubaubhn)r†}r‡(h$XbThe following example displays a continuously updated list of the most frequently requested URLs::h%jxh&h)h+hqh-}rˆ(h/]h0]h1]h2]h4]uh6KQh7hh]r‰h@XaThe following example displays a continuously updated list of the most frequently requested URLs:rŠ…r‹}rŒ(h$XaThe following example displays a continuously updated list of the most frequently requested URLs:h%j†ubaubcdocutils.nodes literal_block r)rŽ}r(h$Xvarnishtop -i RxURLh%jxh&h)h+U literal_blockrh-}r‘(U xml:spacer’Upreserver“h2]h1]h/]h0]h4]uh6KTh7hh]r”h@Xvarnishtop -i RxURLr•…r–}r—(h$Uh%jŽubaubhn)r˜}r™(h$XbThe following example displays a continuously updated list of the most commonly used user agents::h%jxh&h)h+hqh-}rš(h/]h0]h1]h2]h4]uh6KVh7hh]r›h@XaThe following example displays a continuously updated list of the most commonly used user agents:rœ…r}rž(h$XaThe following example displays a continuously updated list of the most commonly used user agents:h%j˜ubaubj)rŸ}r (h$X(varnishtop -i RxHeader -C -I ^User-Agenth%jxh&h)h+jh-}r¡(j’j“h2]h1]h/]h0]h4]uh6KYh7hh]r¢h@X(varnishtop -i RxHeader -C -I ^User-Agentr£…r¤}r¥(h$Uh%jŸubaubeubh!)r¦}r§(h$Uh%hDh&h)h+h,h-}r¨(h/]h0]h1]h2]r©hah4]rªh auh6K\h7hh]r«(h9)r¬}r­(h$XSEE ALSOr®h%j¦h&h)h+h=h-}r¯(h/]h0]h1]h2]h4]uh6K\h7hh]r°h@XSEE ALSOr±…r²}r³(h$j®h%j¬ubaubcdocutils.nodes bullet_list r´)rµ}r¶(h$Uh%j¦h&h)h+U bullet_listr·h-}r¸(Ubulletr¹X*h2]h1]h/]h0]h4]uh6K^h7hh]rº(cdocutils.nodes list_item r»)r¼}r½(h$X varnishd(1)r¾h%jµh&h)h+U list_itemr¿h-}rÀ(h/]h0]h1]h2]h4]uh6Nh7hh]rÁhn)rÂ}rÃ(h$j¾h%j¼h&h)h+hqh-}rÄ(h/]h0]h1]h2]h4]uh6K^h]rÅh@X varnishd(1)rÆ…rÇ}rÈ(h$j¾h%jÂubaubaubj»)rÉ}rÊ(h$Xvarnishhist(1)rËh%jµh&h)h+j¿h-}rÌ(h/]h0]h1]h2]h4]uh6Nh7hh]rÍhn)rÎ}rÏ(h$jËh%jÉh&h)h+hqh-}rÐ(h/]h0]h1]h2]h4]uh6K_h]rÑh@Xvarnishhist(1)rÒ…rÓ}rÔ(h$jËh%jÎubaubaubj»)rÕ}rÖ(h$X varnishlog(1)r×h%jµh&h)h+j¿h-}rØ(h/]h0]h1]h2]h4]uh6Nh7hh]rÙhn)rÚ}rÛ(h$j×h%jÕh&h)h+hqh-}rÜ(h/]h0]h1]h2]h4]uh6K`h]rÝh@X varnishlog(1)rÞ…rß}rà(h$j×h%jÚubaubaubj»)rá}râ(h$Xvarnishncsa(1)rãh%jµh&h)h+j¿h-}rä(h/]h0]h1]h2]h4]uh6Nh7hh]råhn)ræ}rç(h$jãh%jáh&h)h+hqh-}rè(h/]h0]h1]h2]h4]uh6Kah]réh@Xvarnishncsa(1)rê…rë}rì(h$jãh%jæubaubaubj»)rí}rî(h$Xvarnishstat(1) h%jµh&h)h+j¿h-}rï(h/]h0]h1]h2]h4]uh6Nh7hh]rðhn)rñ}rò(h$Xvarnishstat(1)róh%jíh&h)h+hqh-}rô(h/]h0]h1]h2]h4]uh6Kbh]rõh@Xvarnishstat(1)rö…r÷}rø(h$jóh%jñubaubaubeubeubh!)rù}rú(h$Uh%hDh&h)h+h,h-}rû(h/]h0]h1]h2]rühah4]rýh auh6Keh7hh]rþ(h9)rÿ}r(h$XHISTORYrh%jùh&h)h+h=h-}r(h/]h0]h1]h2]h4]uh6Keh7hh]rh@XHISTORYr…r}r(h$jh%jÿubaubhn)r}r(h$Xó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.r h%jùh&h)h+hqh-}r (h/]h0]h1]h2]h4]uh6Kgh7hh]r h@Xó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.r …r }r(h$j h%jubaubeubh!)r}r(h$Uh%hDh&h)h+h,h-}r(h/]h0]h1]h2]rhah4]rhauh6Kmh7hh]r(h9)r}r(h$X COPYRIGHTrh%jh&h)h+h=h-}r(h/]h0]h1]h2]h4]uh6Kmh7hh]rh@X COPYRIGHTr…r}r(h$jh%jubaubhn)r}r(h$X\This document is licensed under the same licence as Varnish itself. See LICENCE for details.rh%jh&h)h+hqh-}r (h/]h0]h1]h2]h4]uh6Koh7hh]r!h@X\This document is licensed under the same licence as Varnish itself. See LICENCE for details.r"…r#}r$(h$jh%jubaubj´)r%}r&(h$Uh%jh&h)h+j·h-}r'(j¹X*h2]h1]h/]h0]h4]uh6Krh7hh]r((j»)r)}r*(h$X"Copyright (c) 2006 Verdens Gang ASr+h%j%h&h)h+j¿h-}r,(h/]h0]h1]h2]h4]uh6Nh7hh]r-hn)r.}r/(h$j+h%j)h&h)h+hqh-}r0(h/]h0]h1]h2]h4]uh6Krh]r1h@X"Copyright (c) 2006 Verdens Gang ASr2…r3}r4(h$j+h%j.ubaubaubj»)r5}r6(h$X+Copyright (c) 2006-2011 Varnish Software ASr7h%j%h&h)h+j¿h-}r8(h/]h0]h1]h2]h4]uh6Nh7hh]r9hn)r:}r;(h$j7h%j5h&h)h+hqh-}r<(h/]h0]h1]h2]h4]uh6Ksh]r=h@X+Copyright (c) 2006-2011 Varnish Software ASr>…r?}r@(h$j7h%j:ubaubaubeubeubeubeubah$UU transformerrANU footnote_refsrB}rCUrefnamesrD}rEUsymbol_footnotesrF]rGUautofootnote_refsrH]rIUsymbol_footnote_refsrJ]rKU citationsrL]rMh7hU current_linerNNUtransform_messagesrO]rPUreporterrQNUid_startrRKU autofootnotesrS]rTU citation_refsrU}rVUindirect_targetsrW]rXUsettingsrY(cdocutils.frontend Values rZor[}r\(Ufootnote_backlinksr]KUrecord_dependenciesr^NU rfc_base_urlr_Uhttp://tools.ietf.org/html/r`U tracebackraˆUpep_referencesrbNUstrip_commentsrcNU toc_backlinksrdUentryreU language_coderfUenrgU datestamprhNU report_levelriKU _destinationrjNU halt_levelrkKU strip_classesrlNh=NUerror_encoding_error_handlerrmUbackslashreplacernUdebugroNUembed_stylesheetrp‰Uoutput_encoding_error_handlerrqUstrictrrU sectnum_xformrsKUdump_transformsrtNU docinfo_xformruKUwarning_streamrvNUpep_file_url_templaterwUpep-%04drxUexit_status_levelryKUconfigrzNUstrict_visitorr{NUcloak_email_addressesr|ˆUtrim_footnote_reference_spacer}‰Uenvr~NUdump_pseudo_xmlrNUexpose_internalsr€NUsectsubtitle_xformr‰U source_linkr‚NUrfc_referencesrƒNUoutput_encodingr„Uutf-8r…U source_urlr†NUinput_encodingr‡U utf-8-sigrˆU_disable_configr‰NU id_prefixrŠUU tab_widthr‹KUerror_encodingrŒUUTF-8rU_sourcerŽU8/home/tfheen/varnish/doc/sphinx/reference/varnishtop.rstrUgettext_compactrˆU generatorr‘NUdump_internalsr’NU smart_quotesr“‰U pep_base_urlr”Uhttp://www.python.org/dev/peps/r•Usyntax_highlightr–Ulongr—Uinput_encoding_error_handlerr˜jrUauto_id_prefixr™UidršUdoctitle_xformr›‰Ustrip_elements_with_classesrœNU _config_filesr]Ufile_insertion_enabledržKU raw_enabledrŸKU dump_settingsr NubUsymbol_footnote_startr¡KUidsr¢}r£(hh"hhÔhjhj¦hhDhh¾hjxhjùuUsubstitution_namesr¤}r¥h+h7h-}r¦(h/]h2]h1]Usourceh)h0]h4]uU footnotesr§]r¨Urefidsr©}rªub.varnish-3.0.5/doc/sphinx/=build/doctrees/reference/varnishd.doctree0000644000175000017500000057226712247037213022343 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(Xhttp accelerator daemonqNXmanagement interfaceqNXvarnishdqNX descriptionq NX copyrightq NXrun-time parametersq NXhash algorithmsq NXsynopsisq NXtransient storageqNX ref-varnishdqˆXsee alsoqNXhistoryqNXoptionsqNX storage typesqNuUsubstitution_defsq}qUparse_messagesq]q(cdocutils.nodes system_message q)q}q(U rawsourceqUU attributesq}q(Udupnamesq]UlevelKUidsq]Ubackrefsq ]Usourcecdocutils.nodes reprunicode q!Xreference/params.rstq"…q#}q$bUclassesq%]Unamesq&]UlineK„UtypeUWARNINGq'uUparentq(cdocutils.nodes definition q))q*}q+(hUh}q,(h]h%]h ]h]h&]uh(cdocutils.nodes definition_list_item q-)q.}q/(hX¥diag_bitmap - Units: bitmap - Default: 0 Bitmap controlling diagnostics code:: 0x00000001 - CNT_Session states. 0x00000002 - workspace debugging. 0x00000004 - kqueue debugging. 0x00000008 - mutex logging. 0x00000010 - mutex contests. 0x00000020 - waiting list. 0x00000040 - object workspace. 0x00001000 - do not core-dump child process. 0x00002000 - only short panic message. 0x00004000 - panic to stderr. 0x00010000 - synchronize shmlog. 0x00020000 - synchronous start of persistence. 0x00040000 - release VCL early. 0x00080000 - ban-lurker debugging. 0x80000000 - do edge-detection on digest. Use 0x notation and do the bitor in your head :-) h(cdocutils.nodes definition_list q0)q1}q2(hUh(cdocutils.nodes section q3)q4}q5(hUh(h3)q6}q7(hUh(h3)q8}q9(hUh(h3)q:}q;(hUh(hUsourceq}q?bUexpect_referenced_by_nameq@}qAhcdocutils.nodes target qB)qC}qD(hX.. _ref-varnishd:h(hhUtagnameqEUtargetqFh}qG(h]h ]h]h%]h&]UrefidqHU ref-varnishdqIuUlineqJKUdocumentqKhUchildrenqL]ubshEUsectionqMh}qN(h]h%]h ]h]qO(UvarnishdqPhIeh&]qQ(hheuhJKhKhUexpect_referenced_by_idqR}qShIhCshL]qT(cdocutils.nodes title qU)qV}qW(hXvarnishdqXh(h:hhEUtitleqYh}qZ(h]h%]h ]h]h&]uhJKhKhhL]q[cdocutils.nodes Text q\Xvarnishdq]…q^}q_(hhXh(hVubaubh8eubhhEhMh}q`(h]h%]h ]h]qaUhttp-accelerator-daemonqbah&]qchauhJK hKhhL]qd(hU)qe}qf(hXHTTP accelerator daemonqgh(h8hhEhYh}qh(h]h%]h ]h]h&]uhJK hKhhL]qih\XHTTP accelerator daemonqj…qk}ql(hhgh(heubaubcdocutils.nodes field_list qm)qn}qo(hUh(h8hhEU field_listqph}qq(h]h%]h ]h]h&]uhJK hKhhL]qr(cdocutils.nodes field qs)qt}qu(hUh(hnhhEUfieldqvh}qw(h]h%]h ]h]h&]uhJK hKhhL]qx(cdocutils.nodes field_name qy)qz}q{(hXAuthorq|h}q}(h]h%]h ]h]h&]uh(hthL]q~h\XAuthorq…q€}q(hh|h(hzubahEU field_nameq‚ubcdocutils.nodes field_body qƒ)q„}q…(hXDag-Erling Smørgravq†h}q‡(h]h%]h ]h]h&]uh(hthL]qˆcdocutils.nodes paragraph q‰)qŠ}q‹(hh†h(h„hhEU paragraphqŒh}q(h]h%]h ]h]h&]uhJK hL]qŽh\XDag-Erling Smørgravq…q}q‘(hh†h(hŠubaubahEU field_bodyq’ubeubhs)q“}q”(hUh(hnhhEhvh}q•(h]h%]h ]h]h&]uhJK hKhhL]q–(hy)q—}q˜(hXAuthorq™h}qš(h]h%]h ]h]h&]uh(h“hL]q›h\XAuthorqœ…q}qž(hh™h(h—ubahEh‚ubhƒ)qŸ}q (hXStig Sandbeck Mathisenq¡h}q¢(h]h%]h ]h]h&]uh(h“hL]q£h‰)q¤}q¥(hh¡h(hŸhhEhŒh}q¦(h]h%]h ]h]h&]uhJK hL]q§h\XStig Sandbeck Mathisenq¨…q©}qª(hh¡h(h¤ubaubahEh’ubeubhs)q«}q¬(hUh(hnhhEhvh}q­(h]h%]h ]h]h&]uhJK hKhhL]q®(hy)q¯}q°(hXAuthorq±h}q²(h]h%]h ]h]h&]uh(h«hL]q³h\XAuthorq´…qµ}q¶(hh±h(h¯ubahEh‚ubhƒ)q·}q¸(hXPer Buerq¹h}qº(h]h%]h ]h]h&]uh(h«hL]q»h‰)q¼}q½(hh¹h(h·hhEhŒh}q¾(h]h%]h ]h]h&]uhJK hL]q¿h\XPer BuerqÀ…qÁ}qÂ(hh¹h(h¼ubaubahEh’ubeubhs)qÃ}qÄ(hUh(hnhhEhvh}qÅ(h]h%]h ]h]h&]uhJKhKhhL]qÆ(hy)qÇ}qÈ(hXDateqÉh}qÊ(h]h%]h ]h]h&]uh(hÃhL]qËh\XDateqÌ…qÍ}qÎ(hhÉh(hÇubahEh‚ubhƒ)qÏ}qÐ(hX 2010-05-31qÑh}qÒ(h]h%]h ]h]h&]uh(hÃhL]qÓh‰)qÔ}qÕ(hhÑh(hÏhhEhŒh}qÖ(h]h%]h ]h]h&]uhJKhL]q×h\X 2010-05-31qØ…qÙ}qÚ(hhÑh(hÔubaubahEh’ubeubhs)qÛ}qÜ(hUh(hnhhEhvh}qÝ(h]h%]h ]h]h&]uhJKhKhhL]qÞ(hy)qß}qà(hXVersionqáh}qâ(h]h%]h ]h]h&]uh(hÛhL]qãh\XVersionqä…qå}qæ(hháh(hßubahEh‚ubhƒ)qç}qè(hX1.0qéh}qê(h]h%]h ]h]h&]uh(hÛhL]qëh‰)qì}qí(hhéh(hçhhEhŒh}qî(h]h%]h ]h]h&]uhJKhL]qïh\X1.0qð…qñ}qò(hhéh(hìubaubahEh’ubeubhs)qó}qô(hUh(hnhhEhvh}qõ(h]h%]h ]h]h&]uhJKhKhhL]qö(hy)q÷}qø(hXManual sectionqùh}qú(h]h%]h ]h]h&]uh(hóhL]qûh\XManual sectionqü…qý}qþ(hhùh(h÷ubahEh‚ubhƒ)qÿ}r(hX1 h}r(h]h%]h ]h]h&]uh(hóhL]rh‰)r}r(hX1h(hÿhhEhŒh}r(h]h%]h ]h]h&]uhJKhL]rh\X1…r}r(hX1h(jubaubahEh’ubeubeubh3)r }r (hUh(h8hhEhMh}r (h]h%]h ]h]r Usynopsisr ah&]rh auhJKhKhhL]r(hU)r}r(hXSYNOPSISrh(j hhEhYh}r(h]h%]h ]h]h&]uhJKhKhhL]rh\XSYNOPSISr…r}r(hjh(jubaubh0)r}r(hUh(j hhEUdefinition_listrh}r(h]h%]h ]h]h&]uhJNhKhhL]rh-)r}r(hXÿvarnishd [-a address[:port]] [-b host[:port]] [-d] [-F] [-f config] [-g group] [-h type[,options]] [-i identity] [-l shmlogsize] [-n name] [-P file] [-p param=value] [-s type[,options]] [-T address[:port]] [-t ttl] [-u user] [-V] [-w min[,max[,timeout]]] h(jhhEUdefinition_list_itemrh}r (h]h%]h ]h]h&]uhJKhL]r!(cdocutils.nodes term r")r#}r$(hXCvarnishd [-a address[:port]] [-b host[:port]] [-d] [-F] [-f config]r%h(jhhEUtermr&h}r'(h]h%]h ]h]h&]uhJKhL]r(h\XCvarnishd [-a address[:port]] [-b host[:port]] [-d] [-F] [-f config]r)…r*}r+(hj%h(j#ubaubh))r,}r-(hUh}r.(h]h%]h ]h]h&]uh(jhL]r/h‰)r0}r1(hXº[-g group] [-h type[,options]] [-i identity] [-l shmlogsize] [-n name] [-P file] [-p param=value] [-s type[,options]] [-T address[:port]] [-t ttl] [-u user] [-V] [-w min[,max[,timeout]]]r2h(j,hhEhŒh}r3(h]h%]h ]h]h&]uhJKhL]r4h\Xº[-g group] [-h type[,options]] [-i identity] [-l shmlogsize] [-n name] [-P file] [-p param=value] [-s type[,options]] [-T address[:port]] [-t ttl] [-u user] [-V] [-w min[,max[,timeout]]]r5…r6}r7(hj2h(j0ubaubahEU definitionr8ubeubaubeubh3)r9}r:(hUh(h8hhEhMh}r;(h]h%]h ]h]r<U descriptionr=ah&]r>h auhJKhKhhL]r?(hU)r@}rA(hX DESCRIPTIONrBh(j9hhEhYh}rC(h]h%]h ]h]h&]uhJKhKhhL]rDh\X DESCRIPTIONrE…rF}rG(hjBh(j@ubaubh‰)rH}rI(hXµ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.rJh(j9hhEhŒh}rK(h]h%]h ]h]h&]uhJKhKhhL]rLh\Xµ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.rM…rN}rO(hjJh(jHubaubeubh6h3)rP}rQ(hUh(h8hhEhMh}rR(h]h%]h ]h]rSUsee-alsorTah&]rUhauhJM<hKhhL]rV(hU)rW}rX(hXSEE ALSOrYh(jPhhEhYh}rZ(h]h%]h ]h]h&]uhJM<hKhhL]r[h\XSEE ALSOr\…r]}r^(hjYh(jWubaubcdocutils.nodes bullet_list r_)r`}ra(hUh(jPhhEU bullet_listrbh}rc(UbulletrdX*h]h ]h]h%]h&]uhJM>hKhhL]re(cdocutils.nodes list_item rf)rg}rh(hXvarnish-cli(7)rih(j`hhEU list_itemrjh}rk(h]h%]h ]h]h&]uhJNhKhhL]rlh‰)rm}rn(hjih(jghhEhŒh}ro(h]h%]h ]h]h&]uhJM>hL]rph\Xvarnish-cli(7)rq…rr}rs(hjih(jmubaubaubjf)rt}ru(hX varnishlog(1)rvh(j`hhEjjh}rw(h]h%]h ]h]h&]uhJNhKhhL]rxh‰)ry}rz(hjvh(jthhEhŒh}r{(h]h%]h ]h]h&]uhJM?hL]r|h\X varnishlog(1)r}…r~}r(hjvh(jyubaubaubjf)r€}r(hXvarnishhist(1)r‚h(j`hhEjjh}rƒ(h]h%]h ]h]h&]uhJNhKhhL]r„h‰)r…}r†(hj‚h(j€hhEhŒh}r‡(h]h%]h ]h]h&]uhJM@hL]rˆh\Xvarnishhist(1)r‰…rŠ}r‹(hj‚h(j…ubaubaubjf)rŒ}r(hXvarnishncsa(1)rŽh(j`hhEjjh}r(h]h%]h ]h]h&]uhJNhKhhL]rh‰)r‘}r’(hjŽh(jŒhhEhŒh}r“(h]h%]h ]h]h&]uhJMAhL]r”h\Xvarnishncsa(1)r•…r–}r—(hjŽh(j‘ubaubaubjf)r˜}r™(hXvarnishstat(1)ršh(j`hhEjjh}r›(h]h%]h ]h]h&]uhJNhKhhL]rœh‰)r}rž(hjšh(j˜hhEhŒh}rŸ(h]h%]h ]h]h&]uhJMBhL]r h\Xvarnishstat(1)r¡…r¢}r£(hjšh(jubaubaubjf)r¤}r¥(hX varnishtop(1)r¦h(j`hhEjjh}r§(h]h%]h ]h]h&]uhJNhKhhL]r¨h‰)r©}rª(hj¦h(j¤hhEhŒh}r«(h]h%]h ]h]h&]uhJMChL]r¬h\X varnishtop(1)r­…r®}r¯(hj¦h(j©ubaubaubjf)r°}r±(hXvcl(7) h(j`hhEjjh}r²(h]h%]h ]h]h&]uhJNhKhhL]r³h‰)r´}rµ(hXvcl(7)r¶h(j°hhEhŒh}r·(h]h%]h ]h]h&]uhJMDhL]r¸h\Xvcl(7)r¹…rº}r»(hj¶h(j´ubaubaubeubeubh3)r¼}r½(hUh(h8hhEhMh}r¾(h]h%]h ]h]r¿UhistoryrÀah&]rÁhauhJMGhKhhL]rÂ(hU)rÃ}rÄ(hXHISTORYrÅh(j¼hhEhYh}rÆ(h]h%]h ]h]h&]uhJMGhKhhL]rÇh\XHISTORYrÈ…rÉ}rÊ(hjÅh(jÃubaubh‰)rË}rÌ(hX…The varnishd daemon was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS, Varnish Software AS and Varnish Software.rÍh(j¼hhEhŒh}rÎ(h]h%]h ]h]h&]uhJMIhKhhL]rÏh\X…The varnishd daemon was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS, Varnish Software AS and Varnish Software.rÐ…rÑ}rÒ(hjÍh(jËubaubh‰)rÓ}rÔ(hXpThis manual page was written by Dag-Erling Smørgrav with updates by Stig Sandbeck Mathisen ⟨ssm@debian.org⟩h(j¼hhEhŒh}rÕ(h]h%]h ]h]h&]uhJMLhKhhL]rÖ(h\X_This manual page was written by Dag-Erling Smørgrav with updates by Stig Sandbeck Mathisen ⟨r×…rØ}rÙ(hX_This manual page was written by Dag-Erling Smørgrav with updates by Stig Sandbeck Mathisen ⟨h(jÓubcdocutils.nodes reference rÚ)rÛ}rÜ(hXssm@debian.orgh}rÝ(UrefuriXmailto:ssm@debian.orgh]h ]h]h%]h&]uh(jÓhL]rÞh\Xssm@debian.orgrß…rà}rá(hUh(jÛubahEU referencerâubh\X⟩…rã}rä(hX⟩h(jÓubeubeubh3)rå}ræ(hUh(h8hhEhMh}rç(h]h%]h ]h]rèU copyrightréah&]rêh auhJMQhKhhL]rë(hU)rì}rí(hX COPYRIGHTrîh(jåhhEhYh}rï(h]h%]h ]h]h&]uhJMQhKhhL]rðh\X COPYRIGHTrñ…rò}ró(hjîh(jìubaubh‰)rô}rõ(hX\This document is licensed under the same licence as Varnish itself. See LICENCE for details.röh(jåhhEhŒh}r÷(h]h%]h ]h]h&]uhJMShKhhL]røh\X\This document is licensed under the same licence as Varnish itself. See LICENCE for details.rù…rú}rû(hjöh(jôubaubj_)rü}rý(hUh(jåhhEjbh}rþ(jdX*h]h ]h]h%]h&]uhJMVhKhhL]rÿjf)r}r(hX+Copyright (c) 2007-2011 Varnish Software ASrh(jühhEjjh}r(h]h%]h ]h]h&]uhJNhKhhL]rh‰)r}r(hjh(jhhEhŒh}r(h]h%]h ]h]h&]uhJMVhL]rh\X+Copyright (c) 2007-2011 Varnish Software ASr …r }r (hjh(jubaubaubaubeubeubhhEhMh}r (h]h%]h ]h]r Uoptionsrah&]rhauhJK#hKhhL]r(hU)r}r(hXOPTIONSrh(h6hhEhYh}r(h]h%]h ]h]h&]uhJK#hKhhL]rh\XOPTIONSr…r}r(hjh(jubaubh0)r}r(hUh(h6hhEjh}r(h]h%]h ]h]h&]uhJNhKhhL]r(h-)r}r(hX-a address[:port][,address[:port][...] 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, the default HTTP port as listed in /etc/services is used. Multiple listening addresses and ports can be speci†fied as a whitespace- or comma-separated list. h(jhhEjh}r(h]h%]h ]h]h&]uhJK+hL]r (j")r!}r"(hX&-a address[:port][,address[:port][...]r#h(jhhEj&h}r$(h]h%]h ]h]h&]uhJK+hL]r%h\X&-a address[:port][,address[:port][...]r&…r'}r((hj#h(j!ubaubh))r)}r*(hUh}r+(h]h%]h ]h]h&]uh(jhL]r,h‰)r-}r.(hXï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, the default HTTP port as listed in /etc/services is used. Multiple listening addresses and ports can be speci†fied as a whitespace- or comma-separated list.r/h(j)hhEhŒh}r0(h]h%]h ]h]h&]uhJK&hL]r1h\Xï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, the default HTTP port as listed in /etc/services is used. Multiple listening addresses and ports can be speci†fied as a whitespace- or comma-separated list.r2…r3}r4(hj/h(j-ubaubahEj8ubeubh-)r5}r6(hXi-b host[:port] Use the specified host as backend server. If port is not specified, the default is 8080. h(jhhEjh}r7(h]h%]h ]h]h&]uhJK/hKhhL]r8(j")r9}r:(hX-b host[:port]r;h(j5hhEj&h}r<(h]h%]h ]h]h&]uhJK/hL]r=h\X-b host[:port]r>…r?}r@(hj;h(j9ubaubh))rA}rB(hUh}rC(h]h%]h ]h]h&]uh(j5hL]rDh‰)rE}rF(hXYUse the specified host as backend server. If port is not specified, the default is 8080.rGh(jAhhEhŒh}rH(h]h%]h ]h]h&]uhJK.hL]rIh\XYUse the specified host as backend server. If port is not specified, the default is 8080.rJ…rK}rL(hjGh(jEubaubahEj8ubeubeubcdocutils.nodes option_list rM)rN}rO(hUh(h6hhEU option_listrPh}rQ(h]h%]h ]h]h&]uhJNhKhhL]rR(cdocutils.nodes option_list_item rS)rT}rU(hUh(jNhhEUoption_list_itemrVh}rW(h]h%]h ]h]h&]uhJNhKhhL]rX(cdocutils.nodes option_group rY)rZ}r[(hUh}r\(h]h%]h ]h]h&]uh(jThL]r]cdocutils.nodes option r^)r_}r`(hX-Crah}rb(h]h%]h ]h]h&]uh(jZhL]rccdocutils.nodes option_string rd)re}rf(hjah}rg(h]h%]h ]h]h&]uh(j_hL]rhh\X-Cri…rj}rk(hUh(jeubahEU option_stringrlubahEUoptionrmubahEU option_grouprnubcdocutils.nodes description ro)rp}rq(hXdPrint VCL code compiled to C language and exit. Specify the VCL file to compile with the -f option. h}rr(h]h%]h ]h]h&]uh(jThL]rsh‰)rt}ru(hXcPrint VCL code compiled to C language and exit. Specify the VCL file to compile with the -f option.rvh(jphhEhŒh}rw(h]h%]h ]h]h&]uhJK1hL]rxh\XcPrint VCL code compiled to C language and exit. Specify the VCL file to compile with the -f option.ry…rz}r{(hjvh(jtubaubahEU descriptionr|ubeubjS)r}}r~(hUh(jNhhEjVh}r(h]h%]h ]h]h&]uhJNhKhhL]r€(jY)r}r‚(hUh}rƒ(h]h%]h ]h]h&]uh(j}hL]r„j^)r…}r†(hX-dr‡h}rˆ(h]h%]h ]h]h&]uh(jhL]r‰jd)rŠ}r‹(hj‡h}rŒ(h]h%]h ]h]h&]uh(j…hL]rh\X-drŽ…r}r(hUh(jŠubahEjlubahEjmubahEjnubjo)r‘}r’(hXì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. h}r“(h]h%]h ]h]h&]uh(j}hL]r”h‰)r•}r–(hXë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.r—h(j‘hhEhŒh}r˜(h]h%]h ]h]h&]uhJK4hL]r™h\Xë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.rš…r›}rœ(hj—h(j•ubaubahEj|ubeubjS)r}rž(hUh(jNhhEjVh}rŸ(h]h%]h ]h]h&]uhJNhKhhL]r (jY)r¡}r¢(hUh}r£(h]h%]h ]h]h&]uh(jhL]r¤j^)r¥}r¦(hX-Fr§h}r¨(h]h%]h ]h]h&]uh(j¡hL]r©jd)rª}r«(hj§h}r¬(h]h%]h ]h]h&]uh(j¥hL]r­h\X-Fr®…r¯}r°(hUh(jªubahEjlubahEjmubahEjnubjo)r±}r²(hXRun in the foreground. h}r³(h]h%]h ]h]h&]uh(jhL]r´h‰)rµ}r¶(hXRun in the foreground.r·h(j±hhEhŒh}r¸(h]h%]h ]h]h&]uhJK8hL]r¹h\XRun in the foreground.rº…r»}r¼(hj·h(jµubaubahEj|ubeubjS)r½}r¾(hUh(jNhhEjVh}r¿(h]h%]h ]h]h&]uhJNhKhhL]rÀ(jY)rÁ}rÂ(hUh}rÃ(h]h%]h ]h]h&]uh(j½hL]rÄj^)rÅ}rÆ(hX -f configh}rÇ(h]h%]h ]h]h&]uh(jÁhL]rÈ(jd)rÉ}rÊ(hX-fh}rË(h]h%]h ]h]h&]uh(jÅhL]rÌh\X-frÍ…rÎ}rÏ(hUh(jÉubahEjlubcdocutils.nodes option_argument rÐ)rÑ}rÒ(hXconfigh}rÓ(h]h ]h]U delimiterU h%]h&]uh(jÅhL]rÔh\XconfigrÕ…rÖ}r×(hUh(jÑubahEUoption_argumentrØubehEjmubahEjnubjo)rÙ}rÚ(hX½Use the specified VCL configuration file instead of the builtin default. See vcl(7) for details on VCL syntax. When no configuration is supplied varnishd will not start the cache process. h}rÛ(h]h%]h ]h]h&]uh(j½hL]rÜh‰)rÝ}rÞ(hX¼Use the specified VCL configuration file instead of the builtin default. See vcl(7) for details on VCL syntax. When no configuration is supplied varnishd will not start the cache process.rßh(jÙhhEhŒh}rà(h]h%]h ]h]h&]uhJK:hL]ráh\X¼Use the specified VCL configuration file instead of the builtin default. See vcl(7) for details on VCL syntax. When no configuration is supplied varnishd will not start the cache process.râ…rã}rä(hjßh(jÝubaubahEj|ubeubjS)rå}ræ(hUh(jNhhEjVh}rç(h]h%]h ]h]h&]uhJNhKhhL]rè(jY)ré}rê(hUh}rë(h]h%]h ]h]h&]uh(jåhL]rìj^)rí}rî(hX-g grouph}rï(h]h%]h ]h]h&]uh(jéhL]rð(jd)rñ}rò(hX-gh}ró(h]h%]h ]h]h&]uh(jíhL]rôh\X-grõ…rö}r÷(hUh(jñubahEjlubjÐ)rø}rù(hXgrouph}rú(h]h ]h]U delimiterU h%]h&]uh(jíhL]rûh\Xgrouprü…rý}rþ(hUh(jøubahEjØubehEjmubahEjnubjo)rÿ}r(hX¾Specifies the name of an unprivileged group to which the child process should switch before it starts accepting connections. This is a shortcut for specifying the group run-time parameter. h}r(h]h%]h ]h]h&]uh(jåhL]rh‰)r}r(hX½Specifies the name of an unprivileged group to which the child process should switch before it starts accepting connections. This is a shortcut for specifying the group run-time parameter.rh(jÿhhEhŒh}r(h]h%]h ]h]h&]uhJK?hL]rh\X½Specifies the name of an unprivileged group to which the child process should switch before it starts accepting connections. This is a shortcut for specifying the group run-time parameter.r…r }r (hjh(jubaubahEj|ubeubeubh0)r }r (hUh(h6hhEjh}r (h]h%]h ]h]h&]uhJNhKhhL]rh-)r}r(hXi-h type[,options] Specifies the hash algorithm. See Hash Algorithms for a list of supported algorithms. h(j hhEjh}r(h]h%]h ]h]h&]uhJKDhL]r(j")r}r(hX-h type[,options]rh(jhhEj&h}r(h]h%]h ]h]h&]uhJKDhL]rh\X-h type[,options]r…r}r(hjh(jubaubh))r}r(hUh}r(h]h%]h ]h]h&]uh(jhL]rh‰)r}r (hXVSpecifies the hash algorithm. See Hash Algorithms for a list of supported algorithms.r!h(jhhEhŒh}r"(h]h%]h ]h]h&]uhJKDhL]r#h\XVSpecifies the hash algorithm. See Hash Algorithms for a list of supported algorithms.r$…r%}r&(hj!h(jubaubahEj8ubeubaubjM)r'}r((hUh(h6hhEjPh}r)(h]h%]h ]h]h&]uhJNhKhhL]r*(jS)r+}r,(hUh(j'hhEjVh}r-(h]h%]h ]h]h&]uhJNhKhhL]r.(jY)r/}r0(hUh}r1(h]h%]h ]h]h&]uh(j+hL]r2j^)r3}r4(hX -i identityr5h}r6(h]h%]h ]h]h&]uh(j/hL]r7(jd)r8}r9(hX-ih}r:(h]h%]h ]h]h&]uh(j3hL]r;h\X-ir<…r=}r>(hUh(j8ubahEjlubjÐ)r?}r@(hXidentityh}rA(h]h ]h]U delimiterU h%]h&]uh(j3hL]rBh\XidentityrC…rD}rE(hUh(j?ubahEjØubehEjmubahEjnubjo)rF}rG(hXaSpecify the identity of the varnish server. This can be accessed using server.identity from VCL h}rH(h]h%]h ]h]h&]uh(j+hL]rIh‰)rJ}rK(hX`Specify the identity of the varnish server. This can be accessed using server.identity from VCLrLh(jFhhEhŒh}rM(h]h%]h ]h]h&]uhJKGhL]rNh\X`Specify the identity of the varnish server. This can be accessed using server.identity from VCLrO…rP}rQ(hjLh(jJubaubahEj|ubeubjS)rR}rS(hUh(j'hhEjVh}rT(h]h%]h ]h]h&]uhJNhKhhL]rU(jY)rV}rW(hUh}rX(h]h%]h ]h]h&]uh(jRhL]rYj^)rZ}r[(hX -l shmlogsizer\h}r](h]h%]h ]h]h&]uh(jVhL]r^(jd)r_}r`(hX-lh}ra(h]h%]h ]h]h&]uh(jZhL]rbh\X-lrc…rd}re(hUh(j_ubahEjlubjÐ)rf}rg(hX shmlogsizeh}rh(h]h ]h]U delimiterU h%]h&]uh(jZhL]rih\X shmlogsizerj…rk}rl(hUh(jfubahEjØubehEjmubahEjnubjo)rm}rn(hX¢Specify size of shmlog file. Scaling suffixes like 'k', 'm' can be used up to (e)tabytes. Default is 80 Megabytes. Specifying less than 8 Megabytes is unwise. h}ro(h]h%]h ]h]h&]uh(jRhL]rph‰)rq}rr(hX¡Specify size of shmlog file. Scaling suffixes like 'k', 'm' can be used up to (e)tabytes. Default is 80 Megabytes. Specifying less than 8 Megabytes is unwise.rsh(jmhhEhŒh}rt(h]h%]h ]h]h&]uhJKKhL]ruh\X¡Specify size of shmlog file. Scaling suffixes like 'k', 'm' can be used up to (e)tabytes. Default is 80 Megabytes. Specifying less than 8 Megabytes is unwise.rv…rw}rx(hjsh(jqubaubahEj|ubeubjS)ry}rz(hUh(j'hhEjVh}r{(h]h%]h ]h]h&]uhJNhKhhL]r|(jY)r}}r~(hUh}r(h]h%]h ]h]h&]uh(jyhL]r€j^)r}r‚(hX-n nameh}rƒ(h]h%]h ]h]h&]uh(j}hL]r„(jd)r…}r†(hX-nh}r‡(h]h%]h ]h]h&]uh(jhL]rˆh\X-nr‰…rŠ}r‹(hUh(j…ubahEjlubjÐ)rŒ}r(hXnameh}rŽ(h]h ]h]U delimiterU h%]h&]uh(jhL]rh\Xnamer…r‘}r’(hUh(jŒubahEjØubehEjmubahEjnubjo)r“}r”(hXASpecify a name for this instance. Amonst 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. h}r•(h]h%]h ]h]h&]uh(jyhL]r–h‰)r—}r˜(hX@Specify a name for this instance. Amonst 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.r™h(j“hhEhŒh}rš(h]h%]h ]h]h&]uhJKNhL]r›h\X@Specify a name for this instance. Amonst 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.rœ…r}rž(hj™h(j—ubaubahEj|ubeubjS)rŸ}r (hUh(j'hhEjVh}r¡(h]h%]h ]h]h&]uhJNhKhhL]r¢(jY)r£}r¤(hUh}r¥(h]h%]h ]h]h&]uh(jŸhL]r¦j^)r§}r¨(hX-P fileh}r©(h]h%]h ]h]h&]uh(j£hL]rª(jd)r«}r¬(hX-Ph}r­(h]h%]h ]h]h&]uh(j§hL]r®h\X-Pr¯…r°}r±(hUh(j«ubahEjlubjÐ)r²}r³(hXfileh}r´(h]h ]h]U delimiterU h%]h&]uh(j§hL]rµh\Xfiler¶…r·}r¸(hUh(j²ubahEjØubehEjmubahEjnubjo)r¹}rº(hX/Write the process's PID to the specified file. h}r»(h]h%]h ]h]h&]uh(jŸhL]r¼h‰)r½}r¾(hX.Write the process's PID to the specified file.r¿h(j¹hhEhŒh}rÀ(h]h%]h ]h]h&]uhJKShL]rÁh\X.Write the process's PID to the specified file.rÂ…rÃ}rÄ(hj¿h(j½ubaubahEj|ubeubeubh0)rÅ}rÆ(hUh(h6hhEjh}rÇ(h]h%]h ]h]h&]uhJNhKhhL]rÈh-)rÉ}rÊ(hXÆ-p param=value Set the parameter specified by param to the specified value. See Run-Time Parameters for a list of parameters. This option can be used multiple times to specify multiple parameters. h(jÅhhEjh}rË(h]h%]h ]h]h&]uhJKXhL]rÌ(j")rÍ}rÎ(hX-p param=valuerÏh(jÉhhEj&h}rÐ(h]h%]h ]h]h&]uhJKXhL]rÑh\X-p param=valuerÒ…rÓ}rÔ(hjÏh(jÍubaubh))rÕ}rÖ(hUh}r×(h]h%]h ]h]h&]uh(jÉhL]rØh‰)rÙ}rÚ(hX¶Set the parameter specified by param to the specified value. See Run-Time Parameters for a list of parameters. This option can be used multiple times to specify multiple parameters.rÛh(jÕhhEhŒh}rÜ(h]h%]h ]h]h&]uhJKVhL]rÝh\X¶Set the parameter specified by param to the specified value. See Run-Time Parameters for a list of parameters. This option can be used multiple times to specify multiple parameters.rÞ…rß}rà(hjÛh(jÙubaubahEj8ubeubaubjM)rá}râ(hUh(h6hhEjPh}rã(h]h%]h ]h]h&]uhJNhKhhL]räjS)rå}ræ(hUh(jáhhEjVh}rç(h]h%]h ]h]h&]uhJNhKhhL]rè(jY)ré}rê(hUh}rë(h]h%]h ]h]h&]uh(jåhL]rìj^)rí}rî(hX-S fileh}rï(h]h%]h ]h]h&]uh(jéhL]rð(jd)rñ}rò(hX-Sh}ró(h]h%]h ]h]h&]uh(jíhL]rôh\X-Srõ…rö}r÷(hUh(jñubahEjlubjÐ)rø}rù(hXfileh}rú(h]h ]h]U delimiterU h%]h&]uh(jíhL]rûh\Xfilerü…rý}rþ(hUh(jøubahEjØubehEjmubahEjnubjo)rÿ}r(hXWPath to a file containing a secret used for authorizing access to the management port. h}r(h]h%]h ]h]h&]uh(jåhL]rh‰)r}r(hXVPath to a file containing a secret used for authorizing access to the management port.rh(jÿhhEhŒh}r(h]h%]h ]h]h&]uhJKZhL]rh\XVPath to a file containing a secret used for authorizing access to the management port.r…r }r (hjh(jubaubahEj|ubeubaubh0)r }r (hUh(h6hhEjh}r (h]h%]h ]h]h&]uhJNhKhhL]r(h-)r}r(hX=-s [name=]type[,options] Use the specified storage backend. See Storage Types for a list of supported storage types. This option can be used multiple times to specify multiple storage files. You can name the different backends. Varnish will then reference that backend with the given name in logs, statistics, etc. h(j hhEjh}r(h]h%]h ]h]h&]uhJK`hL]r(j")r}r(hX-s [name=]type[,options]rh(jhhEj&h}r(h]h%]h ]h]h&]uhJK`hL]rh\X-s [name=]type[,options]r…r}r(hjh(jubaubh))r}r(hUh}r(h]h%]h ]h]h&]uh(jhL]rh‰)r}r (hX#Use the specified storage backend. See Storage Types for a list of supported storage types. This option can be used multiple times to specify multiple storage files. You can name the different backends. Varnish will then reference that backend with the given name in logs, statistics, etc.r!h(jhhEhŒh}r"(h]h%]h ]h]h&]uhJK]hL]r#h\X#Use the specified storage backend. See Storage Types for a list of supported storage types. This option can be used multiple times to specify multiple storage files. You can name the different backends. Varnish will then reference that backend with the given name in logs, statistics, etc.r$…r%}r&(hj!h(jubaubahEj8ubeubh-)r'}r((hX-T address[:port] Offer a management interface on the specified address and port. See Management Interface for a list of management commands. h(j hhEjh}r)(h]h%]h ]h]h&]uhJKdhKhhL]r*(j")r+}r,(hX-T address[:port]r-h(j'hhEj&h}r.(h]h%]h ]h]h&]uhJKdhL]r/h\X-T address[:port]r0…r1}r2(hj-h(j+ubaubh))r3}r4(hUh}r5(h]h%]h ]h]h&]uh(j'hL]r6h‰)r7}r8(hX|Offer a management interface on the specified address and port. See Management Interface for a list of management commands.r9h(j3hhEhŒh}r:(h]h%]h ]h]h&]uhJKchL]r;h\X|Offer a management interface on the specified address and port. See Management Interface for a list of management commands.r<…r=}r>(hj9h(j7ubaubahEj8ubeubh-)r?}r@(hXØ-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. h(j hhEjh}rA(h]h%]h ]h]h&]uhJKjhKhhL]rB(j")rC}rD(hX-M address:portrEh(j?hhEj&h}rF(h]h%]h ]h]h&]uhJKjhL]rGh\X-M address:portrH…rI}rJ(hjEh(jCubaubh))rK}rL(hUh}rM(h]h%]h ]h]h&]uh(j?hL]rNh‰)rO}rP(hXÇ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.rQh(jKhhEhŒh}rR(h]h%]h ]h]h&]uhJKghL]rSh\XÇ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.rT…rU}rV(hjQh(jOubaubahEj8ubeubeubjM)rW}rX(hUh(h6hhEjPh}rY(h]h%]h ]h]h&]uhJNhKhhL]rZ(jS)r[}r\(hUh(jWhhEjVh}r](h]h%]h ]h]h&]uhJNhKhhL]r^(jY)r_}r`(hUh}ra(h]h%]h ]h]h&]uh(j[hL]rbj^)rc}rd(hX-t ttlreh}rf(h]h%]h ]h]h&]uh(j_hL]rg(jd)rh}ri(hX-th}rj(h]h%]h ]h]h&]uh(jchL]rkh\X-trl…rm}rn(hUh(jhubahEjlubjÐ)ro}rp(hXttlh}rq(h]h ]h]U delimiterU h%]h&]uh(jchL]rrh\Xttlrs…rt}ru(hUh(joubahEjØubehEjmubahEjnubjo)rv}rw(hXƒSpecifies a hard minimum time to live for cached documents. This is a shortcut for specifying the default_ttl run-time parameter. h}rx(h]h%]h ]h]h&]uh(j[hL]ryh‰)rz}r{(hX‚Specifies a hard minimum time to live for cached documents. This is a shortcut for specifying the default_ttl run-time parameter.r|h(jvhhEhŒh}r}(h]h%]h ]h]h&]uhJKmhL]r~h\X‚Specifies a hard minimum time to live for cached documents. This is a shortcut for specifying the default_ttl run-time parameter.r…r€}r(hj|h(jzubaubahEj|ubeubjS)r‚}rƒ(hUh(jWhhEjVh}r„(h]h%]h ]h]h&]uhJNhKhhL]r…(jY)r†}r‡(hUh}rˆ(h]h%]h ]h]h&]uh(j‚hL]r‰j^)rŠ}r‹(hX-u userh}rŒ(h]h%]h ]h]h&]uh(j†hL]r(jd)rŽ}r(hX-uh}r(h]h%]h ]h]h&]uh(jŠhL]r‘h\X-ur’…r“}r”(hUh(jŽubahEjlubjÐ)r•}r–(hXuserh}r—(h]h ]h]U delimiterU h%]h&]uh(jŠhL]r˜h\Xuserr™…rš}r›(hUh(j•ubahEjØubehEjmubahEjnubjo)rœ}r(hX Specifies the name of an unprivileged user to which the child process should switch before it starts accepting connections. This is a shortcut for specifying the user run- time parameter. If specifying both a user and a group, the user should be specified first. h}rž(h]h%]h ]h]h&]uh(j‚hL]rŸ(h‰)r }r¡(hX¼Specifies the name of an unprivileged user to which the child process should switch before it starts accepting connections. This is a shortcut for specifying the user run- time parameter.r¢h(jœhhEhŒh}r£(h]h%]h ]h]h&]uhJKqhL]r¤h\X¼Specifies the name of an unprivileged user to which the child process should switch before it starts accepting connections. This is a shortcut for specifying the user run- time parameter.r¥…r¦}r§(hj¢h(j ubaubh‰)r¨}r©(hXJIf specifying both a user and a group, the user should be specified first.rªh(jœhhEhŒh}r«(h]h%]h ]h]h&]uhJKvhL]r¬h\XJIf specifying both a user and a group, the user should be specified first.r­…r®}r¯(hjªh(j¨ubaubehEj|ubeubjS)r°}r±(hUh(jWhhEjVh}r²(h]h%]h ]h]h&]uhJNhKhhL]r³(jY)r´}rµ(hUh}r¶(h]h%]h ]h]h&]uh(j°hL]r·j^)r¸}r¹(hX-Vrºh}r»(h]h%]h ]h]h&]uh(j´hL]r¼jd)r½}r¾(hjºh}r¿(h]h%]h ]h]h&]uh(j¸hL]rÀh\X-VrÁ…rÂ}rÃ(hUh(j½ubahEjlubahEjmubahEjnubjo)rÄ}rÅ(hX%Display the version number and exit. h}rÆ(h]h%]h ]h]h&]uh(j°hL]rÇh‰)rÈ}rÉ(hX$Display the version number and exit.rÊh(jÄhhEhŒh}rË(h]h%]h ]h]h&]uhJKyhL]rÌh\X$Display the version number and exit.rÍ…rÎ}rÏ(hjÊh(jÈubaubahEj|ubeubeubh‰)rÐ}rÑ(hX-w min[,max[,timeout]]rÒh(h6hhEhŒh}rÓ(h]h%]h ]h]h&]uhJK{hKhhL]rÔh\X-w min[,max[,timeout]]rÕ…rÖ}r×(hjÒh(jÐubaubcdocutils.nodes block_quote rØ)rÙ}rÚ(hUh(h6hhEU block_quoterÛh}rÜ(h]h%]h ]h]h&]uhJNhKhhL]rÝ(h‰)rÞ}rß(hXÌStart at least min but no more than max worker threads with the specified idle timeout. This is a shortcut for specifying the thread_pool_min, thread_pool_max and thread_pool_timeout run-time parameters.ràh(jÙhhEhŒh}rá(h]h%]h ]h]h&]uhJK}hL]râh\XÌStart at least min but no more than max worker threads with the specified idle timeout. This is a shortcut for specifying the thread_pool_min, thread_pool_max and thread_pool_timeout run-time parameters.rã…rä}rå(hjàh(jÞubaubh‰)ræ}rç(hXˆIf only one number is specified, thread_pool_min and thread_pool_max are both set to this number, and thread_pool_timeout has no effect.rèh(jÙhhEhŒh}ré(h]h%]h ]h]h&]uhJK‚hL]rêh\XˆIf only one number is specified, thread_pool_min and thread_pool_max are both set to this number, and thread_pool_timeout has no effect.rë…rì}rí(hjèh(jæubaubeubh3)rî}rï(hUh(h6hhEhMh}rð(h]h%]h ]h]rñUhash-algorithmsròah&]róh auhJK‹hKhhL]rô(hU)rõ}rö(hXHash Algorithmsr÷h(jîhhEhYh}rø(h]h%]h ]h]h&]uhJK‹hKhhL]rùh\XHash Algorithmsrú…rû}rü(hj÷h(jõubaubh‰)rý}rþ(hX,The following hash algorithms are available:rÿh(jîhhEhŒh}r(h]h%]h ]h]h&]uhJKhKhhL]rh\X,The following hash algorithms are available:r…r}r(hjÿh(jýubaubh0)r}r(hUh(jîhhEjh}r(h]h%]h ]h]h&]uhJNhKhhL]r(h-)r }r (hXNsimple_list A simple doubly-linked list. Not recommended for production use. h(jhhEjh}r (h]h%]h ]h]h&]uhJKhL]r (j")r }r(hX simple_listrh(j hhEj&h}r(h]h%]h ]h]h&]uhJKhL]rh\X simple_listr…r}r(hjh(j ubaubh))r}r(hUh}r(h]h%]h ]h]h&]uh(j hL]rh‰)r}r(hXAA simple doubly-linked list. Not recommended for production use.rh(jhhEhŒh}r(h]h%]h ]h]h&]uhJKhL]rh\XAA simple doubly-linked list. Not recommended for production use.r…r}r (hjh(jubaubahEj8ubeubh-)r!}r"(hX?classic[,buckets] A standard hash table. This is the default. 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. h(jhhEjh}r#(h]h%]h ]h]h&]uhJK—hKhhL]r$(j")r%}r&(hXclassic[,buckets]r'h(j!hhEj&h}r((h]h%]h ]h]h&]uhJK—hL]r)h\Xclassic[,buckets]r*…r+}r,(hj'h(j%ubaubh))r-}r.(hUh}r/(h]h%]h ]h]h&]uh(j!hL]r0h‰)r1}r2(hX,A standard hash table. This is the default. 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.r3h(j-hhEhŒh}r4(h]h%]h ]h]h&]uhJK“hL]r5h\X,A standard hash table. This is the default. 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.r6…r7}r8(hj3h(j1ubaubahEj8ubeubh-)r9}r:(hX¥critbit A self-scaling tree structure. The default hash algorithm in 2.1. In comparison to a more traditional B tree the critbit tree is almost completely lockless. h(jhhEjh}r;(h]h%]h ]h]h&]uhJKœhKhhL]r<(j")r=}r>(hXcritbitr?h(j9hhEj&h}r@(h]h%]h ]h]h&]uhJKœhL]rAh\XcritbitrB…rC}rD(hj?h(j=ubaubh))rE}rF(hUh}rG(h]h%]h ]h]h&]uh(j9hL]rHh‰)rI}rJ(hXœA self-scaling tree structure. The default hash algorithm in 2.1. In comparison to a more traditional B tree the critbit tree is almost completely lockless.rKh(jEhhEhŒh}rL(h]h%]h ]h]h&]uhJKšhL]rMh\XœA self-scaling tree structure. The default hash algorithm in 2.1. In comparison to a more traditional B tree the critbit tree is almost completely lockless.rN…rO}rP(hjKh(jIubaubahEj8ubeubeubeubh3)rQ}rR(hUh(h6hhEhMh}rS(h]h%]h ]h]rTU storage-typesrUah&]rVhauhJKŸhKhhL]rW(hU)rX}rY(hX Storage TypesrZh(jQhhEhYh}r[(h]h%]h ]h]h&]uhJKŸhKhhL]r\h\X Storage Typesr]…r^}r_(hjZh(jXubaubh‰)r`}ra(hX*The following storage types are available:rbh(jQhhEhŒh}rc(h]h%]h ]h]h&]uhJK¡hKhhL]rdh\X*The following storage types are available:re…rf}rg(hjbh(j`ubaubh‰)rh}ri(hX malloc[,size]rjh(jQhhEhŒh}rk(h]h%]h ]h]h&]uhJK£hKhhL]rlh\X malloc[,size]rm…rn}ro(hjjh(jhubaubjØ)rp}rq(hUh(jQhhEjÛh}rr(h]h%]h ]h]h&]uhJNhKhhL]rs(h‰)rt}ru(hXMalloc 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 approximately 1k of memory per object will be used for various internal structures.rvh(jphhEhŒh}rw(h]h%]h ]h]h&]uhJK¥hL]rxh\XMalloc 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 approximately 1k of memory per object will be used for various internal structures.ry…rz}r{(hjvh(jtubaubh‰)r|}r}(hX¨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:r~h(jphhEhŒh}r(h]h%]h ]h]h&]uhJK«hL]r€h\X¨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:r…r‚}rƒ(hj~h(j|ubaubh‰)r„}r…(hX+K, k The size is expressed in kibibytes.r†h(jphhEhŒh}r‡(h]h%]h ]h]h&]uhJK¯hL]rˆh\X+K, k The size is expressed in kibibytes.r‰…rŠ}r‹(hj†h(j„ubaubh‰)rŒ}r(hX+M, m The size is expressed in mebibytes.rŽh(jphhEhŒh}r(h]h%]h ]h]h&]uhJK±hL]rh\X+M, m The size is expressed in mebibytes.r‘…r’}r“(hjŽh(jŒubaubh‰)r”}r•(hX+G, g The size is expressed in gibibytes.r–h(jphhEhŒh}r—(h]h%]h ]h]h&]uhJK³hL]r˜h\X+G, g The size is expressed in gibibytes.r™…rš}r›(hj–h(j”ubaubh‰)rœ}r(hX+T, t The size is expressed in tebibytes.ržh(jphhEhŒh}rŸ(h]h%]h ]h]h&]uhJKµhL]r h\X+T, t The size is expressed in tebibytes.r¡…r¢}r£(hjžh(jœubaubh‰)r¤}r¥(hXThe default size is unlimited.r¦h(jphhEhŒh}r§(h]h%]h ]h]h&]uhJK·hL]r¨h\XThe default size is unlimited.r©…rª}r«(hj¦h(j¤ubaubh‰)r¬}r­(hX@Mallocs performance is bound by memory speed so it is very fast.r®h(jphhEhŒh}r¯(h]h%]h ]h]h&]uhJK¹hL]r°h\X@Mallocs performance is bound by memory speed so it is very fast.r±…r²}r³(hj®h(j¬ubaubeubh‰)r´}rµ(hX file[,path[,size[,granularity]]]r¶h(jQhhEhŒh}r·(h]h%]h ]h]h&]uhJK»hKhhL]r¸h\X file[,path[,size[,granularity]]]r¹…rº}r»(hj¶h(j´ubaubjØ)r¼}r½(hUh(jQhhEjÛh}r¾(h]h%]h ]h]h&]uhJNhKhhL]r¿(h‰)rÀ}rÁ(hXÉThe file backend stores objects in memory backed by a file on disk with mmap. This is the default storage backend and unless you specify another storage this one will used along with Transient storage.rÂh(j¼hhEhŒh}rÃ(h]h%]h ]h]h&]uhJK½hL]rÄh\XÉThe file backend stores objects in memory backed by a file on disk with mmap. This is the default storage backend and unless you specify another storage this one will used along with Transient storage.rÅ…rÆ}rÇ(hjÂh(jÀubaubh‰)rÈ}rÉ(hX¡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.rÊh(j¼hhEhŒh}rË(h]h%]h ]h]h&]uhJKÂhL]rÌh\X¡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.rÍ…rÎ}rÏ(hjÊh(jÈubaubh‰)rÐ}rÑ(hX•The size parameter specifies the size of the backing file. The size is assumed to be in bytes, unless fol†lowed by one of the following suffixes:rÒh(j¼hhEhŒh}rÓ(h]h%]h ]h]h&]uhJKÆhL]rÔh\X•The size parameter specifies the size of the backing file. The size is assumed to be in bytes, unless fol†lowed by one of the following suffixes:rÕ…rÖ}r×(hjÒh(jÐubaubh‰)rØ}rÙ(hX+K, k The size is expressed in kibibytes.rÚh(j¼hhEhŒh}rÛ(h]h%]h ]h]h&]uhJKÊhL]rÜh\X+K, k The size is expressed in kibibytes.rÝ…rÞ}rß(hjÚh(jØubaubh‰)rà}rá(hX+M, m The size is expressed in mebibytes.râh(j¼hhEhŒh}rã(h]h%]h ]h]h&]uhJKÌhL]räh\X+M, m The size is expressed in mebibytes.rå…ræ}rç(hjâh(jàubaubh‰)rè}ré(hX+G, g The size is expressed in gibibytes.rêh(j¼hhEhŒh}rë(h]h%]h ]h]h&]uhJKÎhL]rìh\X+G, g The size is expressed in gibibytes.rí…rî}rï(hjêh(jèubaubh‰)rð}rñ(hX+T, t The size is expressed in tebibytes.ròh(j¼hhEhŒh}ró(h]h%]h ]h]h&]uhJKÐhL]rôh\X+T, t The size is expressed in tebibytes.rõ…rö}r÷(hjòh(jðubaubh0)rø}rù(hUh}rú(h]h%]h ]h]h&]uh(j¼hL]rûh-)rü}rý(hXe% The size is expressed as a percentage of the free space on the file system where it resides. h(jøhhEjh}rþ(h]h%]h ]h]h&]uhJKÓhL]rÿ(j")r}r(hXF% The size is expressed as a percentage of the free space on therh(jühhEj&h}r(h]h%]h ]h]h&]uhJKÓhL]rh\XF% The size is expressed as a percentage of the free space on ther…r}r(hjh(jubaubh))r}r (hUh}r (h]h%]h ]h]h&]uh(jühL]r h‰)r }r (hXfile system where it resides.rh(jhhEhŒh}r(h]h%]h ]h]h&]uhJKÓhL]rh\Xfile system where it resides.r…r}r(hjh(j ubaubahEj8ubeubahEjubh‰)r}r(hXThe default size is 50%.rh(j¼hhEhŒh}r(h]h%]h ]h]h&]uhJKÕhL]rh\XThe default size is 50%.r…r}r(hjh(jubaubh‰)r}r(hX[If the backing file already exists, it will be truncated or expanded to the specified size.rh(j¼hhEhŒh}r(h]h%]h ]h]h&]uhJK×hL]r h\X[If the backing file already exists, it will be truncated or expanded to the specified size.r!…r"}r#(hjh(jubaubh‰)r$}r%(hXö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. Pre-creating the storage file using dd(1) will reduce fragmentation to a minimum.r&h(j¼hhEhŒh}r'(h]h%]h ]h]h&]uhJKÚhL]r(h\Xö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. Pre-creating the storage file using dd(1) will reduce fragmentation to a minimum.r)…r*}r+(hj&h(j$ubaubh‰)r,}r-(hXÝThe granularity parameter specifies the granularity of allocation. All allocations are rounded up to this size. The size is assumed to be in bytes, unless followed by one of the suffixes described for size except for %.r.h(j¼hhEhŒh}r/(h]h%]h ]h]h&]uhJKßhL]r0h\XÝThe granularity parameter specifies the granularity of allocation. All allocations are rounded up to this size. The size is assumed to be in bytes, unless followed by one of the suffixes described for size except for %.r1…r2}r3(hj.h(j,ubaubh‰)r4}r5(hXaThe default size is the VM page size. The size should be reduced if you have many small objects.r6h(j¼hhEhŒh}r7(h]h%]h ]h]h&]uhJKähL]r8h\XaThe default size is the VM page size. The size should be reduced if you have many small objects.r9…r:}r;(hj6h(j4ubaubh‰)r<}r=(hXlFile performance is typically limited by the write speed of the device, and depending on use, the seek time.r>h(j¼hhEhŒh}r?(h]h%]h ]h]h&]uhJKçhL]r@h\XlFile performance is typically limited by the write speed of the device, and depending on use, the seek time.rA…rB}rC(hj>h(j<ubaubeubh‰)rD}rE(hX#persistent,path,size {experimental}rFh(jQhhEhŒh}rG(h]h%]h ]h]h&]uhJKêhKhhL]rHh\X#persistent,path,size {experimental}rI…rJ}rK(hjFh(jDubaubjØ)rL}rM(hUh(jQhhEjÛh}rN(h]h%]h ]h]h&]uhJNhKhhL]rO(h‰)rP}rQ(hX·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.h(jLhhEhŒh}rR(h]h%]h ]h]h&]uhJKìhL]rS(h\XfPersistent storage. Varnish will store objects in a file in a manner that will secure the survival of rT…rU}rV(hXfPersistent storage. Varnish will store objects in a file in a manner that will secure the survival of h(jPubcdocutils.nodes emphasis rW)rX}rY(hX*most*h}rZ(h]h%]h ]h]h&]uh(jPhL]r[h\Xmostr\…r]}r^(hUh(jXubahEUemphasisr_ubh\XK of the objects in the event of a planned or unplanned shutdown of Varnish.r`…ra}rb(hXK of the objects in the event of a planned or unplanned shutdown of Varnish.h(jPubeubh‰)rc}rd(hXlThe path parameter specifies the path to the backing file. If the file doesn't exist Varnish will create it.reh(jLhhEhŒh}rf(h]h%]h ]h]h&]uhJKðhL]rgh\XlThe path parameter specifies the path to the backing file. If the file doesn't exist Varnish will create it.rh…ri}rj(hjeh(jcubaubh‰)rk}rl(hX‘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:rmh(jLhhEhŒh}rn(h]h%]h ]h]h&]uhJKóhL]roh\X‘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:rp…rq}rr(hjmh(jkubaubh‰)rs}rt(hX+K, k The size is expressed in kibibytes.ruh(jLhhEhŒh}rv(h]h%]h ]h]h&]uhJK÷hL]rwh\X+K, k The size is expressed in kibibytes.rx…ry}rz(hjuh(jsubaubh‰)r{}r|(hX+M, m The size is expressed in mebibytes.r}h(jLhhEhŒh}r~(h]h%]h ]h]h&]uhJKùhL]rh\X+M, m The size is expressed in mebibytes.r€…r}r‚(hj}h(j{ubaubh‰)rƒ}r„(hX+G, g The size is expressed in gibibytes.r…h(jLhhEhŒh}r†(h]h%]h ]h]h&]uhJKûhL]r‡h\X+G, g The size is expressed in gibibytes.rˆ…r‰}rŠ(hj…h(jƒubaubh‰)r‹}rŒ(hX+T, t The size is expressed in tebibytes.rh(jLhhEhŒh}rŽ(h]h%]h ]h]h&]uhJKýhL]rh\X+T, t The size is expressed in tebibytes.r…r‘}r’(hjh(j‹ubaubh‰)r“}r”(hX 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.h(jLhhEhŒh}r•(h]h%]h ]h]h&]uhJKÿhL]r–(h\X)Varnish will split the file into logical r—…r˜}r™(hX)Varnish will split the file into logical h(j“ubjW)rš}r›(hX*silos*h}rœ(h]h%]h ]h]h&]uh(j“hL]rh\Xsilosrž…rŸ}r (hUh(jšubahEj_ubh\X‡ 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 r¡…r¢}r£(hX‡ 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 h(j“ubjW)r¤}r¥(hX*sealed*h}r¦(h]h%]h ]h]h&]uh(j“hL]r§h\Xsealedr¨…r©}rª(hUh(j¤ubahEj_ubh\Xa. When Varnish starts after a shutdown it will discard the content of any silo that isn't sealed.r«…r¬}r­(hXa. When Varnish starts after a shutdown it will discard the content of any silo that isn't sealed.h(j“ubeubeubeubh3)r®}r¯(hUh(h6hhEhMh}r°(h]h%]h ]h]r±Utransient-storager²ah&]r³hauhJMhKhhL]r´(hU)rµ}r¶(hXTransient Storager·h(j®hhEhYh}r¸(h]h%]h ]h]h&]uhJMhKhhL]r¹h\XTransient Storagerº…r»}r¼(hj·h(jµubaubjØ)r½}r¾(hUh(j®hhEjÛh}r¿(h]h%]h ]h]h&]uhJNhKhhL]rÀh‰)rÁ}rÂ(hX«If you name any of your storage backend "Transient" it will be used for transient (short lived) objects. By default Varnish would use an unlimited malloc backend for this.rÃh(j½hhEhŒh}rÄ(h]h%]h ]h]h&]uhJMhL]rÅh\X«If you name any of your storage backend "Transient" it will be used for transient (short lived) objects. By default Varnish would use an unlimited malloc backend for this.rÆ…rÇ}rÈ(hjÃh(jÁubaubaubeubh3)rÉ}rÊ(hUh(h6hhEhMh}rË(h]h%]h ]h]rÌUmanagement-interfacerÍah&]rÎhauhJM hKhhL]rÏ(hU)rÐ}rÑ(hXManagement InterfacerÒh(jÉhhEhYh}rÓ(h]h%]h ]h]h&]uhJM hKhhL]rÔh\XManagement InterfacerÕ…rÖ}r×(hjÒh(jÐubaubh‰)rØ}rÙ(hXà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).rÚh(jÉhhEhŒh}rÛ(h]h%]h ]h]h&]uhJMhKhhL]rÜh\Xà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).rÝ…rÞ}rß(hjÚh(jØubaubh‰)rà}rá(hX4The commands available are documented in varnish(7).râh(jÉhhEhŒh}rã(h]h%]h ]h]h&]uhJMhKhhL]räh\X4The commands available are documented in varnish(7).rå…ræ}rç(hjâh(jàubaubeubh4eubhhEhMh}rè(h]h%]h ]h]réUrun-time-parametersrêah&]rëh auhJMhKhhL]rì(hU)rí}rî(hXRun-Time Parametersrïh(h4hhEhYh}rð(h]h%]h ]h]h&]uhJMhKhhL]rñh\XRun-Time Parametersrò…ró}rô(hjïh(jíubaubh‰)rõ}rö(hX”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:r÷h(h4hhEhŒh}rø(h]h%]h ]h]h&]uhJMhKhhL]rùh\X”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:rú…rû}rü(hj÷h(jõubaubh0)rý}rþ(hUh(h4hhEjh}rÿ(h]h%]h ]h]h&]uhJNhKhhL]r(h-)r}r(hX™experimental We have no solid information about good/bad/optimal values for this parameter. Feedback with experience and observations are most welcome. h(jýhhEjh}r(h]h%]h ]h]h&]uhJM hL]r(j")r}r(hX experimentalrh(jhhEj&h}r(h]h%]h ]h]h&]uhJM hL]r h\X experimentalr …r }r (hjh(jubaubh))r }r(hUh}r(h]h%]h ]h]h&]uh(jhL]rh‰)r}r(hX‹We have no solid information about good/bad/optimal values for this parameter. Feedback with experience and observations are most welcome.rh(j hhEhŒh}r(h]h%]h ]h]h&]uhJMhL]rh\X‹We have no solid information about good/bad/optimal values for this parameter. Feedback with experience and observations are most welcome.r…r}r(hjh(jubaubahEj8ubeubh-)r}r(hXXdelayed This parameter can be changed on the fly, but will not take effect immediately. h(jýhhEjh}r(h]h%]h ]h]h&]uhJM$hKhhL]r(j")r}r(hXdelayedrh(jhhEj&h}r (h]h%]h ]h]h&]uhJM$hL]r!h\Xdelayedr"…r#}r$(hjh(jubaubh))r%}r&(hUh}r'(h]h%]h ]h]h&]uh(jhL]r(h‰)r)}r*(hXOThis parameter can be changed on the fly, but will not take effect immediately.r+h(j%hhEhŒh}r,(h]h%]h ]h]h&]uhJM#hL]r-h\XOThis parameter can be changed on the fly, but will not take effect immediately.r.…r/}r0(hj+h(j)ubaubahEj8ubeubh-)r1}r2(hX^restart The worker process must be stopped and restarted, before this parameter takes effect. h(jýhhEjh}r3(h]h%]h ]h]h&]uhJM(hKhhL]r4(j")r5}r6(hXrestartr7h(j1hhEj&h}r8(h]h%]h ]h]h&]uhJM(hL]r9h\Xrestartr:…r;}r<(hj7h(j5ubaubh))r=}r>(hUh}r?(h]h%]h ]h]h&]uh(j1hL]r@h‰)rA}rB(hXUThe worker process must be stopped and restarted, before this parameter takes effect.rCh(j=hhEhŒh}rD(h]h%]h ]h]h&]uhJM'hL]rEh\XUThe worker process must be stopped and restarted, before this parameter takes effect.rF…rG}rH(hjCh(jAubaubahEj8ubeubh-)rI}rJ(hXLreload The VCL programs must be reloaded for this parameter to take effect. h(jýhhEjh}rK(h]h%]h ]h]h&]uhJM+hKhhL]rL(j")rM}rN(hXreloadrOh(jIhhEj&h}rP(h]h%]h ]h]h&]uhJM+hL]rQh\XreloadrR…rS}rT(hjOh(jMubaubh))rU}rV(hUh}rW(h]h%]h ]h]h&]uh(jIhL]rXh‰)rY}rZ(hXDThe VCL programs must be reloaded for this parameter to take effect.r[h(jUhhEhŒh}r\(h]h%]h ]h]h&]uhJM+hL]r]h\XDThe VCL programs must be reloaded for this parameter to take effect.r^…r_}r`(hj[h(jYubaubahEj8ubeubeubh‰)ra}rb(hX:Here is a list of all parameters, current as of last time we remembered to update the manual page. This text is produced from the same text you will find in the CLI if you use the param.show command, so should there be a new parameter which is not listed here, you can find the description using the CLI commands.rch(h4hhEhŒh}rd(h]h%]h ]h]h&]uhJM-hKhhL]reh\X:Here is a list of all parameters, current as of last time we remembered to update the manual page. This text is produced from the same text you will find in the CLI if you use the param.show command, so should there be a new parameter which is not listed here, you can find the description using the CLI commands.rf…rg}rh(hjch(jaubaubh‰)ri}rj(hX'Be aware that on 32 bit systems, certain default values, such as workspace_client (=16k), thread_pool_workspace (=16k), http_resp_size (=8k), http_req_size (=12k), gzip_stack_buffer (=4k) and thread_pool_stack (=64k) are reduced relative to the values listed here, in order to conserve VM space.rkh(h4hhEhŒh}rl(h]h%]h ]h]h&]uhJM3hKhhL]rmh\X'Be aware that on 32 bit systems, certain default values, such as workspace_client (=16k), thread_pool_workspace (=16k), http_resp_size (=8k), http_req_size (=12k), gzip_stack_buffer (=4k) and thread_pool_stack (=64k) are reduced relative to the values listed here, in order to conserve VM space.rn…ro}rp(hjkh(jiubaubh1eubh(h]h%]h ]h]h&]uh(j7hL]r?h‰)r@}rA(hj=h(j;h (jf)r? }r@ (hX Units: bytesrA h}rB (h]h%]h ]h]h&]uh(j; hL]rC h‰)rD }rE (hjA h(j? h (j")r? }r@ (hX default_gracerA h(j; h …r? }r@ (hj; h(j9 ubaubh))rA }rB (hUh}rC (h]h%]h ]h]h&]uh(j5 hL]rD (j_)rE }rF (hUh}rG (jdX-h]h ]h]h%]h&]uh(jA hL]rH (jf)rI }rJ (hXUnits: secondsrK h}rL (h]h%]h ]h]h&]uh(jE hL]rM h‰)rN }rO (hjK h(jI h (hXFlags: must_restart h}r? (h]h%]h ]h]h&]uh(j- hL]r@ h‰)rA }rB (hXFlags: must_restartrC h(j= h (h]h%]h ]h]h&]uhJKÒhL]r? h\X Default: 15r@ …rA }rB (hj= h(j; ubaubahEjjubahEjbubh‰)rC }rD (hXXGzip window size 8=least, 15=most compression. Memory impact is 8=1k, 9=2k, ... 15=128k.rE h(j/ hh\X http_req_sizer?…r@}rA(hj<h(j:ubaubh))rB}rC(hUh}rD(h]h%]h ]h]h&]uh(j6hL]rE(j_)rF}rG(hUh}rH(jdX-h]h ]h]h%]h&]uh(jBhL]rI(jf)rJ}rK(hX Units: bytesrLh}rM(h]h%]h ]h]h&]uh(jFhL]rNh‰)rO}rP(hjLh(jJh}r?(hX{Whitespace separated list of network endpoints where Varnish will accept requests. Possible formats: host, host:port, :portr@h(jhubaubehEj8ubeubh-)rF}rG(hX]listen_depth - Units: connections - Default: 1024 - Flags: must_restart Listen queue depth. h(h1h}r?(hUh}r@(jdX-h]h ]h]h%]h&]uh(j:hL]rA(jf)rB}rC(hX Units: levelsrDh}rE(h]h%]h ]h]h&]uh(j>hL]rFh‰)rG}rH(hjDh(jBhhL]rQh‰)rR}rS(hX Default: 5rTh(jNhhL]r’h\X›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.r“…r”}r•(hjh(jŽubaubehEj8ubeubh-)r–}r—(hX›nuke_limit - Units: allocations - Default: 50 - Flags: experimental Maximum number of objects we attempt to nuke in orderto make space for a object body. h(h1hh‰)r?}r@(hj<h(j:hh\X Default: 3r?…r@}rA(hj8h(j;ubaubahEjjubjf)rB}rC(hXFlags: experimental h}rD(h]h%]h ]h]h&]uh(j&hL]rEh‰)rF}rG(hXFlags: experimentalrHh(jBhh\XFlags: delayedr?…r@}rA(hj<h(j:ubaubahEjjubehEjbubh‰)rB}rC(hX»Bytes of HTTP protocol workspace allocated for sessions. This space must be big enough for the entire HTTP protocol header and any edits done to it in the VCL code. Minimum is 1024 bytes.rDh(jh}r?(hUh}r@(h]h%]h ]h]h&]uh(j2hL]rA(j_)rB}rC(hUh}rD(jdX-h]h ]h]h%]h&]uh(j>hL]rE(jf)rF}rG(hXUnits: srHh}rI(h]h%]h ]h]h&]uh(jBhL]rJh‰)rK}rL(hjHh(jFhh}r?(hUh}r@(jdX-h]h ]h]h%]h&]uh(j:hL]rA(jf)rB}rC(hXUnits: millisecondsrDh}rE(h]h%]h ]h]h&]uh(j>hL]rFh‰)rG}rH(hjDh(jBhhL]rRh‰)rS}rT(hjPh(jNhhL]r]h‰)r^}r_(hXFlags: experimentalr`h(jZh}r?(hX Default: 1000r@h}rA(h]h%]h ]h]h&]uh(j.hL]rBh‰)rC}rD(hj@h(j>h}r?(hXjthread_pools - Units: pools - Default: 2 - 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. h(h1hhhL]rM(j_)rN}rO(hUh}rP(jdX-h]h ]h]h%]h&]uh(jJhL]rQ(jf)rR}rS(hX Units: poolsrTh}rU(h]h%]h ]h]h&]uh(jNhL]rVh‰)rW}rX(hjTh(jRh}r?(hXzvcl_dir - Default: /usr/local/etc/varnish Directory from which relative VCL filenames (vcl.load and include) are opened. h(h1hhhL]rM(j_)rN}rO(hUh}rP(jdX-h]h ]h]h%]h&]uh(jJhL]rQjf)rR}rS(hX Default: /usr/local/etc/varnish h}rT(h]h%]h ]h]h&]uh(jNhL]rUh‰)rV}rW(hXDefault: /usr/local/etc/varnishrXh(jRh(h]UlevelKh]h ]Usourceh#h%]h&]UlineKUtypeh'uh(jû hL]r?h‰)r@}rA(hUh}rB(h]h%]h ]h]h&]uh(j<hL]rCh\X=Literal block ends without a blank line; unexpected unindent.rD…rE}rF(hUh(j@ubahEhŒubahEj;ubh)rG}rH(hUh}rI(h]UlevelKh]h ]Usourceh#h%]h&]UlineKÏUtypeh'uh(jí hL]rJh‰)rK}rL(hUh}rM(h]h%]h ]h]h&]uh(jGhL]rNh\X=Literal block ends without a blank line; unexpected unindent.rO…rP}rQ(hUh(jKubahEhŒubahEj;ubh)rR}rS(hUh}rT(h]UlevelKh]h ]Usourceh#h%]h&]UlineKÞUtypeh'uh(jW hL]rUh‰)rV}rW(hUh}rX(h]h%]h ]h]h&]uh(jRhL]rYh\X#Literal block expected; none found.rZ…r[}r\(hUh(jVubahEhŒubahEj;ubeUcurrent_sourcer]NU decorationr^NUautofootnote_startr_KUnameidsr`}ra(hhbhjÍhhPh j=h jéh jêh jòh j hj²hhIhjThjÀhjhjUuhL]rb(hCh:ehUU transformerrcNU footnote_refsrd}reUrefnamesrf}rgUsymbol_footnotesrh]riUautofootnote_refsrj]rkUsymbol_footnote_refsrl]rmU citationsrn]rohKhU current_linerpNUtransform_messagesrq]rrh)rs}rt(hUh}ru(h]UlevelKh]h ]Usourceh>h%]h&]UlineKUtypeUINFOrvuhL]rwh‰)rx}ry(hUh}rz(h]h%]h ]h]h&]uh(jshL]r{h\X2Hyperlink target "ref-varnishd" is not referenced.r|…r}}r~(hUh(jxubahEhŒubahEj;ubaUreporterrNUid_startr€KU autofootnotesr]r‚U citation_refsrƒ}r„Uindirect_targetsr…]r†Usettingsr‡(cdocutils.frontend Values rˆor‰}rŠ(Ufootnote_backlinksr‹KUrecord_dependenciesrŒNU rfc_base_urlrUhttp://tools.ietf.org/html/rŽU tracebackrˆUpep_referencesrNUstrip_commentsr‘NU toc_backlinksr’Uentryr“U language_coder”Uenr•U datestampr–NU report_levelr—KU _destinationr˜NU halt_levelr™KU strip_classesršNhYNUerror_encoding_error_handlerr›UbackslashreplacerœUdebugrNUembed_stylesheetrž‰Uoutput_encoding_error_handlerrŸUstrictr U sectnum_xformr¡KUdump_transformsr¢NU docinfo_xformr£KUwarning_streamr¤NUpep_file_url_templater¥Upep-%04dr¦Uexit_status_levelr§KUconfigr¨NUstrict_visitorr©NUcloak_email_addressesrªˆUtrim_footnote_reference_spacer«‰Uenvr¬NUdump_pseudo_xmlr­NUexpose_internalsr®NUsectsubtitle_xformr¯‰U source_linkr°NUrfc_referencesr±NUoutput_encodingr²Uutf-8r³U source_urlr´NUinput_encodingrµU utf-8-sigr¶U_disable_configr·NU id_prefixr¸UU tab_widthr¹KUerror_encodingrºUUTF-8r»U_sourcer¼U6/home/tfheen/varnish/doc/sphinx/reference/varnishd.rstr½Ugettext_compactr¾ˆU generatorr¿NUdump_internalsrÀNU smart_quotesrÁ‰U pep_base_urlrÂUhttp://www.python.org/dev/peps/rÃUsyntax_highlightrÄUlongrÅUinput_encoding_error_handlerrÆj Uauto_id_prefixrÇUidrÈUdoctitle_xformrɉUstrip_elements_with_classesrÊNU _config_filesrË]Ufile_insertion_enabledrÌKU raw_enabledrÍKU dump_settingsrÎNubUsymbol_footnote_startrÏKUidsrÐ}rÑ(jTjPhPh:j=j9jéjåj²j®jÍjÉhbh8jUjQj j hIh:jòjîjêh4jh6jÀj¼uUsubstitution_namesrÒ}rÓhEhKh}rÔ(h]h]h ]Usourceh>h%]h&]uU footnotesrÕ]rÖUrefidsr×}rØhI]rÙhCasub.varnish-3.0.5/doc/sphinx/=build/doctrees/reference/shmem.doctree0000644000175000017500000002214312247037213021615 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(X$shared memory logging and statisticsqNX deallocationsqNX allocationsqNuUsubstitution_defsq }q Uparse_messagesq ]q Ucurrent_sourceq NU decorationqNUautofootnote_startqKUnameidsq}q(hU$shared-memory-logging-and-statisticsqhU deallocationsqhU allocationsquUchildrenq]qcdocutils.nodes section q)q}q(U rawsourceqUUparentqhUsourceqcdocutils.nodes reprunicode qX3/home/tfheen/varnish/doc/sphinx/reference/shmem.rstq…q}q bUtagnameq!Usectionq"U attributesq#}q$(Udupnamesq%]Uclassesq&]Ubackrefsq']Uidsq(]q)haUnamesq*]q+hauUlineq,KUdocumentq-hh]q.(cdocutils.nodes title q/)q0}q1(hX$Shared Memory Logging and Statisticsq2hhhhh!Utitleq3h#}q4(h%]h&]h']h(]h*]uh,Kh-hh]q5cdocutils.nodes Text q6X$Shared Memory Logging and Statisticsq7…q8}q9(hh2hh0ubaubcdocutils.nodes paragraph q:)q;}q<(hXVarnish uses shared memory for logging and statistics, because it is faster and much more efficient. But it is also tricky in ways a regular logfile is not.q=hhhhh!U paragraphq>h#}q?(h%]h&]h']h(]h*]uh,Kh-hh]q@h6XVarnish uses shared memory for logging and statistics, because it is faster and much more efficient. But it is also tricky in ways a regular logfile is not.qA…qB}qC(hh=hh;ubaubh:)qD}qE(hX7When you open a file in "append" mode, the operating system guarantees that whatever you write will not overwrite existing data in the file. The neat result of this is that multiple procesess or threads writing to the same file does not even need to know about each other, it all works just as you would expect.qFhhhhh!h>h#}qG(h%]h&]h']h(]h*]uh,K h-hh]qHh6X7When you open a file in "append" mode, the operating system guarantees that whatever you write will not overwrite existing data in the file. The neat result of this is that multiple procesess or threads writing to the same file does not even need to know about each other, it all works just as you would expect.qI…qJ}qK(hhFhhDubaubh:)qL}qM(hXÇWith a shared memory log, we get no 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.qNhhhhh!h>h#}qO(h%]h&]h']h(]h*]uh,Kh-hh]qPh6XÇWith a shared memory log, we get no 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.qQ…qR}qS(hhNhhLubaubh:)qT}qU(hX‚The "CS101" way, is to introduce locks, and much time is spent examining the relative merits of the many kinds of locks available.qVhhhhh!h>h#}qW(h%]h&]h']h(]h*]uh,Kh-hh]qXh6X‚The "CS101" way, is to introduce locks, and much time is spent examining the relative merits of the many kinds of locks available.qY…qZ}q[(hhVhhTubaubh:)q\}q](hXInside the varnishd (worker) process, we use mutexes to guarantee consistency, both with respect to allocations, log entries and stats counters.q^hhhhh!h>h#}q_(h%]h&]h']h(]h*]uh,Kh-hh]q`h6XInside the varnishd (worker) process, we use mutexes to guarantee consistency, both with respect to allocations, log entries and stats counters.qa…qb}qc(hh^hh\ubaubh:)qd}qe(hXï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.qfhhhhh!h>h#}qg(h%]h&]h']h(]h*]uh,Kh-hh]qhh6Xï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.qi…qj}qk(hhfhhdubaubh:)ql}qm(hXoInstead we use "stable storage" concepts, to make sure the view seen by the readers is consistent at all times.qnhhhhh!h>h#}qo(h%]h&]h']h(]h*]uh,Kh-hh]qph6XoInstead we use "stable storage" concepts, to make sure the view seen by the readers is consistent at all times.qq…qr}qs(hhnhhlubaubh:)qt}qu(hXÏ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.qvhhhhh!h>h#}qw(h%]h&]h']h(]h*]uh,K"h-hh]qxh6XÏ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.qy…qz}q{(hhvhhtubaubh:)q|}q}(hXåWhen Varnishd starts, if it finds an existing shared memory file, and it can safely read the master_pid field, it will check if that process is running, and if so, fail with an error message, indicating that -n arguments collide.q~hhhhh!h>h#}q(h%]h&]h']h(]h*]uh,K'h-hh]q€h6XåWhen Varnishd starts, if it finds an existing shared memory file, and it can safely read the master_pid field, it will check if that process is running, and if so, fail with an error message, indicating that -n arguments collide.q…q‚}qƒ(hh~hh|ubaubh:)q„}q…(hXöIn all other cases, it will delete and create a new shmlog file, in order to provide running readers a cooling off period, where they can discover that there is a new shmlog file, by doing a stat(2) call and checking the st_dev & st_inode fields.q†hhhhh!h>h#}q‡(h%]h&]h']h(]h*]uh,K,h-hh]qˆh6XöIn all other cases, it will delete and create a new shmlog file, in order to provide running readers a cooling off period, where they can discover that there is a new shmlog file, by doing a stat(2) call and checking the st_dev & st_inode fields.q‰…qŠ}q‹(hh†hh„ubaubh)qŒ}q(hUhhhhh!h"h#}qŽ(h%]h&]h']h(]qhah*]qhauh,K2h-hh]q‘(h/)q’}q“(hX Allocationsq”hhŒhhh!h3h#}q•(h%]h&]h']h(]h*]uh,K2h-hh]q–h6X Allocationsq—…q˜}q™(hh”hh’ubaubh:)qš}q›(hXkSections inside the shared memory file are allocated dynamically, for instance when a new backend is added.qœhhŒhhh!h>h#}q(h%]h&]h']h(]h*]uh,K4h-hh]qžh6XkSections inside the shared memory file are allocated dynamically, for instance when a new backend is added.qŸ…q }q¡(hhœhhšubaubh:)q¢}q£(hX¦While changes happen to the linked list of allocations, the "alloc_seq" header field is zero, and after the change, it gets a value different from what it had before.q¤hhŒhhh!h>h#}q¥(h%]h&]h']h(]h*]uh,K7h-hh]q¦h6X¦While changes happen to the linked list of allocations, the "alloc_seq" header field is zero, and after the change, it gets a value different from what it had before.q§…q¨}q©(hh¤hh¢ubaubeubh)qª}q«(hUhhhhh!h"h#}q¬(h%]h&]h']h(]q­hah*]q®hauh,Kh#}q»(h%]h&]h']h(]h*]uh,K>h-hh]q¼h6XºWhen a section is freed, its class will change to "Cool" for at least 10 seconds, giving programs using it time to detect the change in alloc_seq header field and/or the change of class.q½…q¾}q¿(hhºhh¸ubaubeubeubahUU transformerqÀNU footnote_refsqÁ}qÂUrefnamesqÃ}qÄUsymbol_footnotesqÅ]qÆUautofootnote_refsqÇ]qÈUsymbol_footnote_refsqÉ]qÊU citationsqË]qÌh-hU current_lineqÍNUtransform_messagesqÎ]qÏUreporterqÐNUid_startqÑKU autofootnotesqÒ]qÓU citation_refsqÔ}qÕUindirect_targetsqÖ]q×UsettingsqØ(cdocutils.frontend Values qÙoqÚ}qÛ(Ufootnote_backlinksqÜKUrecord_dependenciesqÝNU rfc_base_urlqÞUhttp://tools.ietf.org/html/qßU tracebackqàˆUpep_referencesqáNUstrip_commentsqâNU toc_backlinksqãUentryqäU language_codeqåUenqæU datestampqçNU report_levelqèKU _destinationqéNU halt_levelqêKU strip_classesqëNh3NUerror_encoding_error_handlerqìUbackslashreplaceqíUdebugqîNUembed_stylesheetqï‰Uoutput_encoding_error_handlerqðUstrictqñU sectnum_xformqòKUdump_transformsqóNU docinfo_xformqôKUwarning_streamqõNUpep_file_url_templateqöUpep-%04dq÷Uexit_status_levelqøKUconfigqùNUstrict_visitorqúNUcloak_email_addressesqûˆUtrim_footnote_reference_spaceqü‰UenvqýNUdump_pseudo_xmlqþNUexpose_internalsqÿNUsectsubtitle_xformr‰U source_linkrNUrfc_referencesrNUoutput_encodingrUutf-8rU source_urlrNUinput_encodingrU utf-8-sigrU_disable_configrNU id_prefixr UU tab_widthr KUerror_encodingr UUTF-8r U_sourcer U3/home/tfheen/varnish/doc/sphinx/reference/shmem.rstrUgettext_compactrˆU generatorrNUdump_internalsrNU smart_quotesr‰U pep_base_urlrUhttp://www.python.org/dev/peps/rUsyntax_highlightrUlongrUinput_encoding_error_handlerrhñUauto_id_prefixrUidrUdoctitle_xformr‰Ustrip_elements_with_classesrNU _config_filesr]Ufile_insertion_enabledrKU raw_enabledrKU dump_settingsrNubUsymbol_footnote_startr KUidsr!}r"(hhhhªhhŒuUsubstitution_namesr#}r$h!h-h#}r%(h%]h(]h']Usourcehh&]h*]uU footnotesr&]r'Urefidsr(}r)ub.varnish-3.0.5/doc/sphinx/=build/doctrees/reference/varnishlog.doctree0000644000175000017500000012603712247037213022667 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(X descriptionqNX copyrightqNXtagsqNXdisplay varnish logsq NXref-varnishlogq ˆXsynopsisq NXexamplesq NXsee alsoq NXhistoryqNX varnishlogqNuUsubstitution_defsq}qUparse_messagesq]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hU descriptionqhU copyrightqhUtagsqh Udisplay-varnish-logsqh Uref-varnishlogqh Usynopsisqh Uexamplesqh Usee-alsoq hUhistoryq!hU varnishlogq"uUchildrenq#]q$(cdocutils.nodes target q%)q&}q'(U rawsourceq(X.. _ref-varnishlog:Uparentq)hUsourceq*cdocutils.nodes reprunicode q+X8/home/tfheen/varnish/doc/sphinx/reference/varnishlog.rstq,…q-}q.bUtagnameq/Utargetq0U attributesq1}q2(Uidsq3]Ubackrefsq4]Udupnamesq5]Uclassesq6]Unamesq7]Urefidq8huUlineq9KUdocumentq:hh#]ubcdocutils.nodes section q;)q<}q=(h(Uh)hh*h-Uexpect_referenced_by_nameq>}q?h h&sh/Usectionq@h1}qA(h5]h6]h4]h3]qB(h"heh7]qC(hh euh9Kh:hUexpect_referenced_by_idqD}qEhh&sh#]qF(cdocutils.nodes title qG)qH}qI(h(X varnishlogqJh)h(h5]h6]h4]h3]h7]uh)j6h#]r?hNX-ar@…rA}rB(h(Uh)j<ubah/U option_stringrCubah/UoptionrDubah/U option_grouprEubcdocutils.nodes description rF)rG}rH(h(X?When writing to a file, append to it rather than overwrite it. h1}rI(h5]h6]h4]h3]h7]uh)j+h#]rJh|)rK}rL(h(X>When writing to a file, append to it rather than overwrite it.rMh)jGh*h-h/hh1}rN(h5]h6]h4]h3]h7]uh9K!h#]rOhNX>When writing to a file, append to it rather than overwrite it.rP…rQ}rR(h(jMh)jKubaubah/U descriptionrSubeubj*)rT}rU(h(Uh)j%h*h-h/j-h1}rV(h5]h6]h4]h3]h7]uh9Nh:hh#]rW(j0)rX}rY(h(Uh1}rZ(h5]h6]h4]h3]h7]uh)jTh#]r[j5)r\}r](h(X-br^h1}r_(h5]h6]h4]h3]h7]uh)jXh#]r`j;)ra}rb(h(j^h1}rc(h5]h6]h4]h3]h7]uh)j\h#]rdhNX-bre…rf}rg(h(Uh)jaubah/jCubah/jDubah/jEubjF)rh}ri(h(X”Include log entries which result from communication with a backend server. If neither -b nor -c is specified, varnishlog acts as if they both were. h1}rj(h5]h6]h4]h3]h7]uh)jTh#]rkh|)rl}rm(h(X“Include log entries which result from communication with a backend server. If neither -b nor -c is specified, varnishlog acts as if they both were.rnh)jhh*h-h/hh1}ro(h5]h6]h4]h3]h7]uh9K#h#]rphNX“Include log entries which result from communication with a backend server. If neither -b nor -c is specified, varnishlog acts as if they both were.rq…rr}rs(h(jnh)jlubaubah/jSubeubj*)rt}ru(h(Uh)j%h*h-h/j-h1}rv(h5]h6]h4]h3]h7]uh9Nh:hh#]rw(j0)rx}ry(h(Uh1}rz(h5]h6]h4]h3]h7]uh)jth#]r{j5)r|}r}(h(X-Cr~h1}r(h5]h6]h4]h3]h7]uh)jxh#]r€j;)r}r‚(h(j~h1}rƒ(h5]h6]h4]h3]h7]uh)j|h#]r„hNX-Cr……r†}r‡(h(Uh)jubah/jCubah/jDubah/jEubjF)rˆ}r‰(h(X/Ignore case when matching regular expressions. h1}rŠ(h5]h6]h4]h3]h7]uh)jth#]r‹h|)rŒ}r(h(X.Ignore case when matching regular expressions.rŽh)jˆh*h-h/hh1}r(h5]h6]h4]h3]h7]uh9K&h#]rhNX.Ignore case when matching regular expressions.r‘…r’}r“(h(jŽh)jŒubaubah/jSubeubj*)r”}r•(h(Uh)j%h*h-h/j-h1}r–(h5]h6]h4]h3]h7]uh9Nh:hh#]r—(j0)r˜}r™(h(Uh1}rš(h5]h6]h4]h3]h7]uh)j”h#]r›j5)rœ}r(h(X-cržh1}rŸ(h5]h6]h4]h3]h7]uh)j˜h#]r j;)r¡}r¢(h(jžh1}r£(h5]h6]h4]h3]h7]uh)jœh#]r¤hNX-cr¥…r¦}r§(h(Uh)j¡ubah/jCubah/jDubah/jEubjF)r¨}r©(h(XŒInclude log entries which result from communication with a client. If neither -b nor -c is specified, varnishlog acts as if they both were. h1}rª(h5]h6]h4]h3]h7]uh)j”h#]r«h|)r¬}r­(h(X‹Include log entries which result from communication with a client. If neither -b nor -c is specified, varnishlog acts as if they both were.r®h)j¨h*h-h/hh1}r¯(h5]h6]h4]h3]h7]uh9K(h#]r°hNX‹Include log entries which result from communication with a client. If neither -b nor -c is specified, varnishlog acts as if they both were.r±…r²}r³(h(j®h)j¬ubaubah/jSubeubj*)r´}rµ(h(Uh)j%h*h-h/j-h1}r¶(h5]h6]h4]h3]h7]uh9Nh:hh#]r·(j0)r¸}r¹(h(Uh1}rº(h5]h6]h4]h3]h7]uh)j´h#]r»j5)r¼}r½(h(X-Dr¾h1}r¿(h5]h6]h4]h3]h7]uh)j¸h#]rÀj;)rÁ}rÂ(h(j¾h1}rÃ(h5]h6]h4]h3]h7]uh)j¼h#]rÄhNX-DrÅ…rÆ}rÇ(h(Uh)jÁubah/jCubah/jDubah/jEubjF)rÈ}rÉ(h(X Daemonize. h1}rÊ(h5]h6]h4]h3]h7]uh)j´h#]rËh|)rÌ}rÍ(h(X Daemonize.rÎh)jÈh*h-h/hh1}rÏ(h5]h6]h4]h3]h7]uh9K+h#]rÐhNX Daemonize.rÑ…rÒ}rÓ(h(jÎh)jÌubaubah/jSubeubj*)rÔ}rÕ(h(Uh)j%h*h-h/j-h1}rÖ(h5]h6]h4]h3]h7]uh9Nh:hh#]r×(j0)rØ}rÙ(h(Uh1}rÚ(h5]h6]h4]h3]h7]uh)jÔh#]rÛj5)rÜ}rÝ(h(X-drÞh1}rß(h5]h6]h4]h3]h7]uh)jØh#]ràj;)rá}râ(h(jÞh1}rã(h5]h6]h4]h3]h7]uh)jÜh#]rähNX-drå…ræ}rç(h(Uh)jáubah/jCubah/jDubah/jEubjF)rè}ré(h(X‚Process old log entries on startup. Normally, varnishlog will only process entries which are written to the log after it starts. h1}rê(h5]h6]h4]h3]h7]uh)jÔh#]rëh|)rì}rí(h(XProcess old log entries on startup. Normally, varnishlog will only process entries which are written to the log after it starts.rîh)jèh*h-h/hh1}rï(h5]h6]h4]h3]h7]uh9K-h#]rðhNXProcess old log entries on startup. Normally, varnishlog will only process entries which are written to the log after it starts.rñ…rò}ró(h(jîh)jìubaubah/jSubeubj*)rô}rõ(h(Uh)j%h*h-h/j-h1}rö(h5]h6]h4]h3]h7]uh9Nh:hh#]r÷(j0)rø}rù(h(Uh1}rú(h5]h6]h4]h3]h7]uh)jôh#]rûj5)rü}rý(h(X-I regexh1}rþ(h5]h6]h4]h3]h7]uh)jøh#]rÿ(j;)r}r(h(X-Ih1}r(h5]h6]h4]h3]h7]uh)jüh#]rhNX-Ir…r}r(h(Uh)jubah/jCubcdocutils.nodes option_argument r)r}r (h(Xregexh1}r (h3]h4]h5]U delimiterU h6]h7]uh)jüh#]r hNXregexr …r }r(h(Uh)jubah/Uoption_argumentrubeh/jDubah/jEubjF)r}r(h(X„Include log entries which match the specified regular expression. If neither -I nor -i is specified, all log entries are included. h1}r(h5]h6]h4]h3]h7]uh)jôh#]rh|)r}r(h(XƒInclude log entries which match the specified regular expression. If neither -I nor -i is specified, all log entries are included.rh)jh*h-h/hh1}r(h5]h6]h4]h3]h7]uh9K0h#]rhNXƒInclude log entries which match the specified regular expression. If neither -I nor -i is specified, all log entries are included.r…r}r(h(jh)jubaubah/jSubeubj*)r}r(h(Uh)j%h*h-h/j-h1}r(h5]h6]h4]h3]h7]uh9Nh:hh#]r(j0)r }r!(h(Uh1}r"(h5]h6]h4]h3]h7]uh)jh#]r#j5)r$}r%(h(X-i tagh1}r&(h5]h6]h4]h3]h7]uh)j h#]r'(j;)r(}r)(h(X-ih1}r*(h5]h6]h4]h3]h7]uh)j$h#]r+hNX-ir,…r-}r.(h(Uh)j(ubah/jCubj)r/}r0(h(Xtagh1}r1(h3]h4]h5]U delimiterU h6]h7]uh)j$h#]r2hNXtagr3…r4}r5(h(Uh)j/ubah/jubeh/jDubah/jEubjF)r6}r7(h(XnInclude log entries with the specified tag. If neither -I nor -i is specified, all log entries are included. h1}r8(h5]h6]h4]h3]h7]uh)jh#]r9h|)r:}r;(h(XmInclude log entries with the specified tag. If neither -I nor -i is specified, all log entries are included.r<h)j6h*h-h/hh1}r=(h5]h6]h4]h3]h7]uh9K3h#]r>hNXmInclude log entries with the specified tag. If neither -I nor -i is specified, all log entries are included.r?…r@}rA(h(j<h)j:ubaubah/jSubeubj*)rB}rC(h(Uh)j%h*h-h/j-h1}rD(h5]h6]h4]h3]h7]uh9Nh:hh#]rE(j0)rF}rG(h(Uh1}rH(h5]h6]h4]h3]h7]uh)jBh#]rIj5)rJ}rK(h(X-k numh1}rL(h5]h6]h4]h3]h7]uh)jFh#]rM(j;)rN}rO(h(X-kh1}rP(h5]h6]h4]h3]h7]uh)jJh#]rQhNX-krR…rS}rT(h(Uh)jNubah/jCubj)rU}rV(h(Xnumh1}rW(h3]h4]h5]U delimiterU h6]h7]uh)jJh#]rXhNXnumrY…rZ}r[(h(Uh)jUubah/jubeh/jDubah/jEubjF)r\}r](h(X%Only show the first num log records. h1}r^(h5]h6]h4]h3]h7]uh)jBh#]r_h|)r`}ra(h(X$Only show the first num log records.rbh)j\h*h-h/hh1}rc(h5]h6]h4]h3]h7]uh9K6h#]rdhNX$Only show the first num log records.re…rf}rg(h(jbh)j`ubaubah/jSubeubeubcdocutils.nodes definition_list rh)ri}rj(h(Uh)jh*h-h/Udefinition_listrkh1}rl(h5]h6]h4]h3]h7]uh9Nh:hh#]rmcdocutils.nodes definition_list_item rn)ro}rp(h(Xƒ-m tag:regex only list transactions where tag matches regex. Multiple -m options are AND-ed together. Can not be combined with -O h)jih*h-h/Udefinition_list_itemrqh1}rr(h5]h6]h4]h3]h7]uh9K9h#]rs(cdocutils.nodes term rt)ru}rv(h(XE-m tag:regex only list transactions where tag matches regex. Multiplerwh)joh*h-h/Utermrxh1}ry(h5]h6]h4]h3]h7]uh9K9h#]rz(hNX-m r{…r|}r}(h(X-m h)juubhù)r~}r(h(X tag:regexr€h1}r(Urefurij€h3]h4]h5]h6]h7]uh)juh#]r‚hNX tag:regexrƒ…r„}r…(h(Uh)j~ubah/jubhNX9 only list transactions where tag matches regex. Multipler†…r‡}rˆ(h(X9 only list transactions where tag matches regex. Multipleh)juubeubcdocutils.nodes definition r‰)rŠ}r‹(h(Uh1}rŒ(h5]h6]h4]h3]h7]uh)joh#]rh|)rŽ}r(h(X<-m options are AND-ed together. Can not be combined with -Orh)jŠh*h-h/hh1}r‘(h5]h6]h4]h3]h7]uh9K9h#]r’hNX<-m options are AND-ed together. Can not be combined with -Or“…r”}r•(h(jh)jŽubaubah/U definitionr–ubeubaubj$)r—}r˜(h(Uh)jh*h-h/j'h1}r™(h5]h6]h4]h3]h7]uh9Nh:hh#]rš(j*)r›}rœ(h(Uh)j—h*h-h/j-h1}r(h5]h6]h4]h3]h7]uh9Nh:hh#]rž(j0)rŸ}r (h(Uh1}r¡(h5]h6]h4]h3]h7]uh)j›h#]r¢j5)r£}r¤(h(X-nr¥h1}r¦(h5]h6]h4]h3]h7]uh)jŸh#]r§j;)r¨}r©(h(j¥h1}rª(h5]h6]h4]h3]h7]uh)j£h#]r«hNX-nr¬…r­}r®(h(Uh)j¨ubah/jCubah/jDubah/jEubjF)r¯}r°(h(XnSpecifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used. h1}r±(h5]h6]h4]h3]h7]uh)j›h#]r²h|)r³}r´(h(XmSpecifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used.rµh)j¯h*h-h/hh1}r¶(h5]h6]h4]h3]h7]uh9K;h#]r·hNXmSpecifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used.r¸…r¹}rº(h(jµh)j³ubaubah/jSubeubj*)r»}r¼(h(Uh)j—h*h-h/j-h1}r½(h5]h6]h4]h3]h7]uh9Nh:hh#]r¾(j0)r¿}rÀ(h(Uh1}rÁ(h5]h6]h4]h3]h7]uh)j»h#]rÂj5)rÃ}rÄ(h(X-orÅh1}rÆ(h5]h6]h4]h3]h7]uh)j¿h#]rÇj;)rÈ}rÉ(h(jÅh1}rÊ(h5]h6]h4]h3]h7]uh)jÃh#]rËhNX-orÌ…rÍ}rÎ(h(Uh)jÈubah/jCubah/jDubah/jEubjF)rÏ}rÐ(h(X1Ignored for compatibility with earlier versions. h1}rÑ(h5]h6]h4]h3]h7]uh)j»h#]rÒh|)rÓ}rÔ(h(X0Ignored for compatibility with earlier versions.rÕh)jÏh*h-h/hh1}rÖ(h5]h6]h4]h3]h7]uh9K>h#]r×hNX0Ignored for compatibility with earlier versions.rØ…rÙ}rÚ(h(jÕh)jÓubaubah/jSubeubj*)rÛ}rÜ(h(Uh)j—h*h-h/j-h1}rÝ(h5]h6]h4]h3]h7]uh9Nh:hh#]rÞ(j0)rß}rà(h(Uh1}rá(h5]h6]h4]h3]h7]uh)jÛh#]râj5)rã}rä(h(X-Oråh1}ræ(h5]h6]h4]h3]h7]uh)jßh#]rçj;)rè}ré(h(jåh1}rê(h5]h6]h4]h3]h7]uh)jãh#]rëhNX-Orì…rí}rî(h(Uh)jèubah/jCubah/jDubah/jEubjF)rï}rð(h(XFDo not group log entries by request ID. Can not be combined with -m. h1}rñ(h5]h6]h4]h3]h7]uh)jÛh#]ròh|)ró}rô(h(XEDo not group log entries by request ID. Can not be combined with -m.rõh)jïh*h-h/hh1}rö(h5]h6]h4]h3]h7]uh9K@h#]r÷hNXEDo not group log entries by request ID. Can not be combined with -m.rø…rù}rú(h(jõh)jóubaubah/jSubeubj*)rû}rü(h(Uh)j—h*h-h/j-h1}rý(h5]h6]h4]h3]h7]uh9Nh:hh#]rþ(j0)rÿ}r(h(Uh1}r(h5]h6]h4]h3]h7]uh)jûh#]rj5)r}r(h(X-P fileh1}r(h5]h6]h4]h3]h7]uh)jÿh#]r(j;)r}r(h(X-Ph1}r (h5]h6]h4]h3]h7]uh)jh#]r hNX-Pr …r }r (h(Uh)jubah/jCubj)r}r(h(Xfileh1}r(h3]h4]h5]U delimiterU h6]h7]uh)jh#]rhNXfiler…r}r(h(Uh)jubah/jubeh/jDubah/jEubjF)r}r(h(X/Write the process's PID to the specified file. h1}r(h5]h6]h4]h3]h7]uh)jûh#]rh|)r}r(h(X.Write the process's PID to the specified file.rh)jh*h-h/hh1}r(h5]h6]h4]h3]h7]uh9KCh#]rhNX.Write the process's PID to the specified file.r…r}r (h(jh)jubaubah/jSubeubj*)r!}r"(h(Uh)j—h*h-h/j-h1}r#(h5]h6]h4]h3]h7]uh9Nh:hh#]r$(j0)r%}r&(h(Uh1}r'(h5]h6]h4]h3]h7]uh)j!h#]r(j5)r)}r*(h(X-r fileh1}r+(h5]h6]h4]h3]h7]uh)j%h#]r,(j;)r-}r.(h(X-rh1}r/(h5]h6]h4]h3]h7]uh)j)h#]r0hNX-rr1…r2}r3(h(Uh)j-ubah/jCubj)r4}r5(h(Xfileh1}r6(h3]h4]h5]U delimiterU h6]h7]uh)j)h#]r7hNXfiler8…r9}r:(h(Uh)j4ubah/jubeh/jDubah/jEubjF)r;}r<(h(X5Read log entries from file instead of shared memory. h1}r=(h5]h6]h4]h3]h7]uh)j!h#]r>h|)r?}r@(h(X4Read log entries from file instead of shared memory.rAh)j;h*h-h/hh1}rB(h5]h6]h4]h3]h7]uh9KEh#]rChNX4Read log entries from file instead of shared memory.rD…rE}rF(h(jAh)j?ubaubah/jSubeubj*)rG}rH(h(Uh)j—h*h-h/j-h1}rI(h5]h6]h4]h3]h7]uh9Nh:hh#]rJ(j0)rK}rL(h(Uh1}rM(h5]h6]h4]h3]h7]uh)jGh#]rNj5)rO}rP(h(X-s numh1}rQ(h5]h6]h4]h3]h7]uh)jKh#]rR(j;)rS}rT(h(X-sh1}rU(h5]h6]h4]h3]h7]uh)jOh#]rVhNX-srW…rX}rY(h(Uh)jSubah/jCubj)rZ}r[(h(Xnumh1}r\(h3]h4]h5]U delimiterU h6]h7]uh)jOh#]r]hNXnumr^…r_}r`(h(Uh)jZubah/jubeh/jDubah/jEubjF)ra}rb(h(X Skip the first num log records. h1}rc(h5]h6]h4]h3]h7]uh)jGh#]rdh|)re}rf(h(XSkip the first num log records.rgh)jah*h-h/hh1}rh(h5]h6]h4]h3]h7]uh9KGh#]rihNXSkip the first num log records.rj…rk}rl(h(jgh)jeubaubah/jSubeubj*)rm}rn(h(Uh)j—h*h-h/j-h1}ro(h5]h6]h4]h3]h7]uh9Nh:hh#]rp(j0)rq}rr(h(Uh1}rs(h5]h6]h4]h3]h7]uh)jmh#]rtj5)ru}rv(h(X-urwh1}rx(h5]h6]h4]h3]h7]uh)jqh#]ryj;)rz}r{(h(jwh1}r|(h5]h6]h4]h3]h7]uh)juh#]r}hNX-ur~…r}r€(h(Uh)jzubah/jCubah/jDubah/jEubjF)r}r‚(h(XUnbuffered output. h1}rƒ(h5]h6]h4]h3]h7]uh)jmh#]r„h|)r…}r†(h(XUnbuffered output.r‡h)jh*h-h/hh1}rˆ(h5]h6]h4]h3]h7]uh9KIh#]r‰hNXUnbuffered output.rŠ…r‹}rŒ(h(j‡h)j…ubaubah/jSubeubj*)r}rŽ(h(Uh)j—h*h-h/j-h1}r(h5]h6]h4]h3]h7]uh9Nh:hh#]r(j0)r‘}r’(h(Uh1}r“(h5]h6]h4]h3]h7]uh)jh#]r”j5)r•}r–(h(X-Vr—h1}r˜(h5]h6]h4]h3]h7]uh)j‘h#]r™j;)rš}r›(h(j—h1}rœ(h5]h6]h4]h3]h7]uh)j•h#]rhNX-Vrž…rŸ}r (h(Uh)jšubah/jCubah/jDubah/jEubjF)r¡}r¢(h(X%Display the version number and exit. h1}r£(h5]h6]h4]h3]h7]uh)jh#]r¤h|)r¥}r¦(h(X$Display the version number and exit.r§h)j¡h*h-h/hh1}r¨(h5]h6]h4]h3]h7]uh9KKh#]r©hNX$Display the version number and exit.rª…r«}r¬(h(j§h)j¥ubaubah/jSubeubj*)r­}r®(h(Uh)j—h*h-h/j-h1}r¯(h5]h6]h4]h3]h7]uh9Nh:hh#]r°(j0)r±}r²(h(Uh1}r³(h5]h6]h4]h3]h7]uh)j­h#]r´j5)rµ}r¶(h(X-w fileh1}r·(h5]h6]h4]h3]h7]uh)j±h#]r¸(j;)r¹}rº(h(X-wh1}r»(h5]h6]h4]h3]h7]uh)jµh#]r¼hNX-wr½…r¾}r¿(h(Uh)j¹ubah/jCubj)rÀ}rÁ(h(Xfileh1}rÂ(h3]h4]h5]U delimiterU h6]h7]uh)jµh#]rÃhNXfilerÄ…rÅ}rÆ(h(Uh)jÀubah/jubeh/jDubah/jEubjF)rÇ}rÈ(h(XóWrite log entries to file instead of displaying them. The file will be overwritten unless the -a option was specified. If varnishlog receives a SIGHUP while writing to a file, it will reopen the file, allowing the old one to be rotated away. h1}rÉ(h5]h6]h4]h3]h7]uh)j­h#]rÊh|)rË}rÌ(h(XòWrite log entries to file instead of displaying them. The file will be overwritten unless the -a option was specified. If varnishlog receives a SIGHUP while writing to a file, it will reopen the file, allowing the old one to be rotated away.rÍh)jÇh*h-h/hh1}rÎ(h5]h6]h4]h3]h7]uh9KMh#]rÏhNXòWrite log entries to file instead of displaying them. The file will be overwritten unless the -a option was specified. If varnishlog receives a SIGHUP while writing to a file, it will reopen the file, allowing the old one to be rotated away.rÐ…rÑ}rÒ(h(jÍh)jËubaubah/jSubeubj*)rÓ}rÔ(h(Uh)j—h*h-h/j-h1}rÕ(h5]h6]h4]h3]h7]uh9Nh:hh#]rÖ(j0)r×}rØ(h(Uh1}rÙ(h5]h6]h4]h3]h7]uh)jÓh#]rÚj5)rÛ}rÜ(h(X-X regexh1}rÝ(h5]h6]h4]h3]h7]uh)j×h#]rÞ(j;)rß}rà(h(X-Xh1}rá(h5]h6]h4]h3]h7]uh)jÛh#]râhNX-Xrã…rä}rå(h(Uh)jßubah/jCubj)ræ}rç(h(Xregexh1}rè(h3]h4]h5]U delimiterU h6]h7]uh)jÛh#]réhNXregexrê…rë}rì(h(Uh)jæubah/jubeh/jDubah/jEubjF)rí}rî(h(XBExclude log entries which match the specified regular expression. h1}rï(h5]h6]h4]h3]h7]uh)jÓh#]rðh|)rñ}rò(h(XAExclude log entries which match the specified regular expression.róh)jíh*h-h/hh1}rô(h5]h6]h4]h3]h7]uh9KRh#]rõhNXAExclude log entries which match the specified regular expression.rö…r÷}rø(h(jóh)jñubaubah/jSubeubj*)rù}rú(h(Uh)j—h*h-h/j-h1}rû(h5]h6]h4]h3]h7]uh9Nh:hh#]rü(j0)rý}rþ(h(Uh1}rÿ(h5]h6]h4]h3]h7]uh)jùh#]rj5)r}r(h(X-x tagh1}r(h5]h6]h4]h3]h7]uh)jýh#]r(j;)r}r(h(X-xh1}r(h5]h6]h4]h3]h7]uh)jh#]rhNX-xr …r }r (h(Uh)jubah/jCubj)r }r (h(Xtagh1}r(h3]h4]h5]U delimiterU h6]h7]uh)jh#]rhNXtagr…r}r(h(Uh)j ubah/jubeh/jDubah/jEubjF)r}r(h(X,Exclude log entries with the specified tag. h1}r(h5]h6]h4]h3]h7]uh)jùh#]rh|)r}r(h(X+Exclude log entries with the specified tag.rh)jh*h-h/hh1}r(h5]h6]h4]h3]h7]uh9KTh#]rhNX+Exclude log entries with the specified tag.r…r}r(h(jh)jubaubah/jSubeubeubeubh;)r}r (h(Uh)hRh*h-h/h@h1}r!(h5]h6]h4]h3]r"hah7]r#hauh9KWh:hh#]r$(hG)r%}r&(h(XTAGSr'h)jh*h-h/hKh1}r((h5]h6]h4]h3]h7]uh9KWh:hh#]r)hNXTAGSr*…r+}r,(h(j'h)j%ubaubh|)r-}r.(h(X3The following log entry tags are currently defined:r/h)jh*h-h/hh1}r0(h5]h6]h4]h3]h7]uh9KXh:hh#]r1hNX3The following log entry tags are currently defined:r2…r3}r4(h(j/h)j-ubaubcdocutils.nodes bullet_list r5)r6}r7(h(Uh)jh*h-h/U bullet_listr8h1}r9(Ubulletr:X*h3]h4]h5]h6]h7]uh9KZh:hh#]r;(cdocutils.nodes list_item r<)r=}r>(h(XBackendr?h)j6h*h-h/U list_itemr@h1}rA(h5]h6]h4]h3]h7]uh9Nh:hh#]rBh|)rC}rD(h(j?h)j=h*h-h/hh1}rE(h5]h6]h4]h3]h7]uh9KZh#]rFhNXBackendrG…rH}rI(h(j?h)jCubaubaubj<)rJ}rK(h(X BackendCloserLh)j6h*h-h/j@h1}rM(h5]h6]h4]h3]h7]uh9Nh:hh#]rNh|)rO}rP(h(jLh)jJh*h-h/hh1}rQ(h5]h6]h4]h3]h7]uh9K[h#]rRhNX BackendCloserS…rT}rU(h(jLh)jOubaubaubj<)rV}rW(h(X BackendOpenrXh)j6h*h-h/j@h1}rY(h5]h6]h4]h3]h7]uh9Nh:hh#]rZh|)r[}r\(h(jXh)jVh*h-h/hh1}r](h5]h6]h4]h3]h7]uh9K\h#]r^hNX BackendOpenr_…r`}ra(h(jXh)j[ubaubaubj<)rb}rc(h(X BackendReuserdh)j6h*h-h/j@h1}re(h5]h6]h4]h3]h7]uh9Nh:hh#]rfh|)rg}rh(h(jdh)jbh*h-h/hh1}ri(h5]h6]h4]h3]h7]uh9K]h#]rjhNX BackendReuserk…rl}rm(h(jdh)jgubaubaubj<)rn}ro(h(X BackendXIDrph)j6h*h-h/j@h1}rq(h5]h6]h4]h3]h7]uh9Nh:hh#]rrh|)rs}rt(h(jph)jnh*h-h/hh1}ru(h5]h6]h4]h3]h7]uh9K^h#]rvhNX BackendXIDrw…rx}ry(h(jph)jsubaubaubj<)rz}r{(h(XCLIr|h)j6h*h-h/j@h1}r}(h5]h6]h4]h3]h7]uh9Nh:hh#]r~h|)r}r€(h(j|h)jzh*h-h/hh1}r(h5]h6]h4]h3]h7]uh9K_h#]r‚hNXCLIrƒ…r„}r…(h(j|h)jubaubaubj<)r†}r‡(h(X ClientAddrrˆh)j6h*h-h/j@h1}r‰(h5]h6]h4]h3]h7]uh9Nh:hh#]rŠh|)r‹}rŒ(h(jˆh)j†h*h-h/hh1}r(h5]h6]h4]h3]h7]uh9K`h#]rŽhNX ClientAddrr…r}r‘(h(jˆh)j‹ubaubaubj<)r’}r“(h(XDebugr”h)j6h*h-h/j@h1}r•(h5]h6]h4]h3]h7]uh9Nh:hh#]r–h|)r—}r˜(h(j”h)j’h*h-h/hh1}r™(h5]h6]h4]h3]h7]uh9Kah#]ršhNXDebugr›…rœ}r(h(j”h)j—ubaubaubj<)rž}rŸ(h(XErrorr h)j6h*h-h/j@h1}r¡(h5]h6]h4]h3]h7]uh9Nh:hh#]r¢h|)r£}r¤(h(j h)jžh*h-h/hh1}r¥(h5]h6]h4]h3]h7]uh9Kbh#]r¦hNXErrorr§…r¨}r©(h(j h)j£ubaubaubj<)rª}r«(h(XExpBanr¬h)j6h*h-h/j@h1}r­(h5]h6]h4]h3]h7]uh9Nh:hh#]r®h|)r¯}r°(h(j¬h)jªh*h-h/hh1}r±(h5]h6]h4]h3]h7]uh9Kch#]r²hNXExpBanr³…r´}rµ(h(j¬h)j¯ubaubaubj<)r¶}r·(h(XExpKillr¸h)j6h*h-h/j@h1}r¹(h5]h6]h4]h3]h7]uh9Nh:hh#]rºh|)r»}r¼(h(j¸h)j¶h*h-h/hh1}r½(h5]h6]h4]h3]h7]uh9Kdh#]r¾hNXExpKillr¿…rÀ}rÁ(h(j¸h)j»ubaubaubj<)rÂ}rÃ(h(XExpPickrÄh)j6h*h-h/j@h1}rÅ(h5]h6]h4]h3]h7]uh9Nh:hh#]rÆh|)rÇ}rÈ(h(jÄh)jÂh*h-h/hh1}rÉ(h5]h6]h4]h3]h7]uh9Keh#]rÊhNXExpPickrË…rÌ}rÍ(h(jÄh)jÇubaubaubj<)rÎ}rÏ(h(XHitrÐh)j6h*h-h/j@h1}rÑ(h5]h6]h4]h3]h7]uh9Nh:hh#]rÒh|)rÓ}rÔ(h(jÐh)jÎh*h-h/hh1}rÕ(h5]h6]h4]h3]h7]uh9Kfh#]rÖhNXHitr×…rØ}rÙ(h(jÐh)jÓubaubaubj<)rÚ}rÛ(h(XHitPassrÜh)j6h*h-h/j@h1}rÝ(h5]h6]h4]h3]h7]uh9Nh:hh#]rÞh|)rß}rà(h(jÜh)jÚh*h-h/hh1}rá(h5]h6]h4]h3]h7]uh9Kgh#]râhNXHitPassrã…rä}rå(h(jÜh)jßubaubaubj<)ræ}rç(h(X HttpErrorrèh)j6h*h-h/j@h1}ré(h5]h6]h4]h3]h7]uh9Nh:hh#]rêh|)rë}rì(h(jèh)jæh*h-h/hh1}rí(h5]h6]h4]h3]h7]uh9Khh#]rîhNX HttpErrorrï…rð}rñ(h(jèh)jëubaubaubj<)rò}ró(h(X HttpGarbagerôh)j6h*h-h/j@h1}rõ(h5]h6]h4]h3]h7]uh9Nh:hh#]röh|)r÷}rø(h(jôh)jòh*h-h/hh1}rù(h5]h6]h4]h3]h7]uh9Kih#]rúhNX HttpGarbagerû…rü}rý(h(jôh)j÷ubaubaubj<)rþ}rÿ(h(XLengthrh)j6h*h-h/j@h1}r(h5]h6]h4]h3]h7]uh9Nh:hh#]rh|)r}r(h(jh)jþh*h-h/hh1}r(h5]h6]h4]h3]h7]uh9Kjh#]rhNXLengthr…r}r (h(jh)jubaubaubj<)r }r (h(X ObjHeaderr h)j6h*h-h/j@h1}r (h5]h6]h4]h3]h7]uh9Nh:hh#]rh|)r}r(h(j h)j h*h-h/hh1}r(h5]h6]h4]h3]h7]uh9Kkh#]rhNX ObjHeaderr…r}r(h(j h)jubaubaubj<)r}r(h(X ObjLostHeaderrh)j6h*h-h/j@h1}r(h5]h6]h4]h3]h7]uh9Nh:hh#]rh|)r}r(h(jh)jh*h-h/hh1}r(h5]h6]h4]h3]h7]uh9Klh#]rhNX ObjLostHeaderr…r }r!(h(jh)jubaubaubj<)r"}r#(h(X ObjProtocolr$h)j6h*h-h/j@h1}r%(h5]h6]h4]h3]h7]uh9Nh:hh#]r&h|)r'}r((h(j$h)j"h*h-h/hh1}r)(h5]h6]h4]h3]h7]uh9Kmh#]r*hNX ObjProtocolr+…r,}r-(h(j$h)j'ubaubaubj<)r.}r/(h(X ObjRequestr0h)j6h*h-h/j@h1}r1(h5]h6]h4]h3]h7]uh9Nh:hh#]r2h|)r3}r4(h(j0h)j.h*h-h/hh1}r5(h5]h6]h4]h3]h7]uh9Knh#]r6hNX ObjRequestr7…r8}r9(h(j0h)j3ubaubaubj<)r:}r;(h(X ObjResponser<h)j6h*h-h/j@h1}r=(h5]h6]h4]h3]h7]uh9Nh:hh#]r>h|)r?}r@(h(j<h)j:h*h-h/hh1}rA(h5]h6]h4]h3]h7]uh9Koh#]rBhNX ObjResponserC…rD}rE(h(j<h)j?ubaubaubj<)rF}rG(h(X ObjStatusrHh)j6h*h-h/j@h1}rI(h5]h6]h4]h3]h7]uh9Nh:hh#]rJh|)rK}rL(h(jHh)jFh*h-h/hh1}rM(h5]h6]h4]h3]h7]uh9Kph#]rNhNX ObjStatusrO…rP}rQ(h(jHh)jKubaubaubj<)rR}rS(h(XObjURLrTh)j6h*h-h/j@h1}rU(h5]h6]h4]h3]h7]uh9Nh:hh#]rVh|)rW}rX(h(jTh)jRh*h-h/hh1}rY(h5]h6]h4]h3]h7]uh9Kqh#]rZhNXObjURLr[…r\}r](h(jTh)jWubaubaubj<)r^}r_(h(XReqEndr`h)j6h*h-h/j@h1}ra(h5]h6]h4]h3]h7]uh9Nh:hh#]rbh|)rc}rd(h(j`h)j^h*h-h/hh1}re(h5]h6]h4]h3]h7]uh9Krh#]rfhNXReqEndrg…rh}ri(h(j`h)jcubaubaubj<)rj}rk(h(XReqStartrlh)j6h*h-h/j@h1}rm(h5]h6]h4]h3]h7]uh9Nh:hh#]rnh|)ro}rp(h(jlh)jjh*h-h/hh1}rq(h5]h6]h4]h3]h7]uh9Ksh#]rrhNXReqStartrs…rt}ru(h(jlh)joubaubaubj<)rv}rw(h(XRxHeaderrxh)j6h*h-h/j@h1}ry(h5]h6]h4]h3]h7]uh9Nh:hh#]rzh|)r{}r|(h(jxh)jvh*h-h/hh1}r}(h5]h6]h4]h3]h7]uh9Kth#]r~hNXRxHeaderr…r€}r(h(jxh)j{ubaubaubj<)r‚}rƒ(h(X RxLostHeaderr„h)j6h*h-h/j@h1}r…(h5]h6]h4]h3]h7]uh9Nh:hh#]r†h|)r‡}rˆ(h(j„h)j‚h*h-h/hh1}r‰(h5]h6]h4]h3]h7]uh9Kuh#]rŠhNX RxLostHeaderr‹…rŒ}r(h(j„h)j‡ubaubaubj<)rŽ}r(h(X RxProtocolrh)j6h*h-h/j@h1}r‘(h5]h6]h4]h3]h7]uh9Nh:hh#]r’h|)r“}r”(h(jh)jŽh*h-h/hh1}r•(h5]h6]h4]h3]h7]uh9Kvh#]r–hNX RxProtocolr—…r˜}r™(h(jh)j“ubaubaubj<)rš}r›(h(X RxRequestrœh)j6h*h-h/j@h1}r(h5]h6]h4]h3]h7]uh9Nh:hh#]ržh|)rŸ}r (h(jœh)jšh*h-h/hh1}r¡(h5]h6]h4]h3]h7]uh9Kwh#]r¢hNX RxRequestr£…r¤}r¥(h(jœh)jŸubaubaubj<)r¦}r§(h(X RxResponser¨h)j6h*h-h/j@h1}r©(h5]h6]h4]h3]h7]uh9Nh:hh#]rªh|)r«}r¬(h(j¨h)j¦h*h-h/hh1}r­(h5]h6]h4]h3]h7]uh9Kxh#]r®hNX RxResponser¯…r°}r±(h(j¨h)j«ubaubaubj<)r²}r³(h(XRxStatusr´h)j6h*h-h/j@h1}rµ(h5]h6]h4]h3]h7]uh9Nh:hh#]r¶h|)r·}r¸(h(j´h)j²h*h-h/hh1}r¹(h5]h6]h4]h3]h7]uh9Kyh#]rºhNXRxStatusr»…r¼}r½(h(j´h)j·ubaubaubj<)r¾}r¿(h(XRxURLrÀh)j6h*h-h/j@h1}rÁ(h5]h6]h4]h3]h7]uh9Nh:hh#]rÂh|)rÃ}rÄ(h(jÀh)j¾h*h-h/hh1}rÅ(h5]h6]h4]h3]h7]uh9Kzh#]rÆhNXRxURLrÇ…rÈ}rÉ(h(jÀh)jÃubaubaubj<)rÊ}rË(h(X SessionCloserÌh)j6h*h-h/j@h1}rÍ(h5]h6]h4]h3]h7]uh9Nh:hh#]rÎh|)rÏ}rÐ(h(jÌh)jÊh*h-h/hh1}rÑ(h5]h6]h4]h3]h7]uh9K{h#]rÒhNX SessionCloserÓ…rÔ}rÕ(h(jÌh)jÏubaubaubj<)rÖ}r×(h(X SessionOpenrØh)j6h*h-h/j@h1}rÙ(h5]h6]h4]h3]h7]uh9Nh:hh#]rÚh|)rÛ}rÜ(h(jØh)jÖh*h-h/hh1}rÝ(h5]h6]h4]h3]h7]uh9K|h#]rÞhNX SessionOpenrß…rà}rá(h(jØh)jÛubaubaubj<)râ}rã(h(XStatAddrräh)j6h*h-h/j@h1}rå(h5]h6]h4]h3]h7]uh9Nh:hh#]ræh|)rç}rè(h(jäh)jâh*h-h/hh1}ré(h5]h6]h4]h3]h7]uh9K}h#]rêhNXStatAddrrë…rì}rí(h(jäh)jçubaubaubj<)rî}rï(h(XStatSessrðh)j6h*h-h/j@h1}rñ(h5]h6]h4]h3]h7]uh9Nh:hh#]ròh|)ró}rô(h(jðh)jîh*h-h/hh1}rõ(h5]h6]h4]h3]h7]uh9K~h#]röhNXStatSessr÷…rø}rù(h(jðh)jóubaubaubj<)rú}rû(h(XTTLrüh)j6h*h-h/j@h1}rý(h5]h6]h4]h3]h7]uh9Nh:hh#]rþh|)rÿ}r(h(jüh)júh*h-h/hh1}r(h5]h6]h4]h3]h7]uh9Kh#]rhNXTTLr…r}r(h(jüh)jÿubaubaubj<)r}r(h(XTxHeaderrh)j6h*h-h/j@h1}r (h5]h6]h4]h3]h7]uh9Nh:hh#]r h|)r }r (h(jh)jh*h-h/hh1}r (h5]h6]h4]h3]h7]uh9K€h#]rhNXTxHeaderr…r}r(h(jh)j ubaubaubj<)r}r(h(X TxLostHeaderrh)j6h*h-h/j@h1}r(h5]h6]h4]h3]h7]uh9Nh:hh#]rh|)r}r(h(jh)jh*h-h/hh1}r(h5]h6]h4]h3]h7]uh9Kh#]rhNX TxLostHeaderr…r}r(h(jh)jubaubaubj<)r}r(h(X TxProtocolr h)j6h*h-h/j@h1}r!(h5]h6]h4]h3]h7]uh9Nh:hh#]r"h|)r#}r$(h(j h)jh*h-h/hh1}r%(h5]h6]h4]h3]h7]uh9K‚h#]r&hNX TxProtocolr'…r(}r)(h(j h)j#ubaubaubj<)r*}r+(h(X TxRequestr,h)j6h*h-h/j@h1}r-(h5]h6]h4]h3]h7]uh9Nh:hh#]r.h|)r/}r0(h(j,h)j*h*h-h/hh1}r1(h5]h6]h4]h3]h7]uh9Kƒh#]r2hNX TxRequestr3…r4}r5(h(j,h)j/ubaubaubj<)r6}r7(h(X TxResponser8h)j6h*h-h/j@h1}r9(h5]h6]h4]h3]h7]uh9Nh:hh#]r:h|)r;}r<(h(j8h)j6h*h-h/hh1}r=(h5]h6]h4]h3]h7]uh9K„h#]r>hNX TxResponser?…r@}rA(h(j8h)j;ubaubaubj<)rB}rC(h(XTxStatusrDh)j6h*h-h/j@h1}rE(h5]h6]h4]h3]h7]uh9Nh:hh#]rFh|)rG}rH(h(jDh)jBh*h-h/hh1}rI(h5]h6]h4]h3]h7]uh9K…h#]rJhNXTxStatusrK…rL}rM(h(jDh)jGubaubaubj<)rN}rO(h(XTxURLrPh)j6h*h-h/j@h1}rQ(h5]h6]h4]h3]h7]uh9Nh:hh#]rRh|)rS}rT(h(jPh)jNh*h-h/hh1}rU(h5]h6]h4]h3]h7]uh9K†h#]rVhNXTxURLrW…rX}rY(h(jPh)jSubaubaubj<)rZ}r[(h(XVCL_aclr\h)j6h*h-h/j@h1}r](h5]h6]h4]h3]h7]uh9Nh:hh#]r^h|)r_}r`(h(j\h)jZh*h-h/hh1}ra(h5]h6]h4]h3]h7]uh9K‡h#]rbhNXVCL_aclrc…rd}re(h(j\h)j_ubaubaubj<)rf}rg(h(XVCL_callrhh)j6h*h-h/j@h1}ri(h5]h6]h4]h3]h7]uh9Nh:hh#]rjh|)rk}rl(h(jhh)jfh*h-h/hh1}rm(h5]h6]h4]h3]h7]uh9Kˆh#]rnhNXVCL_callro…rp}rq(h(jhh)jkubaubaubj<)rr}rs(h(X VCL_returnrth)j6h*h-h/j@h1}ru(h5]h6]h4]h3]h7]uh9Nh:hh#]rvh|)rw}rx(h(jth)jrh*h-h/hh1}ry(h5]h6]h4]h3]h7]uh9K‰h#]rzhNX VCL_returnr{…r|}r}(h(jth)jwubaubaubj<)r~}r(h(X VCL_tracer€h)j6h*h-h/j@h1}r(h5]h6]h4]h3]h7]uh9Nh:hh#]r‚h|)rƒ}r„(h(j€h)j~h*h-h/hh1}r…(h5]h6]h4]h3]h7]uh9KŠh#]r†hNX VCL_tracer‡…rˆ}r‰(h(j€h)jƒubaubaubj<)rŠ}r‹(h(X WorkThread h)j6h*h-h/j@h1}rŒ(h5]h6]h4]h3]h7]uh9Nh:hh#]rh|)rŽ}r(h(X WorkThreadrh)jŠh*h-h/hh1}r‘(h5]h6]h4]h3]h7]uh9K‹h#]r’hNX WorkThreadr“…r”}r•(h(jh)jŽubaubaubeubeubh;)r–}r—(h(Uh)hRh*h-h/h@h1}r˜(h5]h6]h4]h3]r™hah7]ršh auh9KŽh:hh#]r›(hG)rœ}r(h(XEXAMPLESržh)j–h*h-h/hKh1}rŸ(h5]h6]h4]h3]h7]uh9KŽh:hh#]r hNXEXAMPLESr¡…r¢}r£(h(jžh)jœubaubh|)r¤}r¥(h(XHThe following command line simply copies all log entries to a log file::r¦h)j–h*h-h/hh1}r§(h5]h6]h4]h3]h7]uh9Kh:hh#]r¨hNXGThe following command line simply copies all log entries to a log file:r©…rª}r«(h(XGThe following command line simply copies all log entries to a log file:h)j¤ubaubcdocutils.nodes literal_block r¬)r­}r®(h(X$$ varnishlog -w /var/log/varnish.logh)j–h*h-h/U literal_blockr¯h1}r°(U xml:spacer±Upreserver²h3]h4]h5]h6]h7]uh9K’h:hh#]r³hNX$$ varnishlog -w /var/log/varnish.logr´…rµ}r¶(h(Uh)j­ubaubh|)r·}r¸(h(X^The following command line reads that same log file and displays requests for the front page::r¹h)j–h*h-h/hh1}rº(h5]h6]h4]h3]h7]uh9K”h:hh#]r»hNX]The following command line reads that same log file and displays requests for the front page:r¼…r½}r¾(h(X]The following command line reads that same log file and displays requests for the front page:h)j·ubaubj¬)r¿}rÀ(h(X6$ varnishlog -r /var/log/varnish.log -c -m 'RxURL:^/$'h)j–h*h-h/j¯h1}rÁ(j±j²h3]h4]h5]h6]h7]uh9K–h:hh#]rÂhNX6$ varnishlog -r /var/log/varnish.log -c -m 'RxURL:^/$'rÃ…rÄ}rÅ(h(Uh)j¿ubaubeubh;)rÆ}rÇ(h(Uh)hRh*h-h/h@h1}rÈ(h5]h6]h4]h3]rÉh ah7]rÊh auh9K™h:hh#]rË(hG)rÌ}rÍ(h(XSEE ALSOrÎh)jÆh*h-h/hKh1}rÏ(h5]h6]h4]h3]h7]uh9K™h:hh#]rÐhNXSEE ALSOrÑ…rÒ}rÓ(h(jÎh)jÌubaubj5)rÔ}rÕ(h(Uh)jÆh*h-h/j8h1}rÖ(j:X*h3]h4]h5]h6]h7]uh9Kšh:hh#]r×(j<)rØ}rÙ(h(X varnishd(1)rÚh)jÔh*h-h/j@h1}rÛ(h5]h6]h4]h3]h7]uh9Nh:hh#]rÜh|)rÝ}rÞ(h(jÚh)jØh*h-h/hh1}rß(h5]h6]h4]h3]h7]uh9Kšh#]ràhNX varnishd(1)rá…râ}rã(h(jÚh)jÝubaubaubj<)rä}rå(h(Xvarnishhist(1)ræh)jÔh*h-h/j@h1}rç(h5]h6]h4]h3]h7]uh9Nh:hh#]rèh|)ré}rê(h(jæh)jäh*h-h/hh1}rë(h5]h6]h4]h3]h7]uh9K›h#]rìhNXvarnishhist(1)rí…rî}rï(h(jæh)jéubaubaubj<)rð}rñ(h(Xvarnishncsa(1)ròh)jÔh*h-h/j@h1}ró(h5]h6]h4]h3]h7]uh9Nh:hh#]rôh|)rõ}rö(h(jòh)jðh*h-h/hh1}r÷(h5]h6]h4]h3]h7]uh9Kœh#]røhNXvarnishncsa(1)rù…rú}rû(h(jòh)jõubaubaubj<)rü}rý(h(Xvarnishstat(1)rþh)jÔh*h-h/j@h1}rÿ(h5]h6]h4]h3]h7]uh9Nh:hh#]rh|)r}r(h(jþh)jüh*h-h/hh1}r(h5]h6]h4]h3]h7]uh9Kh#]rhNXvarnishstat(1)r…r}r(h(jþh)jubaubaubj<)r}r (h(Xvarnishtop(1) h)jÔh*h-h/j@h1}r (h5]h6]h4]h3]h7]uh9Nh:hh#]r h|)r }r (h(X varnishtop(1)rh)jh*h-h/hh1}r(h5]h6]h4]h3]h7]uh9Kžh#]rhNX varnishtop(1)r…r}r(h(jh)j ubaubaubeubeubh;)r}r(h(Uh)hRh*h-h/h@h1}r(h5]h6]h4]h3]rh!ah7]rhauh9K¡h:hh#]r(hG)r}r(h(XHISTORYrh)jh*h-h/hKh1}r(h5]h6]h4]h3]h7]uh9K¡h:hh#]rhNXHISTORYr…r }r!(h(jh)jubaubh|)r"}r#(h(XâThe varnishlog utility was developed by Poul-Henning Kamp ⟨phk@phk.freebsd.dk⟩ in cooperation with Verdens Gang AS, Varnish Software AS and Varnish Software. This manual page was initially written by Dag-Erling Smørgrav.h)jh*h-h/hh1}r$(h5]h6]h4]h3]h7]uh9K£h:hh#]r%(hNX=The varnishlog utility was developed by Poul-Henning Kamp ⟨r&…r'}r((h(X=The varnishlog utility was developed by Poul-Henning Kamp ⟨h)j"ubhù)r)}r*(h(Xphk@phk.freebsd.dkh1}r+(UrefuriXmailto:phk@phk.freebsd.dkh3]h4]h5]h6]h7]uh)j"h#]r,hNXphk@phk.freebsd.dkr-…r.}r/(h(Uh)j)ubah/jubhNX“⟩ in cooperation with Verdens Gang AS, Varnish Software AS and Varnish Software. This manual page was initially written by Dag-Erling Smørgrav.r0…r1}r2(h(X“⟩ in cooperation with Verdens Gang AS, Varnish Software AS and Varnish Software. This manual page was initially written by Dag-Erling Smørgrav.h)j"ubeubeubh;)r3}r4(h(Uh)hRh*h-h/h@h1}r5(h5]h6]h4]h3]r6hah7]r7hauh9K¨h:hh#]r8(hG)r9}r:(h(X COPYRIGHTr;h)j3h*h-h/hKh1}r<(h5]h6]h4]h3]h7]uh9K¨h:hh#]r=hNX COPYRIGHTr>…r?}r@(h(j;h)j9ubaubh|)rA}rB(h(X\This document is licensed under the same licence as Varnish itself. See LICENCE for details.rCh)j3h*h-h/hh1}rD(h5]h6]h4]h3]h7]uh9Kªh:hh#]rEhNX\This document is licensed under the same licence as Varnish itself. See LICENCE for details.rF…rG}rH(h(jCh)jAubaubj5)rI}rJ(h(Uh)j3h*h-h/j8h1}rK(j:X*h3]h4]h5]h6]h7]uh9K­h:hh#]rL(j<)rM}rN(h(X"Copyright (c) 2006 Verdens Gang ASrOh)jIh*h-h/j@h1}rP(h5]h6]h4]h3]h7]uh9Nh:hh#]rQh|)rR}rS(h(jOh)jMh*h-h/hh1}rT(h5]h6]h4]h3]h7]uh9K­h#]rUhNX"Copyright (c) 2006 Verdens Gang ASrV…rW}rX(h(jOh)jRubaubaubj<)rY}rZ(h(X+Copyright (c) 2006-2011 Varnish Software ASr[h)jIh*h-h/j@h1}r\(h5]h6]h4]h3]h7]uh9Nh:hh#]r]h|)r^}r_(h(j[h)jYh*h-h/hh1}r`(h5]h6]h4]h3]h7]uh9K®h#]rahNX+Copyright (c) 2006-2011 Varnish Software ASrb…rc}rd(h(j[h)j^ubaubaubeubeubeubeubeh(UU transformerreNU footnote_refsrf}rgUrefnamesrh}riUsymbol_footnotesrj]rkUautofootnote_refsrl]rmUsymbol_footnote_refsrn]roU citationsrp]rqh:hU current_linerrNUtransform_messagesrs]rtcdocutils.nodes system_message ru)rv}rw(h(Uh1}rx(h5]UlevelKh3]h4]Usourceh-h6]h7]UlineKUtypeUINFOryuh#]rzh|)r{}r|(h(Uh1}r}(h5]h6]h4]h3]h7]uh)jvh#]r~hNX4Hyperlink target "ref-varnishlog" is not referenced.r…r€}r(h(Uh)j{ubah/hubah/Usystem_messager‚ubaUreporterrƒNUid_startr„KU autofootnotesr…]r†U citation_refsr‡}rˆUindirect_targetsr‰]rŠUsettingsr‹(cdocutils.frontend Values rŒor}rŽ(Ufootnote_backlinksrKUrecord_dependenciesrNU rfc_base_urlr‘Uhttp://tools.ietf.org/html/r’U tracebackr“ˆUpep_referencesr”NUstrip_commentsr•NU toc_backlinksr–Uentryr—U language_coder˜Uenr™U datestampršNU report_levelr›KU _destinationrœNU halt_levelrKU strip_classesržNhKNUerror_encoding_error_handlerrŸUbackslashreplacer Udebugr¡NUembed_stylesheetr¢‰Uoutput_encoding_error_handlerr£Ustrictr¤U sectnum_xformr¥KUdump_transformsr¦NU docinfo_xformr§KUwarning_streamr¨NUpep_file_url_templater©Upep-%04drªUexit_status_levelr«KUconfigr¬NUstrict_visitorr­NUcloak_email_addressesr®ˆUtrim_footnote_reference_spacer¯‰Uenvr°NUdump_pseudo_xmlr±NUexpose_internalsr²NUsectsubtitle_xformr³‰U source_linkr´NUrfc_referencesrµNUoutput_encodingr¶Uutf-8r·U source_urlr¸NUinput_encodingr¹U utf-8-sigrºU_disable_configr»NU id_prefixr¼UU tab_widthr½KUerror_encodingr¾UUTF-8r¿U_sourcerÀU8/home/tfheen/varnish/doc/sphinx/reference/varnishlog.rstrÁUgettext_compactrˆU generatorrÃNUdump_internalsrÄNU smart_quotesrʼnU pep_base_urlrÆUhttp://www.python.org/dev/peps/rÇUsyntax_highlightrÈUlongrÉUinput_encoding_error_handlerrÊj¤Uauto_id_prefixrËUidrÌUdoctitle_xformr͉Ustrip_elements_with_classesrÎNU _config_filesrÏ]rÐUfile_insertion_enabledrÑKU raw_enabledrÒKU dump_settingsrÓNubUsymbol_footnote_startrÔKUidsrÕ}rÖ(h jÆhhRhjhj3hjhhhh0hh!h#Utitleq?h%}q@(h)]h*]h(]h']h+]uh-Kh.hh]qAcdocutils.nodes Text qBXShared Memory LoggingqC…qD}qE(hh>hhh.hh]q¸hBX3U F E 182 159 80 80 1392 G F E 159 173 80 1304 1314q¹…qº}q»(hUhhµubaubeubeubehUU transformerq¼NU footnote_refsq½}q¾Urefnamesq¿}qÀUsymbol_footnotesqÁ]qÂUautofootnote_refsqÃ]qÄUsymbol_footnote_refsqÅ]qÆU citationsqÇ]qÈh.hU current_lineqÉNUtransform_messagesqÊ]qËcdocutils.nodes system_message qÌ)qÍ}qÎ(hUh%}qÏ(h)]UlevelKh']h(]Usourceh!h*]h+]UlineKUtypeUINFOqÐuh]qÑhT)qÒ}qÓ(hUh%}qÔ(h)]h*]h(]h']h+]uhhÍh]qÕhBX3Hyperlink target "reference-vsl" is not referenced.qÖ…q×}qØ(hUhhÒubah#hXubah#Usystem_messageqÙubaUreporterqÚNUid_startqÛKU autofootnotesqÜ]qÝU citation_refsqÞ}qßUindirect_targetsqà]qáUsettingsqâ(cdocutils.frontend Values qãoqä}qå(Ufootnote_backlinksqæKUrecord_dependenciesqçNU rfc_base_urlqèUhttp://tools.ietf.org/html/qéU tracebackqêˆUpep_referencesqëNUstrip_commentsqìNU toc_backlinksqíUentryqîU language_codeqïUenqðU datestampqñNU report_levelqòKU _destinationqóNU halt_levelqôKU strip_classesqõNh?NUerror_encoding_error_handlerqöUbackslashreplaceq÷UdebugqøNUembed_stylesheetqù‰Uoutput_encoding_error_handlerqúUstrictqûU sectnum_xformqüKUdump_transformsqýNU docinfo_xformqþKUwarning_streamqÿNUpep_file_url_templaterUpep-%04drUexit_status_levelrKUconfigrNUstrict_visitorrNUcloak_email_addressesrˆUtrim_footnote_reference_spacer‰UenvrNUdump_pseudo_xmlrNUexpose_internalsr NUsectsubtitle_xformr ‰U source_linkr NUrfc_referencesr NUoutput_encodingr Uutf-8rU source_urlrNUinput_encodingrU utf-8-sigrU_disable_configrNU id_prefixrUU tab_widthrKUerror_encodingrUUTF-8rU_sourcerU1/home/tfheen/varnish/doc/sphinx/reference/vsl.rstrUgettext_compactrˆU generatorrNUdump_internalsrNU smart_quotesr‰U pep_base_urlrUhttp://www.python.org/dev/peps/rUsyntax_highlightrUlongr Uinput_encoding_error_handlerr!hûUauto_id_prefixr"Uidr#Udoctitle_xformr$‰Ustrip_elements_with_classesr%NU _config_filesr&]r'Ufile_insertion_enabledr(KU raw_enabledr)KU dump_settingsr*NubUsymbol_footnote_startr+KUidsr,}r-(hh0hh0hhFhhˆuUsubstitution_namesr.}r/h#h.h%}r0(h)]h']h(]Usourceh!h*]h+]uU footnotesr1]r2Urefidsr3}r4h]r5hasub.varnish-3.0.5/doc/sphinx/=build/doctrees/glossary/0000755000175000017500000000000012247037213017120 500000000000000varnish-3.0.5/doc/sphinx/=build/doctrees/glossary/index.doctree0000644000175000017500000005125212247037213021523 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(XglossaryqˆXvarnish glossaryqNuUsubstitution_defsq}q Uparse_messagesq ]q Ucurrent_sourceq NU decorationq NUautofootnote_startqKUnameidsq}q(hUglossaryqhUvarnish-glossaryquUchildrenq]q(cdocutils.nodes target q)q}q(U rawsourceqX .. _glossary:UparentqhUsourceqcdocutils.nodes reprunicode qX2/home/tfheen/varnish/doc/sphinx/glossary/index.rstq…q}qbUtagnameqUtargetq U attributesq!}q"(Uidsq#]Ubackrefsq$]Udupnamesq%]Uclassesq&]Unamesq']Urefidq(huUlineq)KUdocumentq*hh]ubcdocutils.nodes section q+)q,}q-(hUhhhhUexpect_referenced_by_nameq.}q/hhshUsectionq0h!}q1(h%]h&]h$]h#]q2(hheh']q3(hheuh)Kh*hUexpect_referenced_by_idq4}q5hhsh]q6(cdocutils.nodes title q7)q8}q9(hXVarnish Glossaryq:hh,hhhUtitleq;h!}q<(h%]h&]h$]h#]h']uh)Kh*hh]q=cdocutils.nodes Text q>XVarnish Glossaryq?…q@}qA(hh:hh8ubaubcsphinx.addnodes glossary qB)qC}qD(hUhh,hhhUglossaryqEh!}qF(h%]h&]h$]h#]h']uh)Nh*hh]qGcdocutils.nodes definition_list qH)qI}qJ(hUhhChhhUdefinition_listqKh!}qL(h%]h&]qMhEah$]h#]h']uh)Nh*hh]qN(cdocutils.nodes definition_list_item qO)qP}qQ(hUh!}qR(h%]h&]h$]h#]h']uhhIh]qS(cdocutils.nodes term qT)qU}qV(hUh!}qW(h%]h&]h$]h#]qXUterm-qYah']qZhYauhhPh]q[(csphinx.addnodes index q\)q]}q^(hUh!}q_(h#]h$]h%]h&]h']Uentriesq`]qa(UsingleqbX..qchYUmainqdtqeauhhUh]hUindexqfubh>X..qg…qh}qi(hX..hhUubehUtermqjubcdocutils.nodes definition qk)ql}qm(hUh!}qn(h%]h&]h$]h#]h']uhhPh]qocdocutils.nodes paragraph qp)qq}qr(hXThis file will be sorted automagically during formatting, so we keep the source in subject order to make sure we cover all bases.qshhlhhhU paragraphqth!}qu(h%]h&]h$]h#]h']uh)K h]qvh>XThis file will be sorted automagically during formatting, so we keep the source in subject order to make sure we cover all bases.qw…qx}qy(hhshhqubaubahU definitionqzubehUdefinition_list_itemq{ubhO)q|}q}(hUh!}q~(h%]h&]h$]h#]h']uhhIh]q(hT)q€}q(hUh!}q‚(h%]h&]h$]h#]qƒU term-backendq„ah']q…h„auhh|h]q†(h\)q‡}qˆ(hUh!}q‰(h#]h$]h%]h&]h']h`]qŠ(hbXbackendq‹h„hdtqŒauhh€h]hhfubh>Xbackendq…qŽ}q(hXbackendhh€ubehhjubhk)q}q‘(hUh!}q’(h%]h&]h$]h#]h']uhh|h]q“hp)q”}q•(hX¾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.q–hhhhhhth!}q—(h%]h&]h$]h#]h']uh)K#h]q˜h>X¾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.q™…qš}q›(hh–hh”ubaubahhzubehh{ubhO)qœ}q(hUh!}qž(h%]h&]h$]h#]h']uhhIh]qŸ(hT)q }q¡(hUh!}q¢(h%]h&]h$]h#]q£Uterm-backend-responseq¤ah']q¥h¤auhhœh]q¦(h\)q§}q¨(hUh!}q©(h#]h$]h%]h&]h']h`]qª(hbXbackend responseq«h¤hdtq¬auhh h]hhfubh>Xbackend responseq­…q®}q¯(hXbackend responsehh ubehhjubhk)q°}q±(hUh!}q²(h%]h&]h$]h#]h']uhhœh]q³hp)q´}qµ(hXrThe response specifically served from a backend to varnishd. The backend response may be manipulated in vcl_fetch.q¶hh°hhhhth!}q·(h%]h&]h$]h#]h']uh)KOh]q¸h>XrThe response specifically served from a backend to varnishd. The backend response may be manipulated in vcl_fetch.q¹…qº}q»(hh¶hh´ubaubahhzubehh{ubhO)q¼}q½(hUh!}q¾(h%]h&]h$]h#]h']uhhIh]q¿(hT)qÀ}qÁ(hUh!}qÂ(h%]h&]h$]h#]qÃU term-bodyqÄah']qÅhÄauhh¼h]qÆ(h\)qÇ}qÈ(hUh!}qÉ(h#]h$]h%]h&]h']h`]qÊ(hbXbodyqËhÄhdtqÌauhhÀh]hhfubh>XbodyqÍ…qÎ}qÏ(hXbodyhhÀubehhjubhk)qÐ}qÑ(hUh!}qÒ(h%]h&]h$]h#]h']uhh¼h]qÓhp)qÔ}qÕ(hX™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.qÖhhÐhhhhth!}q×(h%]h&]h$]h#]h']uh)KTh]qØh>X™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.qÙ…qÚ}qÛ(hhÖhhÔubaubahhzubehh{ubhO)qÜ}qÝ(hUh!}qÞ(h%]h&]h$]h#]h']uhhIh]qß(hT)qà}qá(hUh!}qâ(h%]h&]h$]h#]qãU term-clientqäah']qåhäauhhÜh]qæ(h\)qç}qè(hUh!}qé(h#]h$]h%]h&]h']h`]qê(hbXclientqëhähdtqìauhhàh]hhfubh>Xclientqí…qî}qï(hXclienthhàubehhjubhk)qð}qñ(hUh!}qò(h%]h&]h$]h#]h']uhhÜh]qóhp)qô}qõ(hX”The program which sends varnishd a HTTP request, typically a browser, but do not forget to think about spiders, robots script-kiddies and criminals.qöhhðhhhhth!}q÷(h%]h&]h$]h#]h']uh)K)h]qøh>X”The program which sends varnishd a HTTP request, typically a browser, but do not forget to think about spiders, robots script-kiddies and criminals.qù…qú}qû(hhöhhôubaubahhzubehh{ubhO)qü}qý(hUh!}qþ(h%]h&]h$]h#]h']uhhIh]qÿ(hT)r}r(hUh!}r(h%]h&]h$]h#]rU term-headerrah']rjauhhüh]r(h\)r}r(hUh!}r (h#]h$]h%]h&]h']h`]r (hbXheaderr jhdtr auhjh]hhfubh>Xheaderr …r}r(hXheaderhjubehhjubhk)r}r(hUh!}r(h%]h&]h$]h#]h']uhhüh]rhp)r}r(hX0A HTTP protocol header, like "Accept-Encoding:".rhjhhhhth!}r(h%]h&]h$]h#]h']uh)KDh]rh>X0A HTTP protocol header, like "Accept-Encoding:".r…r}r(hjhjubaubahhzubehh{ubhO)r}r(hUh!}r(h%]h&]h$]h#]h']uhhIh]r(hT)r }r!(hUh!}r"(h%]h&]h$]h#]r#Uterm-hitr$ah']r%j$auhjh]r&(h\)r'}r((hUh!}r)(h#]h$]h%]h&]h']h`]r*(hbXhitr+j$hdtr,auhj h]hhfubh>Xhitr-…r.}r/(hXhithj ubehhjubhk)r0}r1(hUh!}r2(h%]h&]h$]h#]h']uhjh]r3hp)r4}r5(hX&An object Varnish delivers from cache.r6hj0hhhhth!}r7(h%]h&]h$]h#]h']uh)Khh]r8h>X&An object Varnish delivers from cache.r9…r:}r;(hj6hj4ubaubahhzubehh{ubhO)r<}r=(hUh!}r>(h%]h&]h$]h#]h']uhhIh]r?(hT)r@}rA(hUh!}rB(h%]h&]h$]h#]rCUterm-master-processrDah']rEjDauhj<h]rF(h\)rG}rH(hUh!}rI(h#]h$]h%]h&]h']h`]rJ(hbXmaster (process)rKjDhdtrLauhj@h]hhfubh>Xmaster (process)rM…rN}rO(hXmaster (process)hj@ubehhjubhk)rP}rQ(hUh!}rR(h%]h&]h$]h#]h']uhj<h]rShp)rT}rU(hXÙOne of the two processes in the varnishd program. The master proces is a manager/nanny process which handles configuration, parameters, compilation of :term:VCL etc. but it does never get near the actual HTTP traffic.rVhjPhhhhth!}rW(h%]h&]h$]h#]h']uh)Kh]rXh>XÙOne of the two processes in the varnishd program. The master proces is a manager/nanny process which handles configuration, parameters, compilation of :term:VCL etc. but it does never get near the actual HTTP traffic.rY…rZ}r[(hjVhjTubaubahhzubehh{ubhO)r\}r](hUh!}r^(h%]h&]h$]h#]h']uhhIh]r_(hT)r`}ra(hUh!}rb(h%]h&]h$]h#]rcU term-missrdah']rejdauhj\h]rf(h\)rg}rh(hUh!}ri(h#]h$]h%]h&]h']h`]rj(hbXmissrkjdhdtrlauhj`h]hhfubh>Xmissrm…rn}ro(hXmisshj`ubehhjubhk)rp}rq(hUh!}rr(h%]h&]h$]h#]h']uhj\h]rshp)rt}ru(hX‹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.rvhjphhhhth!}rw(h%]h&]h$]h#]h']uh)Kkh]rxh>X‹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.ry…rz}r{(hjvhjtubaubahhzubehh{ubhO)r|}r}(hUh!}r~(h%]h&]h$]h#]h']uhhIh]r(hT)r€}r(hUh!}r‚(h%]h&]h$]h#]rƒU term-objectr„ah']r…j„auhj|h]r†(h\)r‡}rˆ(hUh!}r‰(h#]h$]h%]h&]h']h`]rŠ(hbXobjectr‹j„hdtrŒauhj€h]hhfubh>Xobjectr…rŽ}r(hXobjecthj€ubehhjubhk)r}r‘(hUh!}r’(h%]h&]h$]h#]h']uhj|h]r“hp)r”}r•(hXThe (possibly) cached version of a backend response. Varnishd receives a reponse 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.r–hjhhhhth!}r—(h%]h&]h$]h#]h']uh)KYh]r˜h>XThe (possibly) cached version of a backend response. Varnishd receives a reponse 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.r™…rš}r›(hj–hj”ubaubahhzubehh{ubhO)rœ}r(hUh!}rž(h%]h&]h$]h#]h']uhhIh]rŸ(hT)r }r¡(hUh!}r¢(h%]h&]h$]h#]r£U term-passr¤ah']r¥j¤auhjœh]r¦(h\)r§}r¨(hUh!}r©(h#]h$]h%]h&]h']h`]rª(hbXpassr«j¤hdtr¬auhj h]hhfubh>Xpassr­…r®}r¯(hXpasshj ubehhjubhk)r°}r±(hUh!}r²(h%]h&]h$]h#]h']uhjœh]r³hp)r´}rµ(hXeAn object Varnish does not try to cache, but simply fetches from the backend and hands to the client.r¶hj°hhhhth!}r·(h%]h&]h$]h#]h']uh)Kph]r¸h>XeAn object Varnish does not try to cache, but simply fetches from the backend and hands to the client.r¹…rº}r»(hj¶hj´ubaubahhzubehh{ubhO)r¼}r½(hUh!}r¾(h%]h&]h$]h#]h']uhhIh]r¿(hT)rÀ}rÁ(hUh!}rÂ(h%]h&]h$]h#]rÃU term-piperÄah']rÅjÄauhj¼h]rÆ(h\)rÇ}rÈ(hUh!}rÉ(h#]h$]h%]h&]h']h`]rÊ(hbXpiperËjÄhdtrÌauhjÀh]hhfubh>XpiperÍ…rÎ}rÏ(hXpipehjÀubehhjubhk)rÐ}rÑ(hUh!}rÒ(h%]h&]h$]h#]h']uhj¼h]rÓhp)rÔ}rÕ(hXfVarnish just moves the bytes between client and backend, it does not try to understand what they mean.rÖhjÐhhhhth!}r×(h%]h&]h$]h#]h']uh)Kth]rØh>XfVarnish just moves the bytes between client and backend, it does not try to understand what they mean.rÙ…rÚ}rÛ(hjÖhjÔubaubahhzubehh{ubhO)rÜ}rÝ(hUh!}rÞ(h%]h&]h$]h#]h']uhhIh]rß(hT)rà}rá(hUh!}râ(h%]h&]h$]h#]rãU term-requesträah']råjäauhjÜh]ræ(h\)rç}rè(hUh!}ré(h#]h$]h%]h&]h']h`]rê(hbXrequestrëjähdtrìauhjàh]hhfubh>Xrequestrí…rî}rï(hXrequesthjàubehhjubhk)rð}rñ(hUh!}rò(h%]h&]h$]h#]h']uhjÜh]róhp)rô}rõ(hXDWhat the client sends to varnishd and varnishd sends to the backend.röhjðhhhhth!}r÷(h%]h&]h$]h#]h']uh)KGh]røh>XDWhat the client sends to varnishd and varnishd sends to the backend.rù…rú}rû(hjöhjôubaubahhzubehh{ubhO)rü}rý(hUh!}rþ(h%]h&]h$]h#]h']uhhIh]rÿ(hT)r}r(hUh!}r(h%]h&]h$]h#]rU term-responserah']rjauhjüh]r(h\)r}r(hUh!}r (h#]h$]h%]h&]h']h`]r (hbXresponser jhdtr auhjh]hhfubh>Xresponser …r}r(hXresponsehjubehhjubhk)r}r(hUh!}r(h%]h&]h$]h#]h']uhjüh]rhp)r}r(hXWhat 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.rhjhhhhth!}r(h%]h&]h$]h#]h']uh)KJh]rh>XWhat 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.r…r}r(hjhjubaubahhzubehh{ubhO)r}r(hUh!}r(h%]h&]h$]h#]h']uhhIh]r(hT)r }r!(hUh!}r"(h%]h&]h$]h#]r#Uterm-varnishd-nb-with-dr$ah']r%j$auhjh]r&(h\)r'}r((hUh!}r)(h#]h$]h%]h&]h']h`]r*(hbXvarnishd (NB: with 'd')j$hdtr+auhj h]hhfubh>Xvarnishd (NB: with 'd')r,…r-}r.(hXvarnishd (NB: with 'd')hj ubehhjubhk)r/}r0(hUh!}r1(h%]h&]h$]h#]h']uhjh]r2hp)r3}r4(hX¥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").hj/hhhhth!}r5(h%]h&]h$]h#]h']uh)Kh]r6(h>XhThis is the actual Varnish cache program. There is only one program, but when you run it, you will get r7…r8}r9(hXhThis is the actual Varnish cache program. There is only one program, but when you run it, you will get hj3ubcdocutils.nodes emphasis r:)r;}r<(hX*two*h!}r=(h%]h&]h$]h#]h']uhj3h]r>h>Xtwor?…r@}rA(hUhj;ubahUemphasisrBubh>X8 processes: The "master" and the "worker" (or "child").rC…rD}rE(hX8 processes: The "master" and the "worker" (or "child").hj3ubeubahhzubehh{ubhO)rF}rG(hUh!}rH(h%]h&]h$]h#]h']uhhIh]rI(hT)rJ}rK(hUh!}rL(h%]h&]h$]h#]rMUterm-varnishhistrNah']rOjNauhjFh]rP(h\)rQ}rR(hUh!}rS(h#]h$]h%]h&]h']h`]rT(hbX varnishhistrUjNhdtrVauhjJh]hhfubh>X varnishhistrW…rX}rY(hX varnishhisthjJubehhjubhk)rZ}r[(hUh!}r\(h%]h&]h$]h#]h']uhjFh]r]hp)r^}r_(hXLEye-candy program showing responsetime histogram in 1980ies ASCII-art style.r`hjZhhhhth!}ra(h%]h&]h$]h#]h']uh)K:h]rbh>XLEye-candy program showing responsetime histogram in 1980ies ASCII-art style.rc…rd}re(hj`hj^ubaubahhzubehh{ubhO)rf}rg(hUh!}rh(h%]h&]h$]h#]h']uhhIh]ri(hT)rj}rk(hUh!}rl(h%]h&]h$]h#]rmUterm-varnishlogrnah']rojnauhjfh]rp(h\)rq}rr(hUh!}rs(h#]h$]h%]h&]h']h`]rt(hbX varnishlogrujnhdtrvauhjjh]hhfubh>X varnishlogrw…rx}ry(hX varnishloghjjubehhjubhk)rz}r{(hUh!}r|(h%]h&]h$]h#]h']uhjfh]r}hp)r~}r(hX@Program which presents varnish transaction log in native format.r€hjzhhhhth!}r(h%]h&]h$]h#]h']uh)K1h]r‚h>X@Program which presents varnish transaction log in native format.rƒ…r„}r…(hj€hj~ubaubahhzubehh{ubhO)r†}r‡(hUh!}rˆ(h%]h&]h$]h#]h']uhhIh]r‰(hT)rŠ}r‹(hUh!}rŒ(h%]h&]h$]h#]rUterm-varnishncsarŽah']rjŽauhj†h]r(h\)r‘}r’(hUh!}r“(h#]h$]h%]h&]h']h`]r”(hbX varnishncsar•jŽhdtr–auhjŠh]hhfubh>X varnishncsar—…r˜}r™(hX varnishncsahjŠubehhjubhk)rš}r›(hUh!}rœ(h%]h&]h$]h#]h']uhj†h]rhp)rž}rŸ(hX@Program which presents varnish transaction log in "NCSA" format.r hjšhhhhth!}r¡(h%]h&]h$]h#]h']uh)K7h]r¢h>X@Program which presents varnish transaction log in "NCSA" format.r£…r¤}r¥(hj hjžubaubahhzubehh{ubhO)r¦}r§(hUh!}r¨(h%]h&]h$]h#]h']uhhIh]r©(hT)rª}r«(hUh!}r¬(h%]h&]h$]h#]r­Uterm-varnishstatr®ah']r¯j®auhj¦h]r°(h\)r±}r²(hUh!}r³(h#]h$]h%]h&]h']h`]r´(hbX varnishstatrµj®hdtr¶auhjªh]hhfubh>X varnishstatr·…r¸}r¹(hX varnishstathjªubehhjubhk)rº}r»(hUh!}r¼(h%]h&]h$]h#]h']uhj¦h]r½hp)r¾}r¿(hX3Program which presents varnish statistics counters.rÀhjºhhhhth!}rÁ(h%]h&]h$]h#]h']uh)K.h]rÂh>X3Program which presents varnish statistics counters.rÃ…rÄ}rÅ(hjÀhj¾ubaubahhzubehh{ubhO)rÆ}rÇ(hUh!}rÈ(h%]h&]h$]h#]h']uhhIh]rÉ(hT)rÊ}rË(hUh!}rÌ(h%]h&]h$]h#]rÍUterm-varnishtestrÎah']rÏjÎauhjÆh]rÐ(h\)rÑ}rÒ(hUh!}rÓ(h#]h$]h%]h&]h']h`]rÔ(hbX varnishtestrÕjÎhdtrÖauhjÊh]hhfubh>X varnishtestr×…rØ}rÙ(hX varnishtesthjÊubehhjubhk)rÚ}rÛ(hUh!}rÜ(h%]h&]h$]h#]h']uhjÆh]rÝhp)rÞ}rß(hXbProgram to test varnishd's behaviour with, simulates backend and client according to test-scripts.ràhjÚhhhhth!}rá(h%]h&]h$]h#]h']uh)K>h]râh>XbProgram to test varnishd's behaviour with, simulates backend and client according to test-scripts.rã…rä}rå(hjàhjÞubaubahhzubehh{ubhO)ræ}rç(hUh!}rè(h%]h&]h$]h#]h']uhhIh]ré(hT)rê}rë(hUh!}rì(h%]h&]h$]h#]ríUterm-varnishtoprîah']rïjîauhjæh]rð(h\)rñ}rò(hUh!}ró(h#]h$]h%]h&]h']h`]rô(hbX varnishtoprõjîhdtröauhjêh]hhfubh>X varnishtopr÷…rø}rù(hX varnishtophjêubehhjubhk)rú}rû(hUh!}rü(h%]h&]h$]h#]h']uhjæh]rýhp)rþ}rÿ(hXCProgram which gives real-time "top-X" list view of transaction log.rhjúhhhhth!}r(h%]h&]h$]h#]h']uh)K4h]rh>XCProgram which gives real-time "top-X" list view of transaction log.r…r}r(hjhjþubaubahhzubehh{ubhO)r}r(hUh!}r(h%]h&]h$]h#]h']uhhIh]r (hT)r }r (hUh!}r (h%]h&]h$]h#]r Uterm-vclrah']rjauhjh]r(h\)r}r(hUh!}r(h#]h$]h%]h&]h']h`]r(hbXVCLjhdtrauhj h]hhfubh>XVCLr…r}r(hXVCLhj ubehhjubhk)r}r(hUh!}r(h%]h&]h$]h#]h']uhjh]rhp)r}r(hXcVarnish Configuration Language, a small specialized language for instructing Varnish how to behave.rhjhhhhth!}r (h%]h&]h$]h#]h']uh)Kbh]r!h>XcVarnish Configuration Language, a small specialized language for instructing Varnish how to behave.r"…r#}r$(hjhjubaubahhzubehh{ubhO)r%}r&(hUh!}r'(h%]h&]h$]h#]h']uhhIh]r((hT)r)}r*(hUh!}r+(h%]h&]h$]h#]r,Uterm-worker-processr-ah']r.j-auhj%h]r/(h\)r0}r1(hUh!}r2(h#]h$]h%]h&]h']h`]r3(hbXworker (process)r4j-hdtr5auhj)h]hhfubh>Xworker (process)r6…r7}r8(hXworker (process)hj)ubehhjubhk)r9}r:(hUh!}r;(h%]h&]h$]h#]h']uhj%h]r<hp)r=}r>(hXå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.r?hj9hhhhth!}r@(h%]h&]h$]h#]h']uh)Kh]rAh>Xå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.rB…rC}rD(hj?hj=ubaubahhzubehh{ubeubaubeubehUU transformerrENU footnote_refsrF}rGUrefnamesrH}rIUsymbol_footnotesrJ]rKUautofootnote_refsrL]rMUsymbol_footnote_refsrN]rOU citationsrP]rQh*hU current_linerRNUtransform_messagesrS]rTcdocutils.nodes system_message rU)rV}rW(hUh!}rX(h%]UlevelKh#]h$]Usourcehh&]h']UlineKUtypeUINFOrYuh]rZhp)r[}r\(hUh!}r](h%]h&]h$]h#]h']uhjVh]r^h>X.Hyperlink target "glossary" is not referenced.r_…r`}ra(hUhj[ubahhtubahUsystem_messagerbubaUreporterrcNUid_startrdKU autofootnotesre]rfU citation_refsrg}rhUindirect_targetsri]rjUsettingsrk(cdocutils.frontend Values rlorm}rn(Ufootnote_backlinksroKUrecord_dependenciesrpNU rfc_base_urlrqUhttp://tools.ietf.org/html/rrU tracebackrsˆUpep_referencesrtNUstrip_commentsruNU toc_backlinksrvUentryrwU language_coderxUenryU datestamprzNU report_levelr{KU _destinationr|NU halt_levelr}KU strip_classesr~Nh;NUerror_encoding_error_handlerrUbackslashreplacer€UdebugrNUembed_stylesheetr‚‰Uoutput_encoding_error_handlerrƒUstrictr„U sectnum_xformr…KUdump_transformsr†NU docinfo_xformr‡KUwarning_streamrˆNUpep_file_url_templater‰Upep-%04drŠUexit_status_levelr‹KUconfigrŒNUstrict_visitorrNUcloak_email_addressesrŽˆUtrim_footnote_reference_spacer‰UenvrNUdump_pseudo_xmlr‘NUexpose_internalsr’NUsectsubtitle_xformr“‰U source_linkr”NUrfc_referencesr•NUoutput_encodingr–Uutf-8r—U source_urlr˜NUinput_encodingr™U utf-8-sigršU_disable_configr›NU id_prefixrœUU tab_widthrKUerror_encodingržUUTF-8rŸU_sourcer U2/home/tfheen/varnish/doc/sphinx/glossary/index.rstr¡Ugettext_compactr¢ˆU generatorr£NUdump_internalsr¤NU smart_quotesr¥‰U pep_base_urlr¦Uhttp://www.python.org/dev/peps/r§Usyntax_highlightr¨Ulongr©Uinput_encoding_error_handlerrªj„Uauto_id_prefixr«Uidr¬Udoctitle_xformr­‰Ustrip_elements_with_classesr®NU _config_filesr¯]Ufile_insertion_enabledr°KU raw_enabledr±KU dump_settingsr²NubUsymbol_footnote_startr³KUidsr´}rµ(hh,hh,uUsubstitution_namesr¶}r·hh*h!}r¸(h%]h#]h$]Usourcehh&]h']uU footnotesr¹]rºUrefidsr»}r¼h]r½hasub.varnish-3.0.5/doc/sphinx/=build/doctrees/environment.pickle0000644000175000017500000045423612247037213020750 00000000000000€(csphinx.environment BuildEnvironment qoq}q(Udlfilesqcsphinx.util FilenameUniqDict q)qc__builtin__ set q]…RqbUappq NU _warnfuncq NUtitlesq }q (Ureference/vmod_stdq cdocutils.nodes title q)q}q(U rawsourceqUU attributesq}q(Udupnamesq]Uclassesq]Ubackrefsq]Uidsq]Unamesq]uUchildrenq]qcdocutils.nodes Text qXvmod_stdq…q}q(hXvmod_stdqUparentq hubaUtagnameq!Utitleq"ubUinstallation/bugsq#h)q$}q%(hUh}q&(h]h]h]h]h]uh]q'hXReporting bugsq(…q)}q*(hXReporting bugsq+h h$ubah!h"ubU phk/barriersq,h)q-}q.(hUh}q/(h]h]h]h]h]uh]q0hXSecurity barriers in Varnishq1…q2}q3(hXSecurity barriers in Varnishq4h h-ubah!h"ubUreference/varnishncsaq5h)q6}q7(hUh}q8(h]h]h]h]h]uh]q9hX varnishncsaq:…q;}q<(hX varnishncsaq=h h6ubah!h"ubU reference/vslq>h)q?}q@(hUh}qA(h]h]h]h]h]uh]qBhXShared Memory LoggingqC…qD}qE(hXShared Memory LoggingqFh h?ubah!h"ubUphk/gzipqGh)qH}qI(hUh}qJ(h]h]h]h]h]uh]qKhX'How GZIP, and GZIP+ESI works in VarnishqL…qM}qN(hX'How GZIP, and GZIP+ESI works in VarnishqOh hHubah!h"ubUphk/three-zeroqPh)qQ}qR(hUh}qS(h]h]h]h]h]uh]qThX"Thoughts on the eve of Varnish 3.0qU…qV}qW(hX"Thoughts on the eve of Varnish 3.0qXh hQubah!h"ubUreference/varnishstatqYh)qZ}q[(hUh}q\(h]h]h]h]h]uh]q]hX varnishstatq^…q_}q`(hX varnishstatqah hZubah!h"ubUreference/varnishtestqbh)qc}qd(hUh}qe(h]h]h]h]h]uh]qfhX varnishtestqg…qh}qi(hX varnishtestqjh hcubah!h"ubU tutorial/vclqkh)ql}qm(hUh}qn(h]h]h]h]h]uh]qohX$Varnish Configuration Language - VCLqp…qq}qr(hX$Varnish Configuration Language - VCLqsh hlubah!h"ubU%tutorial/handling_misbehaving_serversqth)qu}qv(hUh}qw(h]h]h]h]h]uh]qxhXMisbehaving serversqy…qz}q{(hXMisbehaving serversq|h huubah!h"ubUphk/sslq}h)q~}q(hUh}q€(h]h]h]h]h]uh]qhX Why no SSL ?q‚…qƒ}q„(hX Why no SSL ?q…h h~ubah!h"ubUinstallation/installq†h)q‡}qˆ(hUh}q‰(h]h]h]h]h]uh]qŠhXInstalling Varnishq‹…qŒ}q(hXInstalling VarnishqŽh h‡ubah!h"ubU phk/platformsqh)q}q‘(hUh}q’(h]h]h]h]h]uh]q“hXPicking platformsq”…q•}q–(hXPicking platformsq—h hubah!h"ubU tutorial/varyq˜h)q™}qš(hUh}q›(h]h]h]h]h]uh]qœhXVaryq…qž}qŸ(hXVaryq h h™ubah!h"ubUtutorial/compressionq¡h)q¢}q£(hUh}q¤(h]h]h]h]h]uh]q¥hX Compressionq¦…q§}q¨(hX Compressionq©h h¢ubah!h"ubU tutorial/esiqªh)q«}q¬(hUh}q­(h]h]h]h]h]uh]q®hXEdge Side Includesq¯…q°}q±(hXEdge Side Includesq²h h«ubah!h"ubUreference/varnish-cliq³h)q´}qµ(hUh}q¶(h]h]h]h]h]uh]q·hXvarnishq¸…q¹}qº(hXvarnishq»h h´ubah!h"ubUindexq¼h)q½}q¾(hUh}q¿(h]h]h]h]h]uh]qÀhX#Welcome to Varnish's documentation!qÁ…qÂ}qÃ(hX#Welcome to Varnish's documentation!qÄh h½ubah!h"ubUtutorial/purgingqÅh)qÆ}qÇ(hUh}qÈ(h]h]h]h]h]uh]qÉhXPurging and banningqÊ…qË}qÌ(hXPurging and banningqÍh hÆubah!h"ubUtutorial/loggingqÎh)qÏ}qÐ(hUh}qÑ(h]h]h]h]h]uh]qÒhXLogging in VarnishqÓ…qÔ}qÕ(hXLogging in VarnishqÖh hÏubah!h"ubU phk/backendsq×h)qØ}qÙ(hUh}qÚ(h]h]h]h]h]uh]qÛhXWhat do you mean by 'backend' ?qÜ…qÝ}qÞ(hXWhat do you mean by 'backend' ?qßh hØubah!h"ubUtutorial/cookiesqàh)qá}qâ(hUh}qã(h]h]h]h]h]uh]qähXCookiesqå…qæ}qç(hXCookiesqèh háubah!h"ubUinstallation/indexqéh)qê}që(hUh}qì(h]h]h]h]h]uh]qíhXVarnish Installationqî…qï}qð(hXVarnish Installationqñh hêubah!h"ubUtutorial/websocketsqòh)qó}qô(hUh}qõ(h]h]h]h]h]uh]qöhXUsing Websocketsq÷…qø}qù(hXUsing Websocketsqúh hóubah!h"ubUtutorial/troubleshootingqûh)qü}qý(hUh}qþ(h]h]h]h]h]uh]qÿhXTroubleshooting Varnishr…r}r(hXTroubleshooting Varnishrh hüubah!h"ubUtutorial/starting_varnishrh)r}r(hUh}r(h]h]h]h]h]uh]rhXStarting Varnishr …r }r (hXStarting Varnishr h jubah!h"ubUreference/indexr h)r}r(hUh}r(h]h]h]h]h]uh]rhXThe Varnish Reference Manualr…r}r(hXThe Varnish Reference Manualrh jubah!h"ubU phk/sphinxrh)r}r(hUh}r(h]h]h]h]h]uh]r(hXWhy r…r}r(hXWhy rh jubhXSphinxr…r }r!(hUh jubhX and r"…r#}r$(hX and r%h jubhXreStructuredTextr&…r'}r((hUh jubhX ?r)…r*}r+(hX ?r,h jubeh!h"ubUtutorial/sizing_your_cacher-h)r.}r/(hUh}r0(h]h]h]h]h]uh]r1hXSizing your cacher2…r3}r4(hXSizing your cacher5h j.ubah!h"ubUinstallation/upgrader6h)r7}r8(hUh}r9(h]h]h]h]h]uh]r:hX!Upgrading from Varnish 2.1 to 3.0r;…r<}r=(hX!Upgrading from Varnish 2.1 to 3.0r>h j7ubah!h"ubUinstallation/prerequisitesr?h)r@}rA(hUh}rB(h]h]h]h]h]uh]rChX PrerequisitesrD…rE}rF(hX PrerequisitesrGh j@ubah!h"ubUreference/varnishdrHh)rI}rJ(hUh}rK(h]h]h]h]h]uh]rLhXvarnishdrM…rN}rO(hXvarnishdrPh jIubah!h"ubU phk/thoughtsrQh)rR}rS(hUh}rT(h]h]h]h]h]uh]rUhXWhat were they thinking ?rV…rW}rX(hXWhat were they thinking ?rYh jRubah!h"ubUphk/thetoolsweworkwithrZh)r[}r\(hUh}r](h]h]h]h]h]uh]r^hXThe Tools We Work Withr_…r`}ra(hXThe Tools We Work Withrbh j[ubah!h"ubUphk/varnish_does_not_hashrch)rd}re(hUh}rf(h]h]h]h]h]uh]rghXVarnish Does Not Hashrh…ri}rj(hXVarnish Does Not Hashrkh jdubah!h"ubUinstallation/helprlh)rm}rn(hUh}ro(h]h]h]h]h]uh]rphXGetting hold of usrq…rr}rs(hXGetting hold of usrth jmubah!h"ubUtutorial/indexruh)rv}rw(hUh}rx(h]h]h]h]h]uh]ryhX Using Varnishrz…r{}r|(hX Using Varnishr}h jvubah!h"ubUreference/varnishhistr~h)r}r€(hUh}r(h]h]h]h]h]uh]r‚hX varnishhistrƒ…r„}r…(hX varnishhistr†h jubah!h"ubUreference/varnishtopr‡h)rˆ}r‰(hUh}rŠ(h]h]h]h]h]uh]r‹hX varnishtoprŒ…r}rŽ(hX varnishtoprh jˆubah!h"ubU phk/vcl_exprrh)r‘}r’(hUh}r“(h]h]h]h]h]uh]r”hXVCL Expressionsr•…r–}r—(hXVCL Expressionsr˜h j‘ubah!h"ubUtutorial/advanced_topicsr™h)rš}r›(hUh}rœ(h]h]h]h]h]uh]rhXAdvanced topicsrž…rŸ}r (hXAdvanced topicsr¡h jšubah!h"ubUreference/varnishadmr¢h)r£}r¤(hUh}r¥(h]h]h]h]h]uh]r¦hX varnishadmr§…r¨}r©(hX varnishadmrªh j£ubah!h"ubUreference/varnishlogr«h)r¬}r­(hUh}r®(h]h]h]h]h]uh]r¯hX varnishlogr°…r±}r²(hX varnishlogr³h j¬ubah!h"ubUreference/shmemr´h)rµ}r¶(hUh}r·(h]h]h]h]h]uh]r¸hX$Shared Memory Logging and Statisticsr¹…rº}r»(hX$Shared Memory Logging and Statisticsr¼h jµubah!h"ubU phk/autocrapr½h)r¾}r¿(hUh}rÀ(h]h]h]h]h]uh]rÁ(hXDid you call them rÂ…rÃ}rÄ(hXDid you call them rÅh j¾ubcdocutils.nodes emphasis rÆ)rÇ}rÈ(hX *autocrap*rÉh}rÊ(h]h]h]h]h]uh j¾h]rËhXautocraprÌ…rÍ}rÎ(hUh jÇubah!UemphasisrÏubhX tools ?rÐ…rÑ}rÒ(hX tools ?rÓh j¾ubeh!h"ubU!tutorial/advanced_backend_serversrÔh)rÕ}rÖ(hUh}r×(h]h]h]h]h]uh]rØhXAdvanced Backend configurationrÙ…rÚ}rÛ(hXAdvanced Backend configurationrÜh jÕubah!h"ubUtutorial/introductionrÝh)rÞ}rß(hUh}rà(h]h]h]h]h]uh]ráhXWhat is Varnish?râ…rã}rä(hXWhat is Varnish?råh jÞubah!h"ubUglossary/indexræh)rç}rè(hUh}ré(h]h]h]h]h]uh]rêhXVarnish Glossaryrë…rì}rí(hXVarnish Glossaryrîh jçubah!h"ubUreference/vmodrïh)rð}rñ(hUh}rò(h]h]h]h]h]uh]róhXVMOD - Varnish Modulesrô…rõ}rö(hXVMOD - Varnish Modulesr÷h jðubah!h"ubUphk/ipv6suckagerøh)rù}rú(hUh}rû(h]h]h]h]h]uh]rühX IPv6 Suckagerý…rþ}rÿ(hX IPv6 Suckagerh jùubah!h"ubUtutorial/devicedetectionrh)r}r(hUh}r(h]h]h]h]h]uh]rhXDevice detectionr…r}r(hXDevice detectionr h jubah!h"ubUreference/varnishreplayr h)r }r (hUh}r (h]h]h]h]h]uh]rhX varnishreplayr…r}r(hX varnishreplayrh j ubah!h"ubUreference/vcl_varrh)r}r(hUh}r(h]h]h]h]h]uh]rhXbereqr…r}r(hXbereqrh jubah!h"ubU#tutorial/putting_varnish_on_port_80rh)r}r(hUh}r(h]h]h]h]h]uh]r hXPut Varnish on port 80r!…r"}r#(hXPut Varnish on port 80r$h jubah!h"ubUtutorial/statisticsr%h)r&}r'(hUh}r((h]h]h]h]h]uh]r)hX Statisticsr*…r+}r,(hX Statisticsr-h j&ubah!h"ubUtutorial/platformnotesr.h)r/}r0(hUh}r1(h]h]h]h]h]uh]r2hXPlatform specific notesr3…r4}r5(hXPlatform specific notesr6h j/ubah!h"ubUtutorial/backend_serversr7h)r8}r9(hUh}r:(h]h]h]h]h]uh]r;hXBackend serversr<…r=}r>(hXBackend serversr?h j8ubah!h"ubU reference/vclr@h)rA}rB(hUh}rC(h]h]h]h]h]uh]rDhXVCLrE…rF}rG(hXVCLrHh jAubah!h"ubU phk/indexrIh)rJ}rK(hUh}rL(h]h]h]h]h]uh]rMhXPoul-Hennings random outburstsrN…rO}rP(hXPoul-Hennings random outburstsrQh jJubah!h"ubUreference/varnishsizesrRh)rS}rT(hUh}rU(h]h]h]h]h]uh]rVhX varnishsizesrW…rX}rY(hX varnishsizesrZh jSubah!h"ubU tutorial/increasing_your_hitrater[h)r\}r](hUh}r^(h]h]h]h]h]uh]r_hXAchieving a high hitrater`…ra}rb(hXAchieving a high hitraterch j\ubah!h"ubuU domaindatard}re(Ustdrf}rg(UversionrhKU anonlabelsri}rj(Xphk_3.0rkhPUphk-3-0rl†Xtutorial-statisticsrmj%Ututorial-statisticsrn†X phk_autocraproj½U phk-autocraprp†UmodindexrqU py-modindexU†X(tutorial-advanced_backend_servers-healthrrjÔU(tutorial-advanced-backend-servers-healthrs†Xphk_thetoolsweworkwithrtjZUphk-thetoolsweworkwithru†X phk_sphinxrvjU phk-sphinxrw†X phk_vcl_exprrxjU phk-vcl-exprry†Xreference-varnishstatrzhYUreference-varnishstatr{†X install-indexr|héU install-indexr}†X%tutorial-handling_misbehaving_serversr~htU%tutorial-handling-misbehaving-serversr†Xphk_ipv6suckager€jøUphk-ipv6suckager†X phk_thoughtsr‚jQU phk-thoughtsrƒ†X ref-varnishdr„jHU ref-varnishdr…†Xphk_varnish_does_not_hashr†jcUphk-varnish-does-not-hashr‡†Xphk_gziprˆhGUphk-gzipr‰†Xtutorial-indexrŠjuUtutorial-indexr‹†XphkrŒjIUphkr†UgenindexrŽjŽU†Xref-varnishlogrj«Uref-varnishlogr†X tutorial-esir‘hªU tutorial-esir’†Xtutorial-purgingr“hÅUtutorial-purgingr”†X+tutorial-advanced_backend_servers-directorsr•jÔU+tutorial-advanced-backend-servers-directorsr–†Xphk_sslr—h}Uphk-sslr˜†X reference-vclr™j@U reference-vclrš†Xtutorial-intror›jÝUtutorial-introrœ†Xtutorial-advanced_topicsrj™Ututorial-advanced-topicsrž†Xtutorial-devicedetectrŸjUtutorial-devicedetectr †X reference-vslr¡h>U reference-vslr¢†Xtutorial-backend_serversr£j7Ututorial-backend-serversr¤†Xtutorial-loggingr¥hÎUtutorial-loggingr¦†X tutorial-increasing_your_hitrater§j[U tutorial-increasing-your-hitrater¨†Usearchr©UsearchU†X phk_platformsrªhU phk-platformsr«†Xglossaryr¬jæUglossaryr­†Xreference-indexr®j Ureference-indexr¯†Xtutorial-starting_varnishr°jUtutorial-starting-varnishr±†X tutorial-varyr²h˜U tutorial-varyr³†Xtutorial-cookiesr´hàUtutorial-cookiesrµ†X phk_barriersr¶h,U phk-barriersr·†X install-docr¸h†U install-docr¹†X phk_backendsrºh×U phk-backendsr»†Xtutorial-compressionr¼h¡Ututorial-compressionr½†uUlabelsr¾}r¿(jkhPjlX"Thoughts on the eve of Varnish 3.0‡jmj%jnX Statistics‡joj½jpX"Did you call them autocrap tools ?‡jqU py-modindexUcsphinx.locale _TranslationProxy rÀcsphinx.locale mygettext rÁU Module Indexr†rÃjÁjÂ…rĆb‡jrjÔjsX Health checks‡jtjZjuXThe Tools We Work With‡jvjjwX!Why Sphinx and reStructuredText ?‡jxjjyXVCL Expressions‡jzhYj{X varnishstat‡j|héj}XVarnish Installation‡j~htjXMisbehaving servers‡j€jøjX IPv6 Suckage‡j‚jQjƒXWhat were they thinking ?‡j„jHj…Xvarnishd‡j†jcj‡XVarnish Does Not Hash‡jˆhGj‰X'How GZIP, and GZIP+ESI works in Varnish‡jŠjuj‹X Using Varnish‡jŒjIjXPoul-Hennings random outbursts‡jŽjŽUjÀjÁUIndexrņrÆjÁjÅ…rdžb‡jj«jX varnishlog‡j‘hªj’XEdge Side Includes‡j“hÅj”XPurging and banning‡j•jÔj–X Directors‡j—h}j˜X Why no SSL ?‡j™j@jšXVCL‡j›jÝjœXWhat is Varnish?‡jj™jžXAdvanced topics‡jŸjj XDevice detection‡j¡h>j¢XShared Memory Logging‡j£j7j¤XBackend servers‡j¥hÎj¦XLogging in Varnish‡j§j[j¨XAchieving a high hitrate‡j©j©UjÀjÁU Search PagerȆrÉjÁjÈ…rʆb‡jªhj«XPicking platforms‡j¬jæj­XVarnish Glossary‡j®j j¯XThe Varnish Reference Manual‡j°jj±XStarting Varnish‡j²h˜j³XVary‡j´hàjµXCookies‡j¶h,j·XSecurity barriers in Varnish‡j¸h†j¹XInstalling Varnish‡jºh×j»XWhat do you mean by 'backend' ?‡j¼h¡j½X Compression‡uU progoptionsrË}rÌUobjectsrÍ}rÎ(UtermrÏXpiperІjæU term-piperцjÏX storage.listrÒ†h³Uterm-storage-listrÓ†jÏXban.listrÔ†h³U term-ban-listrÕ†jÏXobjectrÖ†jæU term-objectr׆jÏXhelp [command]r؆h³Uterm-help-commandrÙ†jÏXquitrÚ†h³U term-quitrÛ†jÏXpassr܆jæU term-passr݆jÏXbodyrÞ†jæU term-bodyr߆jÏXbackend responserà†jæUterm-backend-responserá†jÏXvcl†jæUterm-vclrâ†jÏXworker (process)rã†jæUterm-worker-processrä†jÏXhitrå†jæUterm-hitræ†jÏXvcl.show confignamerç†h³Uterm-vcl-show-confignamerè†jÏXresponseré†jæU term-responserê†jÏX varnishstatrë†jæUterm-varnishstatrì†jÏXbackendrí†jæU term-backendrî†jÏXping [timestamp]rï†h³Uterm-ping-timestamprð†jÏXstatusrñ†h³U term-statusrò†jÏXvarnishd (nb: with 'd')†jæUterm-varnishd-nb-with-dró†jÏXban.url regexprô†h³Uterm-ban-url-regexprõ†jÏXstoprö†h³U term-stopr÷†jÏXheaderrø†jæU term-headerrù†jÏX..rú†jæUterm-rû†jÏX varnishncsarü†jæUterm-varnishncsarý†jÏXmissrþ†jæU term-missrÿ†jÏX varnishtestr†jæUterm-varnishtestr†jÏXvcl.listr†h³U term-vcl-listr†jÏXvcl.discard confignamer†h³Uterm-vcl-discard-confignamer†jÏXvcl.use confignamer†h³Uterm-vcl-use-confignamer†jÏX varnishhistr†jæUterm-varnishhistr †jÏXvcl.inline configname vclr †h³Uterm-vcl-inline-configname-vclr †jÏXrequestr †jæU term-requestr †jÏX backend.set_health matcher stater†h³U%term-backend-set-health-matcher-stater†jÏXstartr†h³U term-startr†jÏXmaster (process)r†jæUterm-master-processr†jÏXparam.show [-l] [param]r†h³Uterm-param-show-l-paramr†jÏX backend.listr†h³Uterm-backend-listr†jÏXclientr†jæU term-clientr†jÏX varnishtopr†jæUterm-varnishtopr†jÏX varnishlogr†jæUterm-varnishlogr†jÏXparam.set param valuer†h³Uterm-param-set-param-valuer†jÏX@ban field operator argument [&& field operator argument [...]]r †h³U8term-ban-field-operator-argument-field-operator-argumentr!†jÏXvcl.load configname filenamer"†h³U!term-vcl-load-configname-filenamer#†uuUc}r$(jÍ}r%jhKuUpyr&}r'(jÍ}r(Umodulesr)}r*jhKuUjsr+}r,(jÍ}r-jhKuUrstr.}r/(jÍ}r0jhKuUcppr1}r2(jÍ}r3jhKuuU glob_toctreesr4h]…Rr5U reread_alwaysr6h]…Rr7U doctreedirr8U//home/tfheen/varnish/doc/sphinx/=build/doctreesr9Uversioning_conditionr:‰U citationsr;}jhK)Utodo_all_todosr<]r=}r>(Udocnamer?j Usourcer@cdocutils.nodes reprunicode rAX3/home/tfheen/varnish/doc/sphinx/reference/index.rstrB…rC}rDbUtodorEcsphinx.ext.todo todo_node rF)rG}rH(hXThe programs: . varnishd manual page . varnishstat . - counters explained . common filtering options for shmlog tools . varnishlog .. . varnsihtop .. . varnsihncsa .. . varnsihhist .. The CLI: . connections: -T -S -M . varnishadm . CLI commands and what they do . - vcl.load . - stop . - start . - ... VCL language . The functions: . - vcl_recv . - vcl_miss . --- . The things you can do . - set . - unset . - esi . - rollback Varnishtest . syntax etc. Shared Memory . internals . Log records Libvarnishapi . function descriptionsrIh}rJ(h]h]rKUadmonition-todorLah]h]rMUindex-0rNah]uh]rO(h)rP}rQ(hXTodorRh}rS(h]h]h]h]h]uh jGh]rThXTodorU…rV}rW(hjRh jPubah!h"ubcdocutils.nodes paragraph rX)rY}rZ(hXThe programs: . varnishd manual page . varnishstat . - counters explained . common filtering options for shmlog tools . varnishlog .. . varnsihtop .. . varnsihncsa .. . varnsihhist .. The CLI: . connections: -T -S -M . varnishadm . CLI commands and what they do . - vcl.load . - stop . - start . - ... VCL language . The functions: . - vcl_recv . - vcl_miss . --- . The things you can do . - set . - unset . - esi . - rollback Varnishtest . syntax etc. Shared Memory . internals . Log records Libvarnishapi . function descriptionsr[h}r\(h]h]h]h]h]uh jGh]r]hXThe programs: . varnishd manual page . varnishstat . - counters explained . common filtering options for shmlog tools . varnishlog .. . varnsihtop .. . varnsihncsa .. . varnsihhist .. The CLI: . connections: -T -S -M . varnishadm . CLI commands and what they do . - vcl.load . - stop . - start . - ... VCL language . The functions: . - vcl_recv . - vcl_miss . --- . The things you can do . - set . - unset . - esi . - rollback Varnishtest . syntax etc. Shared Memory . internals . Log records Libvarnishapi . function descriptionsr^…r_}r`(hj[h jYubah!U paragraphraubeh!U todo_noderbubUlinenorcKUtargetrdcdocutils.nodes target re)rf}rg(hUh cdocutils.nodes section rh)ri}rj(hUh cdocutils.nodes document rk)rl}rm(U nametypesrn}ro(j®ˆXthe varnish reference manualrpNuUsubstitution_defsrq}rrUparse_messagesrs]rtUcurrent_sourceruNU decorationrvNUautofootnote_startrwKUnameidsrx}ry(j®j¯jpUthe-varnish-reference-manualrzuh]r{(je)r|}r}(hX.. _reference-index:h jlj@jCh!jdh}r~(h]h]h]h]h]Urefidrj¯uUliner€KUdocumentrjlh]ubjiehUU transformerr‚NU footnote_refsrƒ}r„Urefnamesr…}r†Usymbol_footnotesr‡]rˆUautofootnote_refsr‰]rŠUsymbol_footnote_refsr‹]rŒj;]rjjlU current_linerŽNUtransform_messagesr]r(cdocutils.nodes system_message r‘)r’}r“(hUh}r”(h]UlevelKh]h]UsourcejCh]h]UlineKUtypeUINFOr•uh]r–jX)r—}r˜(hUh}r™(h]h]h]h]h]uh j’h]ršhX5Hyperlink target "reference-index" is not referenced.r›…rœ}r(hUh j—ubah!jaubah!Usystem_messageržubj‘)rŸ}r (hUh}r¡(h]UlevelKh]h]UsourcejCh]h]Utypej•uh]r¢jX)r£}r¤(hUh}r¥(h]h]h]h]h]uh jŸh]r¦hX-Hyperlink target "index-0" is not referenced.r§…r¨}r©(hUh j£ubah!jaubah!jžubeUreporterrªNUid_startr«KU autofootnotesr¬]r­U citation_refsr®}r¯Uindirect_targetsr°]r±Usettingsr²(cdocutils.frontend Values r³or´}rµ(Ufootnote_backlinksr¶KUrecord_dependenciesr·NU rfc_base_urlr¸Uhttp://tools.ietf.org/html/r¹U tracebackrºˆUpep_referencesr»NUstrip_commentsr¼NU toc_backlinksr½Uentryr¾U language_coder¿UenrÀU datestamprÁNU report_levelrÂKU _destinationrÃNU halt_levelrÄKU strip_classesrÅNh"NUerror_encoding_error_handlerrÆUbackslashreplacerÇUdebugrÈNUembed_stylesheetrɉUoutput_encoding_error_handlerrÊUstrictrËU sectnum_xformrÌKUdump_transformsrÍNU docinfo_xformrÎKUwarning_streamrÏNUpep_file_url_templaterÐUpep-%04drÑUexit_status_levelrÒKUconfigrÓNUstrict_visitorrÔNUcloak_email_addressesrÕˆUtrim_footnote_reference_spacerÖ‰Uenvr×NUdump_pseudo_xmlrØNUexpose_internalsrÙNUsectsubtitle_xformrÚ‰U source_linkrÛNUrfc_referencesrÜNUoutput_encodingrÝUutf-8rÞU source_urlrßNUinput_encodingràU utf-8-sigráU_disable_configrâNU id_prefixrãUU tab_widthräKUerror_encodingråUUTF-8ræU_sourcerçU3/home/tfheen/varnish/doc/sphinx/reference/index.rstUgettext_compactrèˆU generatorréNUdump_internalsrêNU smart_quotesrë‰U pep_base_urlrìUhttp://www.python.org/dev/peps/ríUsyntax_highlightrîUlongrïUinput_encoding_error_handlerrðjËUauto_id_prefixrñUidròUdoctitle_xformró‰Ustrip_elements_with_classesrôNU _config_filesrõ]Ufile_insertion_enabledröKU raw_enabledr÷KU dump_settingsrøNubUsymbol_footnote_startrùKUidsrú}rû(j¯jijNjF)rü}rý(hjIh jij@jCUexpect_referenced_by_namerþ}h!jbh}rÿ(h]h]rjLah]h]rjNah]uj€KjjlUexpect_referenced_by_idr}rjNjfsh]r(h)r}r(hjRh}r(h]h]h]h]h]uh jüh]rhXTodor …r }r (hjRh jubah!h"ubjX)r }r (hj[h jüj@jCh!jah}r(h]h]h]h]h]uj€Kh]rhXThe programs: . varnishd manual page . varnishstat . - counters explained . common filtering options for shmlog tools . varnishlog .. . varnsihtop .. . varnsihncsa .. . varnsihhist .. The CLI: . connections: -T -S -M . varnishadm . CLI commands and what they do . - vcl.load . - stop . - start . - ... VCL language . The functions: . - vcl_recv . - vcl_miss . --- . The things you can do . - set . - unset . - esi . - rollback Varnishtest . syntax etc. Shared Memory . internals . Log records Libvarnishapi . function descriptionsr…r}r(hj[h j ubaubeubjzjiuUsubstitution_namesr}rh!jh}r(h]h]h]UsourcejCh]h]uU footnotesr]rUrefidsr}r(j¯]rj|ajN]rjfauubj@jCjþ}rj®j|sh!Usectionrh}r(h]h]h]h]r(jzj¯eh]r (jpj®euj€Kjjlj}r!j¯j|sh]r"(h)r#}r$(hjh jij@jCh!h"h}r%(h]h]h]h]h]uj€Kjjlh]r&hXThe Varnish Reference Manualr'…r(}r)(hjh j#ubaubcdocutils.nodes compound r*)r+}r,(hUh jij@jCh!Ucompoundr-h}r.(h]h]r/Utoctree-wrapperr0ah]h]h]uj€Kjjlh]r1csphinx.addnodes toctree r2)r3}r4(hUh j+j@jCh!Utoctreer5h}r6(Unumberedr7Kh j U titlesonlyr8‰Uglobr9‰h]h]h]h]h]Uentriesr:]r;(NX reference/vclr<†r=NXreference/varnish-clir>†r?NXreference/varnishadmr@†rANXreference/varnishdrB†rCNXreference/varnishhistrD†rENXreference/varnishlogrF†rGNXreference/varnishncsarH†rINXreference/varnishreplayrJ†rKNXreference/varnishsizesrL†rMNXreference/varnishstatrN†rONXreference/varnishtestrP†rQNXreference/varnishtoprR†rSNXreference/shmemrT†rUNXreference/vmodrV†rWNXreference/vmod_stdrX†rYNX reference/vslrZ†r[eUhiddenr\‰U includefilesr]]r^(j<j>j@jBjDjFjHjJjLjNjPjRjTjVjXjZeUmaxdepthr_Jÿÿÿÿuj€Kh]ubaubjfjüeubj@jCh!jdh}r`(h]h]h]h]h]jjNuj€Njjlh]ubuaUsrcdirraU/home/tfheen/varnish/doc/sphinxrbjÓcsphinx.config Config rc)rd}re(Uhtml_theme_optionsrf}rg(UsidebarbgcolorrhU#EEEEEEriU linkcolorrjU#336590rkUsidebartextcolorrlU#222222rmU textcolorrnjmU headlinkcolorrojkU headtextcolorrpjmU relbarbgcolorrqU#437EB2rrUrelbartextcolorrsUwhitertUbgcolorrujtU codetextcolorrvjmUsidebarlinkcolorrwjkuUhtml_use_smartypantsrx‰U html_titleryU#Varnish version 3.0.5 documentationU source_suffixrzU.rstU copyrightr{X2010, Varnish ProjectUtemplates_pathr|]r}U =templatesr~aUexclude_patternsr]r€(U=buildrUreference/params.rstr‚eU overridesrƒ}Upygments_styler„Usphinxr…Ulatex_documentsr†]r‡(UindexU Varnish.texXVarnish DocumentationXVarnish ProjectUmanualrˆtr‰aUprojectrŠXVarnishUhtmlhelp_basenamer‹U VarnishdocjhU3.0.5rŒU extensionsr]rŽUsphinx.ext.todoraU html_themerUdefaultr‘Ureleaser’jŒU master_docr“Uindexr”Usetupr•NubUmetadatar–}r—(h }h#}h,}h5}h>}hG}hP}hY}hb}hk}ht}h}}h†}h}h˜}h¡}hª}h³}h¼}hÅ}hÎ}h×}hà}hé}hò}hû}j}j }j}j-}j6}j?}jH}jQ}jZ}jc}jl}ju}j~}j‡}j}j™}j¢}j«}j´}j½}jÔ}jÝ}jæ}jï}jø}j}j }j}j}j%}j.}j7}j@}jI}jR}j[}uUversionchangesr˜}Utoc_num_entriesr™}rš(h Kh#Kh,Kh5Kh>KhGKhPKhYKhbKhkK htKh}Kh†K hKh˜Kh¡KhªKh³K h¼KhÅKhÎKh×KhàKhéKhòKhûKjKj KjKj-Kj6Kj?KjHK jQKjZKjcKjlKjuKj~Kj‡KjKj™Kj¢K j«K j´Kj½KjÔKjÝKjæKjïKjøKjKj KjKjKj%Kj.Kj7Kj@KjIKjRKj[KuUimagesr›h)rœh]…RrbUnumbered_toctreesržh]…RrŸU found_docsr h]r¡(h h#h,h5h>hGhPhYhbhkhth}h†hh˜jÝhªh³h¼hÅhÎh×hàhéhòhûjj jj-j6j?jHjQjZjcjljuj~j‡jj™j¢j«j´h¡j½jÔjæjïjIjj jjj%j.j7j@jøjRj[e…Rr¢U longtitlesr£}r¤(h hh#h$h,h-h5h6h>h?hGhHhPhQhYhZhbhchkhlhthuh}h~h†h‡hhh˜h™h¡h¢hªh«h³h´h¼h½hÅhÆhÎhÏh×hØhàháhéhêhòhóhûhüjjj jjjj-j.j6j7j?j@jHjIjQjRjZj[jcjdjljmjujvj~jj‡jˆjj‘j™jšj¢j£j«j¬j´jµj½j¾jÔjÕjÝjÞjæjçjïjðjøjùjjj j jjjjj%j&j.j/j7j8j@jAjIjJjRjSj[j\uU dependenciesr¥}r¦(j@h]r§X../../bin/varnishd/default.vclr¨a…Rr©jHh]rªXreference/params.rstr«a…Rr¬uUtoctree_includesr­}r®(h¼]r¯(Xinstallation/indexr°Xtutorial/indexr±Xreference/indexr²X phk/indexr³Xglossary/indexr´eju]rµ(Xtutorial/introductionr¶Xtutorial/backend_serversr·Xtutorial/starting_varnishr¸Xtutorial/loggingr¹Xtutorial/sizing_your_cacherºX#tutorial/putting_varnish_on_port_80r»X tutorial/vclr¼Xtutorial/statisticsr½X tutorial/increasing_your_hitrater¾Xtutorial/cookiesr¿X tutorial/varyrÀXtutorial/purgingrÁXtutorial/compressionrÂX tutorial/esirÃXtutorial/platformnotesrÄXtutorial/websocketsrÅXtutorial/devicedetectionrÆX!tutorial/advanced_backend_serversrÇX%tutorial/handling_misbehaving_serversrÈXtutorial/advanced_topicsrÉXtutorial/troubleshootingrÊehé]rË(Xinstallation/prerequisitesrÌXinstallation/installrÍXinstallation/helprÎXinstallation/bugsrÏXinstallation/upgraderÐej ]rÑ(j<j>j@jBjDjFjHjJjLjNjPjRjTjVjXjZejI]rÒ(Xphk/varnish_does_not_hashrÓXphk/thetoolsweworkwithrÔXphk/three-zerorÕXphk/sslrÖXphk/gzipr×X phk/vcl_exprrØXphk/ipv6suckagerÙX phk/backendsrÚX phk/platformsrÛX phk/barriersrÜX phk/thoughtsrÝX phk/autocraprÞX phk/sphinxrßeuU temp_datarà}Utocsrá}râ(h cdocutils.nodes bullet_list rã)rä}rå(hUh}ræ(h]h]h]h]h]uh]rçcdocutils.nodes list_item rè)ré}rê(hUh}rë(h]h]h]h]h]uh jäh]rì(csphinx.addnodes compact_paragraph rí)rî}rï(hUh}rð(h]h]h]h]h]uh jéh]rñcdocutils.nodes reference rò)ró}rô(hUh}rõ(U anchornameUUrefurih h]h]h]h]h]Uinternalˆuh jîh]röhXvmod_stdr÷…rø}rù(hhh jóubah!U referencerúubah!Ucompact_paragraphrûubjã)rü}rý(hUh}rþ(h]h]h]h]h]uh jéh]rÿjè)r}r(hUh}r(h]h]h]h]h]uh jüh]r(jí)r}r(hUh}r(h]h]h]h]h]uh jh]rjò)r}r (hUh}r (U anchornameU#varnish-standard-moduleUrefurih h]h]h]h]h]Uinternalˆuh jh]r hXVarnish Standard Moduler …r }r(hXVarnish Standard Modulerh jubah!júubah!jûubjã)r}r(hUh}r(h]h]h]h]h]uh jh]r(jè)r}r(hUh}r(h]h]h]h]h]uh jh]rjí)r}r(hUh}r(h]h]h]h]h]uh jh]rjò)r}r(hUh}r(U anchornameU #synopsisUrefurih h]h]h]h]h]Uinternalˆuh jh]rhXSYNOPSISr …r!}r"(hXSYNOPSISr#h jubah!júubah!jûubah!U list_itemr$ubjè)r%}r&(hUh}r'(h]h]h]h]h]uh jh]r(jí)r)}r*(hUh}r+(h]h]h]h]h]uh j%h]r,jò)r-}r.(hUh}r/(U anchornameU #descriptionUrefurih h]h]h]h]h]Uinternalˆuh j)h]r0hX DESCRIPTIONr1…r2}r3(hX DESCRIPTIONr4h j-ubah!júubah!jûubah!j$ubjè)r5}r6(hUh}r7(h]h]h]h]h]uh jh]r8(jí)r9}r:(hUh}r;(h]h]h]h]h]uh j5h]r<jò)r=}r>(hUh}r?(U anchornameU #functionsUrefurih h]h]h]h]h]Uinternalˆuh j9h]r@hX FUNCTIONSrA…rB}rC(hX FUNCTIONSrDh j=ubah!júubah!jûubjã)rE}rF(hUh}rG(h]h]h]h]h]uh j5h]rH(jè)rI}rJ(hUh}rK(h]h]h]h]h]uh jEh]rLjí)rM}rN(hUh}rO(h]h]h]h]h]uh jIh]rPjò)rQ}rR(hUh}rS(U anchornameU#toupperUrefurih h]h]h]h]h]Uinternalˆuh jMh]rThXtoupperrU…rV}rW(hXtoupperrXh jQubah!júubah!jûubah!j$ubjè)rY}rZ(hUh}r[(h]h]h]h]h]uh jEh]r\jí)r]}r^(hUh}r_(h]h]h]h]h]uh jYh]r`jò)ra}rb(hUh}rc(U anchornameU#tolowerUrefurih h]h]h]h]h]Uinternalˆuh j]h]rdhXtolowerre…rf}rg(hXtolowerrhh jaubah!júubah!jûubah!j$ubjè)ri}rj(hUh}rk(h]h]h]h]h]uh jEh]rljí)rm}rn(hUh}ro(h]h]h]h]h]uh jih]rpjò)rq}rr(hUh}rs(U anchornameU #set-ip-tosUrefurih h]h]h]h]h]Uinternalˆuh jmh]rthX set_ip_tosru…rv}rw(hX set_ip_tosrxh jqubah!júubah!jûubah!j$ubjè)ry}rz(hUh}r{(h]h]h]h]h]uh jEh]r|jí)r}}r~(hUh}r(h]h]h]h]h]uh jyh]r€jò)r}r‚(hUh}rƒ(U anchornameU#randomUrefurih h]h]h]h]h]Uinternalˆuh j}h]r„hXrandomr……r†}r‡(hXrandomrˆh jubah!júubah!jûubah!j$ubjè)r‰}rŠ(hUh}r‹(h]h]h]h]h]uh jEh]rŒjí)r}rŽ(hUh}r(h]h]h]h]h]uh j‰h]rjò)r‘}r’(hUh}r“(U anchornameU#logUrefurih h]h]h]h]h]Uinternalˆuh jh]r”hXlogr•…r–}r—(hXlogr˜h j‘ubah!júubah!jûubah!j$ubjè)r™}rš(hUh}r›(h]h]h]h]h]uh jEh]rœjí)r}rž(hUh}rŸ(h]h]h]h]h]uh j™h]r jò)r¡}r¢(hUh}r£(U anchornameU#syslogUrefurih h]h]h]h]h]Uinternalˆuh jh]r¤hXsyslogr¥…r¦}r§(hXsyslogr¨h j¡ubah!júubah!jûubah!j$ubjè)r©}rª(hUh}r«(h]h]h]h]h]uh jEh]r¬jí)r­}r®(hUh}r¯(h]h]h]h]h]uh j©h]r°jò)r±}r²(hUh}r³(U anchornameU #filereadUrefurih h]h]h]h]h]Uinternalˆuh j­h]r´hXfilereadrµ…r¶}r·(hXfilereadr¸h j±ubah!júubah!jûubah!j$ubjè)r¹}rº(hUh}r»(h]h]h]h]h]uh jEh]r¼jí)r½}r¾(hUh}r¿(h]h]h]h]h]uh j¹h]rÀjò)rÁ}rÂ(hUh}rÃ(U anchornameU #durationUrefurih h]h]h]h]h]Uinternalˆuh j½h]rÄhXdurationrÅ…rÆ}rÇ(hXdurationrÈh jÁubah!júubah!jûubah!j$ubjè)rÉ}rÊ(hUh}rË(h]h]h]h]h]uh jEh]rÌjí)rÍ}rÎ(hUh}rÏ(h]h]h]h]h]uh jÉh]rÐjò)rÑ}rÒ(hUh}rÓ(U anchornameU#integerUrefurih h]h]h]h]h]Uinternalˆuh jÍh]rÔhXintegerrÕ…rÖ}r×(hXintegerrØh jÑubah!júubah!jûubah!j$ubjè)rÙ}rÚ(hUh}rÛ(h]h]h]h]h]uh jEh]rÜjí)rÝ}rÞ(hUh}rß(h]h]h]h]h]uh jÙh]ràjò)rá}râ(hUh}rã(U anchornameU#collectUrefurih h]h]h]h]h]Uinternalˆuh jÝh]rähXcollectrå…ræ}rç(hXcollectrèh jáubah!júubah!jûubah!j$ubeh!U bullet_listréubeh!j$ubjè)rê}rë(hUh}rì(h]h]h]h]h]uh jh]ríjí)rî}rï(hUh}rð(h]h]h]h]h]uh jêh]rñjò)rò}ró(hUh}rô(U anchornameU #see-alsoUrefurih h]h]h]h]h]Uinternalˆuh jîh]rõhXSEE ALSOrö…r÷}rø(hXSEE ALSOrùh jòubah!júubah!jûubah!j$ubjè)rú}rû(hUh}rü(h]h]h]h]h]uh jh]rýjí)rþ}rÿ(hUh}r(h]h]h]h]h]uh júh]rjò)r}r(hUh}r(U anchornameU#historyUrefurih h]h]h]h]h]Uinternalˆuh jþh]rhXHISTORYr…r}r(hXHISTORYr h jubah!júubah!jûubah!j$ubjè)r }r (hUh}r (h]h]h]h]h]uh jh]r jí)r}r(hUh}r(h]h]h]h]h]uh j h]rjò)r}r(hUh}r(U anchornameU #copyrightUrefurih h]h]h]h]h]Uinternalˆuh jh]rhX COPYRIGHTr…r}r(hX COPYRIGHTrh jubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubeh!j$ubah!jéubh#jã)r}r(hUh}r(h]h]h]h]h]uh]rjè)r}r(hUh}r (h]h]h]h]h]uh jh]r!(jí)r"}r#(hUh}r$(h]h]h]h]h]uh jh]r%jò)r&}r'(hUh}r((U anchornameUUrefurih#h]h]h]h]h]Uinternalˆuh j"h]r)hXReporting bugsr*…r+}r,(hh+h j&ubah!júubah!jûubjã)r-}r.(hUh}r/(h]h]h]h]h]uh jh]r0(jè)r1}r2(hUh}r3(h]h]h]h]h]uh j-h]r4jí)r5}r6(hUh}r7(h]h]h]h]h]uh j1h]r8jò)r9}r:(hUh}r;(U anchornameU#varnish-crashesUrefurih#h]h]h]h]h]Uinternalˆuh j5h]r<hXVarnish crashesr=…r>}r?(hXVarnish crashesh j9ubah!júubah!jûubah!j$ubjè)r@}rA(hUh}rB(h]h]h]h]h]uh j-h]rCjí)rD}rE(hUh}rF(h]h]h]h]h]uh j@h]rGjò)rH}rI(hUh}rJ(U anchornameU#varnish-goes-on-vacationUrefurih#h]h]h]h]h]Uinternalˆuh jDh]rKhXVarnish goes on vacationrL…rM}rN(hXVarnish goes on vacationh jHubah!júubah!jûubah!j$ubjè)rO}rP(hUh}rQ(h]h]h]h]h]uh j-h]rRjí)rS}rT(hUh}rU(h]h]h]h]h]uh jOh]rVjò)rW}rX(hUh}rY(U anchornameU#varnish-does-something-wrongUrefurih#h]h]h]h]h]Uinternalˆuh jSh]rZhXVarnish does something wrongr[…r\}r](hXVarnish does something wrongh jWubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubh,jã)r^}r_(hUh}r`(h]h]h]h]h]uh]rajè)rb}rc(hUh}rd(h]h]h]h]h]uh j^h]re(jí)rf}rg(hUh}rh(h]h]h]h]h]uh jbh]rijò)rj}rk(hUh}rl(U anchornameUUrefurih,h]h]h]h]h]Uinternalˆuh jfh]rmhXSecurity barriers in Varnishrn…ro}rp(hh4h jjubah!júubah!jûubjã)rq}rr(hUh}rs(h]h]h]h]h]uh jbh]rt(jè)ru}rv(hUh}rw(h]h]h]h]h]uh jqh]rxjí)ry}rz(hUh}r{(h]h]h]h]h]uh juh]r|jò)r}}r~(hUh}r(U anchornameU#the-really-important-barrierUrefurih,h]h]h]h]h]Uinternalˆuh jyh]r€hXThe really Important Barrierr…r‚}rƒ(hXThe really Important Barrierh j}ubah!júubah!jûubah!j$ubjè)r„}r…(hUh}r†(h]h]h]h]h]uh jqh]r‡jí)rˆ}r‰(hUh}rŠ(h]h]h]h]h]uh j„h]r‹jò)rŒ}r(hUh}rŽ(U anchornameU#the-admin-oper-barrierUrefurih,h]h]h]h]h]Uinternalˆuh jˆh]rhXThe Admin/Oper Barrierr…r‘}r’(hXThe Admin/Oper Barrierh jŒubah!júubah!jûubah!j$ubjè)r“}r”(hUh}r•(h]h]h]h]h]uh jqh]r–jí)r—}r˜(hUh}r™(h]h]h]h]h]uh j“h]ršjò)r›}rœ(hUh}r(U anchornameU#all-the-other-barriersUrefurih,h]h]h]h]h]Uinternalˆuh j—h]ržhXAll the other barriersrŸ…r }r¡(hXAll the other barriersh j›ubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubh5jã)r¢}r£(hUh}r¤(h]h]h]h]h]uh]r¥jè)r¦}r§(hUh}r¨(h]h]h]h]h]uh j¢h]r©(jí)rª}r«(hUh}r¬(h]h]h]h]h]uh j¦h]r­jò)r®}r¯(hUh}r°(U anchornameUUrefurih5h]h]h]h]h]Uinternalˆuh jªh]r±hX varnishncsar²…r³}r´(hh=h j®ubah!júubah!jûubjã)rµ}r¶(hUh}r·(h]h]h]h]h]uh j¦h]r¸jè)r¹}rº(hUh}r»(h]h]h]h]h]uh jµh]r¼(jí)r½}r¾(hUh}r¿(h]h]h]h]h]uh j¹h]rÀjò)rÁ}rÂ(hUh}rÃ(U anchornameU8#display-varnish-logs-in-apache-ncsa-combined-log-formatUrefurih5h]h]h]h]h]Uinternalˆuh j½h]rÄhX9Display Varnish logs in Apache / NCSA combined log formatrÅ…rÆ}rÇ(hX9Display Varnish logs in Apache / NCSA combined log formatrÈh jÁubah!júubah!jûubjã)rÉ}rÊ(hUh}rË(h]h]h]h]h]uh j¹h]rÌ(jè)rÍ}rÎ(hUh}rÏ(h]h]h]h]h]uh jÉh]rÐjí)rÑ}rÒ(hUh}rÓ(h]h]h]h]h]uh jÍh]rÔjò)rÕ}rÖ(hUh}r×(U anchornameU #synopsisUrefurih5h]h]h]h]h]Uinternalˆuh jÑh]rØhXSYNOPSISrÙ…rÚ}rÛ(hXSYNOPSISrÜh jÕubah!júubah!jûubah!j$ubjè)rÝ}rÞ(hUh}rß(h]h]h]h]h]uh jÉh]ràjí)rá}râ(hUh}rã(h]h]h]h]h]uh jÝh]räjò)rå}ræ(hUh}rç(U anchornameU #descriptionUrefurih5h]h]h]h]h]Uinternalˆuh jáh]rèhX DESCRIPTIONré…rê}rë(hX DESCRIPTIONrìh jåubah!júubah!jûubah!j$ubjè)rí}rî(hUh}rï(h]h]h]h]h]uh jÉh]rðjí)rñ}rò(hUh}ró(h]h]h]h]h]uh jíh]rôjò)rõ}rö(hUh}r÷(U anchornameU #see-alsoUrefurih5h]h]h]h]h]Uinternalˆuh jñh]røhXSEE ALSOrù…rú}rû(hXSEE ALSOrüh jõubah!júubah!jûubah!j$ubjè)rý}rþ(hUh}rÿ(h]h]h]h]h]uh jÉh]rjí)r}r(hUh}r(h]h]h]h]h]uh jýh]rjò)r}r(hUh}r(U anchornameU#historyUrefurih5h]h]h]h]h]Uinternalˆuh jh]rhXHISTORYr …r }r (hXHISTORYr h jubah!júubah!jûubah!j$ubjè)r }r(hUh}r(h]h]h]h]h]uh jÉh]rjí)r}r(hUh}r(h]h]h]h]h]uh j h]rjò)r}r(hUh}r(U anchornameU #copyrightUrefurih5h]h]h]h]h]Uinternalˆuh jh]rhX COPYRIGHTr…r}r(hX COPYRIGHTrh jubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubeh!j$ubah!jéubh>jã)r}r(hUh}r(h]h]h]h]h]uh]r jè)r!}r"(hUh}r#(h]h]h]h]h]uh jh]r$(jí)r%}r&(hUh}r'(h]h]h]h]h]uh j!h]r(jò)r)}r*(hUh}r+(U anchornameUUrefurih>h]h]h]h]h]Uinternalˆuh j%h]r,hXShared Memory Loggingr-…r.}r/(hhFh j)ubah!júubah!jûubjã)r0}r1(hUh}r2(h]h]h]h]h]uh j!h]r3(jè)r4}r5(hUh}r6(h]h]h]h]h]uh j0h]r7jí)r8}r9(hUh}r:(h]h]h]h]h]uh j4h]r;jò)r<}r=(hUh}r>(U anchornameU #ttl-recordsUrefurih>h]h]h]h]h]Uinternalˆuh j8h]r?hX TTL recordsr@…rA}rB(hX TTL recordsrCh j<ubah!júubah!jûubah!j$ubjè)rD}rE(hUh}rF(h]h]h]h]h]uh j0h]rGjí)rH}rI(hUh}rJ(h]h]h]h]h]uh jDh]rKjò)rL}rM(hUh}rN(U anchornameU #gzip-recordsUrefurih>h]h]h]h]h]Uinternalˆuh jHh]rOhX Gzip recordsrP…rQ}rR(hX Gzip recordsrSh jLubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubhGjã)rT}rU(hUh}rV(h]h]h]h]h]uh]rWjè)rX}rY(hUh}rZ(h]h]h]h]h]uh jTh]r[(jí)r\}r](hUh}r^(h]h]h]h]h]uh jXh]r_jò)r`}ra(hUh}rb(U anchornameUUrefurihGh]h]h]h]h]Uinternalˆuh j\h]rchX'How GZIP, and GZIP+ESI works in Varnishrd…re}rf(hhOh j`ubah!júubah!jûubjã)rg}rh(hUh}ri(h]h]h]h]h]uh jXh]rj(jè)rk}rl(hUh}rm(h]h]h]h]h]uh jgh]rnjí)ro}rp(hUh}rq(h]h]h]h]h]uh jkh]rrjò)rs}rt(hUh}ru(U anchornameU#what-does-http-gzip-support-doUrefurihGh]h]h]h]h]Uinternalˆuh joh]rvhXWhat does http_gzip_support dorw…rx}ry(hXWhat does http_gzip_support doh jsubah!júubah!jûubah!j$ubjè)rz}r{(hUh}r|(h]h]h]h]h]uh jgh]r}jí)r~}r(hUh}r€(h]h]h]h]h]uh jzh]rjò)r‚}rƒ(hUh}r„(U anchornameU#tuning-tweaking-and-frobbingUrefurihGh]h]h]h]h]Uinternalˆuh j~h]r…hXTuning, tweaking and frobbingr†…r‡}rˆ(hXTuning, tweaking and frobbingh j‚ubah!júubah!jûubah!j$ubjè)r‰}rŠ(hUh}r‹(h]h]h]h]h]uh jgh]rŒjí)r}rŽ(hUh}r(h]h]h]h]h]uh j‰h]rjò)r‘}r’(hUh}r“(U anchornameU #gzip-and-esiUrefurihGh]h]h]h]h]Uinternalˆuh jh]r”hX GZIP and ESIr•…r–}r—(hX GZIP and ESIh j‘ubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubhPjã)r˜}r™(hUh}rš(h]h]h]h]h]uh]r›jè)rœ}r(hUh}rž(h]h]h]h]h]uh j˜h]rŸjí)r }r¡(hUh}r¢(h]h]h]h]h]uh jœh]r£jò)r¤}r¥(hUh}r¦(U anchornameUUrefurihPh]h]h]h]h]Uinternalˆuh j h]r§hX"Thoughts on the eve of Varnish 3.0r¨…r©}rª(hhXh j¤ubah!júubah!jûubah!j$ubah!jéubhYjã)r«}r¬(hUh}r­(h]h]h]h]h]uh]r®jè)r¯}r°(hUh}r±(h]h]h]h]h]uh j«h]r²(jí)r³}r´(hUh}rµ(h]h]h]h]h]uh j¯h]r¶jò)r·}r¸(hUh}r¹(U anchornameUUrefurihYh]h]h]h]h]Uinternalˆuh j³h]rºhX varnishstatr»…r¼}r½(hhah j·ubah!júubah!jûubjã)r¾}r¿(hUh}rÀ(h]h]h]h]h]uh j¯h]rÁjè)rÂ}rÃ(hUh}rÄ(h]h]h]h]h]uh j¾h]rÅ(jí)rÆ}rÇ(hUh}rÈ(h]h]h]h]h]uh jÂh]rÉjò)rÊ}rË(hUh}rÌ(U anchornameU#varnish-cache-statisticsUrefurihYh]h]h]h]h]Uinternalˆuh jÆh]rÍhXVarnish Cache statisticsrÎ…rÏ}rÐ(hXVarnish Cache statisticsh jÊubah!júubah!jûubjã)rÑ}rÒ(hUh}rÓ(h]h]h]h]h]uh jÂh]rÔ(jè)rÕ}rÖ(hUh}r×(h]h]h]h]h]uh jÑh]rØjí)rÙ}rÚ(hUh}rÛ(h]h]h]h]h]uh jÕh]rÜjò)rÝ}rÞ(hUh}rß(U anchornameU #synopsisUrefurihYh]h]h]h]h]Uinternalˆuh jÙh]ràhXSYNOPSISrá…râ}rã(hXSYNOPSISh jÝubah!júubah!jûubah!j$ubjè)rä}rå(hUh}ræ(h]h]h]h]h]uh jÑh]rçjí)rè}ré(hUh}rê(h]h]h]h]h]uh jäh]rëjò)rì}rí(hUh}rî(U anchornameU #descriptionUrefurihYh]h]h]h]h]Uinternalˆuh jèh]rïhX DESCRIPTIONrð…rñ}rò(hX DESCRIPTIONh jìubah!júubah!jûubah!j$ubjè)ró}rô(hUh}rõ(h]h]h]h]h]uh jÑh]röjí)r÷}rø(hUh}rù(h]h]h]h]h]uh jóh]rújò)rû}rü(hUh}rý(U anchornameU #see-alsoUrefurihYh]h]h]h]h]Uinternalˆuh j÷h]rþhXSEE ALSOrÿ…r}r(hXSEE ALSOh jûubah!júubah!jûubah!j$ubjè)r}r(hUh}r(h]h]h]h]h]uh jÑh]rjí)r}r(hUh}r(h]h]h]h]h]uh jh]r jò)r }r (hUh}r (U anchornameU#historyUrefurihYh]h]h]h]h]Uinternalˆuh jh]r hXHISTORYr…r}r(hXHISTORYh j ubah!júubah!jûubah!j$ubjè)r}r(hUh}r(h]h]h]h]h]uh jÑh]rjí)r}r(hUh}r(h]h]h]h]h]uh jh]rjò)r}r(hUh}r(U anchornameU #copyrightUrefurihYh]h]h]h]h]Uinternalˆuh jh]rhX COPYRIGHTr…r}r(hX COPYRIGHTh jubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubeh!j$ubah!jéubhbjã)r }r!(hUh}r"(h]h]h]h]h]uh]r#jè)r$}r%(hUh}r&(h]h]h]h]h]uh j h]r'(jí)r(}r)(hUh}r*(h]h]h]h]h]uh j$h]r+jò)r,}r-(hUh}r.(U anchornameUUrefurihbh]h]h]h]h]Uinternalˆuh j(h]r/hX varnishtestr0…r1}r2(hhjh j,ubah!júubah!jûubjã)r3}r4(hUh}r5(h]h]h]h]h]uh j$h]r6jè)r7}r8(hUh}r9(h]h]h]h]h]uh j3h]r:(jí)r;}r<(hUh}r=(h]h]h]h]h]uh j7h]r>jò)r?}r@(hUh}rA(U anchornameU#test-program-for-varnishUrefurihbh]h]h]h]h]Uinternalˆuh j;h]rBhXTest program for VarnishrC…rD}rE(hXTest program for Varnishh j?ubah!júubah!jûubjã)rF}rG(hUh}rH(h]h]h]h]h]uh j7h]rI(jè)rJ}rK(hUh}rL(h]h]h]h]h]uh jFh]rMjí)rN}rO(hUh}rP(h]h]h]h]h]uh jJh]rQjò)rR}rS(hUh}rT(U anchornameU #synopsisUrefurihbh]h]h]h]h]Uinternalˆuh jNh]rUhXSYNOPSISrV…rW}rX(hXSYNOPSISh jRubah!júubah!jûubah!j$ubjè)rY}rZ(hUh}r[(h]h]h]h]h]uh jFh]r\jí)r]}r^(hUh}r_(h]h]h]h]h]uh jYh]r`jò)ra}rb(hUh}rc(U anchornameU #descriptionUrefurihbh]h]h]h]h]Uinternalˆuh j]h]rdhX DESCRIPTIONre…rf}rg(hX DESCRIPTIONh jaubah!júubah!jûubah!j$ubjè)rh}ri(hUh}rj(h]h]h]h]h]uh jFh]rkjí)rl}rm(hUh}rn(h]h]h]h]h]uh jhh]rojò)rp}rq(hUh}rr(U anchornameU#scriptsUrefurihbh]h]h]h]h]Uinternalˆuh jlh]rshXSCRIPTSrt…ru}rv(hXSCRIPTSh jpubah!júubah!jûubah!j$ubjè)rw}rx(hUh}ry(h]h]h]h]h]uh jFh]rzjí)r{}r|(hUh}r}(h]h]h]h]h]uh jwh]r~jò)r}r€(hUh}r(U anchornameU #see-alsoUrefurihbh]h]h]h]h]Uinternalˆuh j{h]r‚hXSEE ALSOrƒ…r„}r…(hXSEE ALSOh jubah!júubah!jûubah!j$ubjè)r†}r‡(hUh}rˆ(h]h]h]h]h]uh jFh]r‰jí)rŠ}r‹(hUh}rŒ(h]h]h]h]h]uh j†h]rjò)rŽ}r(hUh}r(U anchornameU#historyUrefurihbh]h]h]h]h]Uinternalˆuh jŠh]r‘hXHISTORYr’…r“}r”(hXHISTORYh jŽubah!júubah!jûubah!j$ubjè)r•}r–(hUh}r—(h]h]h]h]h]uh jFh]r˜jí)r™}rš(hUh}r›(h]h]h]h]h]uh j•h]rœjò)r}rž(hUh}rŸ(U anchornameU #copyrightUrefurihbh]h]h]h]h]Uinternalˆuh j™h]r hX COPYRIGHTr¡…r¢}r£(hX COPYRIGHTh jubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubeh!j$ubah!jéubhkjã)r¤}r¥(hUh}r¦(h]h]h]h]h]uh]r§jè)r¨}r©(hUh}rª(h]h]h]h]h]uh j¤h]r«(jí)r¬}r­(hUh}r®(h]h]h]h]h]uh j¨h]r¯jò)r°}r±(hUh}r²(U anchornameUUrefurihkh]h]h]h]h]Uinternalˆuh j¬h]r³hX$Varnish Configuration Language - VCLr´…rµ}r¶(hhsh j°ubah!júubah!jûubjã)r·}r¸(hUh}r¹(h]h]h]h]h]uh j¨h]rº(jè)r»}r¼(hUh}r½(h]h]h]h]h]uh j·h]r¾jí)r¿}rÀ(hUh}rÁ(h]h]h]h]h]uh j»h]rÂjò)rÃ}rÄ(hUh}rÅ(U anchornameU #vcl-recvUrefurihkh]h]h]h]h]Uinternalˆuh j¿h]rÆhXvcl_recvrÇ…rÈ}rÉ(hXvcl_recvrÊh jÃubah!júubah!jûubah!j$ubjè)rË}rÌ(hUh}rÍ(h]h]h]h]h]uh j·h]rÎjí)rÏ}rÐ(hUh}rÑ(h]h]h]h]h]uh jËh]rÒjò)rÓ}rÔ(hUh}rÕ(U anchornameU #vcl-fetchUrefurihkh]h]h]h]h]Uinternalˆuh jÏh]rÖhX vcl_fetchr×…rØ}rÙ(hX vcl_fetchrÚh jÓubah!júubah!jûubah!j$ubjè)rÛ}rÜ(hUh}rÝ(h]h]h]h]h]uh j·h]rÞjí)rß}rà(hUh}rá(h]h]h]h]h]uh jÛh]râjò)rã}rä(hUh}rå(U anchornameU#actionsUrefurihkh]h]h]h]h]Uinternalˆuh jßh]ræhXactionsrç…rè}ré(hXactionsrêh jãubah!júubah!jûubah!j$ubjè)rë}rì(hUh}rí(h]h]h]h]h]uh j·h]rîjí)rï}rð(hUh}rñ(h]h]h]h]h]uh jëh]ròjò)ró}rô(hUh}rõ(U anchornameU#requests-responses-and-objectsUrefurihkh]h]h]h]h]Uinternalˆuh jïh]röhXRequests, responses and objectsr÷…rø}rù(hXRequests, responses and objectsrúh jóubah!júubah!jûubah!j$ubjè)rû}rü(hUh}rý(h]h]h]h]h]uh j·h]rþjí)rÿ}r (hUh}r (h]h]h]h]h]uh jûh]r jò)r }r (hUh}r (U anchornameU #operatorsUrefurihkh]h]h]h]h]Uinternalˆuh jÿh]r hX Operatorsr …r }r (hX Operatorsr h j ubah!júubah!jûubah!j$ubjè)r }r (hUh}r (h]h]h]h]h]uh j·h]r jí)r }r (hUh}r (h]h]h]h]h]uh j h]r jò)r }r (hUh}r (U anchornameU#example-1-manipulating-headersUrefurihkh]h]h]h]h]Uinternalˆuh j h]r hX Example 1 - manipulating headersr …r }r (hX Example 1 - manipulating headersr h j ubah!júubah!jûubah!j$ubjè)r }r (hUh}r (h]h]h]h]h]uh j·h]r jí)r }r (hUh}r! (h]h]h]h]h]uh j h]r" jò)r# }r$ (hUh}r% (U anchornameU#example-2-manipulating-berespUrefurihkh]h]h]h]h]Uinternalˆuh j h]r& hXExample 2 - manipulating berespr' …r( }r) (hXExample 2 - manipulating berespr* h j# ubah!júubah!jûubah!j$ubjè)r+ }r, (hUh}r- (h]h]h]h]h]uh j·h]r. jí)r/ }r0 (hUh}r1 (h]h]h]h]h]uh j+ h]r2 jò)r3 }r4 (hUh}r5 (U anchornameU#example-3-aclsUrefurihkh]h]h]h]h]Uinternalˆuh j/ h]r6 hXExample 3 - ACLsr7 …r8 }r9 (hXExample 3 - ACLsr: h j3 ubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubhtjã)r; }r< (hUh}r= (h]h]h]h]h]uh]r> jè)r? }r@ (hUh}rA (h]h]h]h]h]uh j; h]rB (jí)rC }rD (hUh}rE (h]h]h]h]h]uh j? h]rF jò)rG }rH (hUh}rI (U anchornameUUrefurihth]h]h]h]h]Uinternalˆuh jC h]rJ hXMisbehaving serversrK …rL }rM (hh|h jG ubah!júubah!jûubjã)rN }rO (hUh}rP (h]h]h]h]h]uh j? h]rQ (jè)rR }rS (hUh}rT (h]h]h]h]h]uh jN h]rU jí)rV }rW (hUh}rX (h]h]h]h]h]uh jR h]rY jò)rZ }r[ (hUh}r\ (U anchornameU #grace-modeUrefurihth]h]h]h]h]Uinternalˆuh jV h]r] hX Grace moder^ …r_ }r` (hX Grace modeh jZ ubah!júubah!jûubah!j$ubjè)ra }rb (hUh}rc (h]h]h]h]h]uh jN h]rd jí)re }rf (hUh}rg (h]h]h]h]h]uh ja h]rh jò)ri }rj (hUh}rk (U anchornameU #saint-modeUrefurihth]h]h]h]h]Uinternalˆuh je h]rl hX Saint moderm …rn }ro (hX Saint modeh ji ubah!júubah!jûubah!j$ubjè)rp }rq (hUh}rr (h]h]h]h]h]uh jN h]rs jí)rt }ru (hUh}rv (h]h]h]h]h]uh jp h]rw jò)rx }ry (hUh}rz (U anchornameU*#known-limitations-on-grace-and-saint-modeUrefurihth]h]h]h]h]Uinternalˆuh jt h]r{ hX*Known limitations on grace- and saint moder| …r} }r~ (hX*Known limitations on grace- and saint modeh jx ubah!júubah!jûubah!j$ubjè)r }r€ (hUh}r (h]h]h]h]h]uh jN h]r‚ jí)rƒ }r„ (hUh}r… (h]h]h]h]h]uh j h]r† jò)r‡ }rˆ (hUh}r‰ (U anchornameU #god-modeUrefurihth]h]h]h]h]Uinternalˆuh jƒ h]rŠ hXGod moder‹ …rŒ }r (hXGod modeh j‡ ubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubh}jã)rŽ }r (hUh}r (h]h]h]h]h]uh]r‘ jè)r’ }r“ (hUh}r” (h]h]h]h]h]uh jŽ h]r• jí)r– }r— (hUh}r˜ (h]h]h]h]h]uh j’ h]r™ jò)rš }r› (hUh}rœ (U anchornameUUrefurih}h]h]h]h]h]Uinternalˆuh j– h]r hX Why no SSL ?rž …rŸ }r  (hh…h jš ubah!júubah!jûubah!j$ubah!jéubh†jã)r¡ }r¢ (hUh}r£ (h]h]h]h]h]uh]r¤ (jè)r¥ }r¦ (hUh}r§ (h]h]h]h]h]uh j¡ h]r¨ (jí)r© }rª (hUh}r« (h]h]h]h]h]uh j¥ h]r¬ jò)r­ }r® (hUh}r¯ (U anchornameUUrefurih†h]h]h]h]h]Uinternalˆuh j© h]r° hXInstalling Varnishr± …r² }r³ (hhŽh j­ ubah!júubah!jûubjã)r´ }rµ (hUh}r¶ (h]h]h]h]h]uh j¥ h]r· (jè)r¸ }r¹ (hUh}rº (h]h]h]h]h]uh j´ h]r» jí)r¼ }r½ (hUh}r¾ (h]h]h]h]h]uh j¸ h]r¿ jò)rÀ }rÁ (hUh}r (U anchornameU#source-or-packagesUrefurih†h]h]h]h]h]Uinternalˆuh j¼ h]rà hXSource or packages?rÄ …rÅ }rÆ (hXSource or packages?h jÀ ubah!júubah!jûubah!j$ubjè)rÇ }rÈ (hUh}rÉ (h]h]h]h]h]uh j´ h]rÊ jí)rË }rÌ (hUh}rÍ (h]h]h]h]h]uh jÇ h]rÎ jò)rÏ }rÐ (hUh}rÑ (U anchornameU#freebsdUrefurih†h]h]h]h]h]Uinternalˆuh jË h]rÒ hXFreeBSDrÓ …rÔ }rÕ (hXFreeBSDh jÏ ubah!júubah!jûubah!j$ubjè)rÖ }r× (hUh}rØ (h]h]h]h]h]uh j´ h]rÙ jí)rÚ }rÛ (hUh}rÜ (h]h]h]h]h]uh jÖ h]rÝ jò)rÞ }rß (hUh}rà (U anchornameU#centos-redhatUrefurih†h]h]h]h]h]Uinternalˆuh jÚ h]rá hX CentOS/RedHatrâ …rã }rä (hX CentOS/RedHath jÞ ubah!júubah!jûubah!j$ubjè)rå }ræ (hUh}rç (h]h]h]h]h]uh j´ h]rè jí)ré }rê (hUh}rë (h]h]h]h]h]uh jå h]rì jò)rí }rî (hUh}rï (U anchornameU#debian-ubuntuUrefurih†h]h]h]h]h]Uinternalˆuh jé h]rð hX Debian/Ubunturñ …rò }ró (hX Debian/Ubuntuh jí ubah!júubah!jûubah!j$ubjè)rô }rõ (hUh}rö (h]h]h]h]h]uh j´ h]r÷ jí)rø }rù (hUh}rú (h]h]h]h]h]uh jô h]rû jò)rü }rý (hUh}rþ (U anchornameU#other-systemsUrefurih†h]h]h]h]h]Uinternalˆuh jø h]rÿ hX Other systemsr …r }r (hX Other systemsh jü ubah!júubah!jûubah!j$ubeh!jéubeh!j$ubjè)r }r (hUh}r (h]h]h]h]h]uh j¡ h]r (jí)r }r (hUh}r (h]h]h]h]h]uh j h]r jò)r }r (hUh}r (U anchornameU#compiling-varnish-from-sourceUrefurih†h]h]h]h]h]Uinternalˆuh j h]r hXCompiling Varnish from sourcer …r }r (hXCompiling Varnish from sourceh j ubah!júubah!jûubjã)r }r (hUh}r (h]h]h]h]h]uh j h]r (jè)r }r (hUh}r (h]h]h]h]h]uh j h]r jí)r }r (hUh}r (h]h]h]h]h]uh j h]r jò)r }r (hUh}r (U anchornameU$#build-dependencies-on-debian-ubuntuUrefurih†h]h]h]h]h]Uinternalˆuh j h]r! hX%Build dependencies on Debian / Ubuntur" …r# }r$ (hX%Build dependencies on Debian / Ubuntuh j ubah!júubah!jûubah!j$ubjè)r% }r& (hUh}r' (h]h]h]h]h]uh j h]r( jí)r) }r* (hUh}r+ (h]h]h]h]h]uh j% h]r, jò)r- }r. (hUh}r/ (U anchornameU%#build-dependencies-on-red-hat-centosUrefurih†h]h]h]h]h]Uinternalˆuh j) h]r0 hX&Build dependencies on Red Hat / CentOSr1 …r2 }r3 (hX&Build dependencies on Red Hat / CentOSh j- ubah!júubah!jûubah!j$ubjè)r4 }r5 (hUh}r6 (h]h]h]h]h]uh j h]r7 jí)r8 }r9 (hUh}r: (h]h]h]h]h]uh j4 h]r; jò)r< }r= (hUh}r> (U anchornameU#configuring-and-compilingUrefurih†h]h]h]h]h]Uinternalˆuh j8 h]r? hXConfiguring and compilingr@ …rA }rB (hXConfiguring and compilingh j< ubah!júubah!jûubah!j$ubjè)rC }rD (hUh}rE (h]h]h]h]h]uh j h]rF jí)rG }rH (hUh}rI (h]h]h]h]h]uh jC h]rJ jò)rK }rL (hUh}rM (U anchornameU #installingUrefurih†h]h]h]h]h]Uinternalˆuh jG h]rN hX InstallingrO …rP }rQ (hX Installingh jK ubah!júubah!jûubah!j$ubeh!jéubeh!j$ubeh!jéubhjã)rR }rS (hUh}rT (h]h]h]h]h]uh]rU jè)rV }rW (hUh}rX (h]h]h]h]h]uh jR h]rY (jí)rZ }r[ (hUh}r\ (h]h]h]h]h]uh jV h]r] jò)r^ }r_ (hUh}r` (U anchornameUUrefurihh]h]h]h]h]Uinternalˆuh jZ h]ra hXPicking platformsrb …rc }rd (hh—h j^ ubah!júubah!jûubjã)re }rf (hUh}rg (h]h]h]h]h]uh jV h]rh (jè)ri }rj (hUh}rk (h]h]h]h]h]uh je h]rl jí)rm }rn (hUh}ro (h]h]h]h]h]uh ji h]rp jò)rq }rr (hUh}rs (U anchornameU#a-platforms-we-care-aboutUrefurihh]h]h]h]h]Uinternalˆuh jm h]rt hXA - Platforms we care aboutru …rv }rw (hXA - Platforms we care abouth jq ubah!júubah!jûubah!j$ubjè)rx }ry (hUh}rz (h]h]h]h]h]uh je h]r{ jí)r| }r} (hUh}r~ (h]h]h]h]h]uh jx h]r jò)r€ }r (hUh}r‚ (U anchornameU #b-platforms-we-try-not-to-breakUrefurihh]h]h]h]h]Uinternalˆuh j| h]rƒ hX!B - Platforms we try not to breakr„ …r… }r† (hX!B - Platforms we try not to breakh j€ ubah!júubah!jûubah!j$ubjè)r‡ }rˆ (hUh}r‰ (h]h]h]h]h]uh je h]rŠ jí)r‹ }rŒ (hUh}r (h]h]h]h]h]uh j‡ h]rŽ jò)r }r (hUh}r‘ (U anchornameU#c-platforms-we-tolerateUrefurihh]h]h]h]h]Uinternalˆuh j‹ h]r’ hXC - Platforms we tolerater“ …r” }r• (hXC - Platforms we tolerateh j ubah!júubah!jûubah!j$ubjè)r– }r— (hUh}r˜ (h]h]h]h]h]uh je h]r™ jí)rš }r› (hUh}rœ (h]h]h]h]h]uh j– h]r jò)rž }rŸ (hUh}r  (U anchornameU #is-that-it-abandon-all-hope-etcUrefurihh]h]h]h]h]Uinternalˆuh jš h]r¡ hX%Is that it ? Abandon all hope etc. ?r¢ …r£ }r¤ (hX%Is that it ? Abandon all hope etc. ?h jž ubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubh˜jã)r¥ }r¦ (hUh}r§ (h]h]h]h]h]uh]r¨ (jè)r© }rª (hUh}r« (h]h]h]h]h]uh j¥ h]r¬ jí)r­ }r® (hUh}r¯ (h]h]h]h]h]uh j© h]r° jò)r± }r² (hUh}r³ (U anchornameUUrefurih˜h]h]h]h]h]Uinternalˆuh j­ h]r´ hXVaryrµ …r¶ }r· (hh h j± ubah!júubah!jûubah!j$ubjè)r¸ }r¹ (hUh}rº (h]h]h]h]h]uh j¥ h]r» jí)r¼ }r½ (hUh}r¾ (h]h]h]h]h]uh j¸ h]r¿ jò)rÀ }rÁ (hUh}r (U anchornameU#vary-parse-errorsUrefurih˜h]h]h]h]h]Uinternalˆuh j¼ h]rà hXVary parse errorsrÄ …rÅ }rÆ (hXVary parse errorsrÇ h jÀ ubah!júubah!jûubah!j$ubjè)rÈ }rÉ (hUh}rÊ (h]h]h]h]h]uh j¥ h]rË jí)rÌ }rÍ (hUh}rÎ (h]h]h]h]h]uh jÈ h]rÏ jò)rÐ }rÑ (hUh}rÒ (U anchornameU#pitfall-vary-user-agentUrefurih˜h]h]h]h]h]Uinternalˆuh jÌ h]rÓ hXPitfall - Vary: User-AgentrÔ …rÕ }rÖ (hXPitfall - Vary: User-Agentr× h jÐ ubah!júubah!jûubah!j$ubeh!jéubh¡jã)rØ }rÙ (hUh}rÚ (h]h]h]h]h]uh]rÛ (jè)rÜ }rÝ (hUh}rÞ (h]h]h]h]h]uh jØ h]rß jí)rà }rá (hUh}râ (h]h]h]h]h]uh jÜ h]rã jò)rä }rå (hUh}ræ (U anchornameUUrefurih¡h]h]h]h]h]Uinternalˆuh jà h]rç hX Compressionrè …ré }rê (hh©h jä ubah!júubah!jûubah!j$ubjè)rë }rì (hUh}rí (h]h]h]h]h]uh jØ h]rî jí)rï }rð (hUh}rñ (h]h]h]h]h]uh jë h]rò jò)ró }rô (hUh}rõ (U anchornameU#default-behaviourUrefurih¡h]h]h]h]h]Uinternalˆuh jï h]rö hXDefault behaviourr÷ …rø }rù (hXDefault behaviourh jó ubah!júubah!jûubah!j$ubjè)rú }rû (hUh}rü (h]h]h]h]h]uh jØ h]rý jí)rþ }rÿ (hUh}r (h]h]h]h]h]uh jú h]r jò)r }r (hUh}r (U anchornameU #gzip-and-esiUrefurih¡h]h]h]h]h]Uinternalˆuh jþ h]r hX GZIP and ESIr …r }r (hX GZIP and ESIh j ubah!júubah!jûubah!j$ubjè)r }r (hUh}r (h]h]h]h]h]uh jØ h]r jí)r }r (hUh}r (h]h]h]h]h]uh j h]r jò)r }r (hUh}r (U anchornameU #clients-that-don-t-support-gzipUrefurih¡h]h]h]h]h]Uinternalˆuh j h]r hXClients that don't support gzipr …r }r (hXClients that don't support gziph j ubah!júubah!jûubah!j$ubjè)r }r (hUh}r (h]h]h]h]h]uh jØ h]r jí)r }r (hUh}r (h]h]h]h]h]uh j h]r jò)r }r! (hUh}r" (U anchornameU#a-random-outburstUrefurih¡h]h]h]h]h]Uinternalˆuh j h]r# hXA random outburstr$ …r% }r& (hXA random outbursth j ubah!júubah!jûubah!j$ubeh!jéubhªjã)r' }r( (hUh}r) (h]h]h]h]h]uh]r* jè)r+ }r, (hUh}r- (h]h]h]h]h]uh j' h]r. (jí)r/ }r0 (hUh}r1 (h]h]h]h]h]uh j+ h]r2 jò)r3 }r4 (hUh}r5 (U anchornameUUrefurihªh]h]h]h]h]Uinternalˆuh j/ h]r6 hXEdge Side Includesr7 …r8 }r9 (hh²h j3 ubah!júubah!jûubjã)r: }r; (hUh}r< (h]h]h]h]h]uh j+ h]r= (jè)r> }r? (hUh}r@ (h]h]h]h]h]uh j: h]rA jí)rB }rC (hUh}rD (h]h]h]h]h]uh j> h]rE jò)rF }rG (hUh}rH (U anchornameU#example-esi-includeUrefurihªh]h]h]h]h]Uinternalˆuh jB h]rI hXExample: esi:includerJ …rK }rL (hXExample: esi:includeh jF ubah!júubah!jûubah!j$ubjè)rM }rN (hUh}rO (h]h]h]h]h]uh j: h]rP jí)rQ }rR (hUh}rS (h]h]h]h]h]uh jM h]rT jò)rU }rV (hUh}rW (U anchornameU#example-esi-remove-and-esiUrefurihªh]h]h]h]h]Uinternalˆuh jQ h]rX hX'Example: esi:remove and rY …rZ }r[ (hX'Example: esi:remove and h jU ubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubh³jã)r\ }r] (hUh}r^ (h]h]h]h]h]uh]r_ jè)r` }ra (hUh}rb (h]h]h]h]h]uh j\ h]rc (jí)rd }re (hUh}rf (h]h]h]h]h]uh j` h]rg jò)rh }ri (hUh}rj (U anchornameUUrefurih³h]h]h]h]h]Uinternalˆuh jd h]rk hXvarnishrl …rm }rn (hh»h jh ubah!júubah!jûubjã)ro }rp (hUh}rq (h]h]h]h]h]uh j` h]rr jè)rs }rt (hUh}ru (h]h]h]h]h]uh jo h]rv (jí)rw }rx (hUh}ry (h]h]h]h]h]uh js h]rz jò)r{ }r| (hUh}r} (U anchornameU#varnish-command-line-interfaceUrefurih³h]h]h]h]h]Uinternalˆuh jw h]r~ hXVarnish Command Line Interfacer …r€ }r (hXVarnish Command Line Interfaceh j{ ubah!júubah!jûubjã)r‚ }rƒ (hUh}r„ (h]h]h]h]h]uh js h]r… (jè)r† }r‡ (hUh}rˆ (h]h]h]h]h]uh j‚ h]r‰ (jí)rŠ }r‹ (hUh}rŒ (h]h]h]h]h]uh j† h]r jò)rŽ }r (hUh}r (U anchornameU #descriptionUrefurih³h]h]h]h]h]Uinternalˆuh jŠ h]r‘ hX DESCRIPTIONr’ …r“ }r” (hX DESCRIPTIONh jŽ ubah!júubah!jûubjã)r• }r– (hUh}r— (h]h]h]h]h]uh j† h]r˜ (jè)r™ }rš (hUh}r› (h]h]h]h]h]uh j• h]rœ jí)r }rž (hUh}rŸ (h]h]h]h]h]uh j™ h]r  jò)r¡ }r¢ (hUh}r£ (U anchornameU#syntaxUrefurih³h]h]h]h]h]Uinternalˆuh j h]r¤ hXSyntaxr¥ …r¦ }r§ (hXSyntaxh j¡ ubah!júubah!jûubah!j$ubjè)r¨ }r© (hUh}rª (h]h]h]h]h]uh j• h]r« jí)r¬ }r­ (hUh}r® (h]h]h]h]h]uh j¨ h]r¯ jò)r° }r± (hUh}r² (U anchornameU #commandsUrefurih³h]h]h]h]h]Uinternalˆuh j¬ h]r³ hXCommandsr´ …rµ }r¶ (hXCommandsh j° ubah!júubah!jûubah!j$ubjè)r· }r¸ (hUh}r¹ (h]h]h]h]h]uh j• h]rº jí)r» }r¼ (hUh}r½ (h]h]h]h]h]uh j· h]r¾ jò)r¿ }rÀ (hUh}rÁ (U anchornameU#ban-expressionsUrefurih³h]h]h]h]h]Uinternalˆuh j» h]r hXBan Expressionsrà …rÄ }rÅ (hXBan Expressionsh j¿ ubah!júubah!jûubah!j$ubjè)rÆ }rÇ (hUh}rÈ (h]h]h]h]h]uh j• h]rÉ jí)rÊ }rË (hUh}rÌ (h]h]h]h]h]uh jÆ h]rÍ jò)rÎ }rÏ (hUh}rÐ (U anchornameU #scriptingUrefurih³h]h]h]h]h]Uinternalˆuh jÊ h]rÑ hX ScriptingrÒ …rÓ }rÔ (hX Scriptingh jÎ ubah!júubah!jûubah!j$ubjè)rÕ }rÖ (hUh}r× (h]h]h]h]h]uh j• h]rØ jí)rÙ }rÚ (hUh}rÛ (h]h]h]h]h]uh jÕ h]rÜ jò)rÝ }rÞ (hUh}rß (U anchornameU#details-on-authenticationUrefurih³h]h]h]h]h]Uinternalˆuh jÙ h]rà hXDetails on authenticationrá …râ }rã (hXDetails on authenticationh jÝ ubah!júubah!jûubah!j$ubeh!jéubeh!j$ubjè)rä }rå (hUh}ræ (h]h]h]h]h]uh j‚ h]rç jí)rè }ré (hUh}rê (h]h]h]h]h]uh jä h]rë jò)rì }rí (hUh}rî (U anchornameU #examplesUrefurih³h]h]h]h]h]Uinternalˆuh jè h]rï hXEXAMPLESrð …rñ }rò (hXEXAMPLESh jì ubah!júubah!jûubah!j$ubjè)ró }rô (hUh}rõ (h]h]h]h]h]uh j‚ h]rö jí)r÷ }rø (hUh}rù (h]h]h]h]h]uh jó h]rú jò)rû }rü (hUh}rý (U anchornameU #see-alsoUrefurih³h]h]h]h]h]Uinternalˆuh j÷ h]rþ hXSEE ALSOrÿ …r }r (hXSEE ALSOh jû ubah!júubah!jûubah!j$ubjè)r }r (hUh}r (h]h]h]h]h]uh j‚ h]r jí)r }r (hUh}r (h]h]h]h]h]uh j h]r jò)r }r (hUh}r (U anchornameU#historyUrefurih³h]h]h]h]h]Uinternalˆuh j h]r hXHISTORYr …r }r (hXHISTORYh j ubah!júubah!jûubah!j$ubjè)r }r (hUh}r (h]h]h]h]h]uh j‚ h]r jí)r }r (hUh}r (h]h]h]h]h]uh j h]r jò)r }r (hUh}r (U anchornameU #copyrightUrefurih³h]h]h]h]h]Uinternalˆuh j h]r hX COPYRIGHTr …r }r (hX COPYRIGHTh j ubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubeh!j$ubah!jéubh¼jã)r }r! (hUh}r" (h]h]h]h]h]uh]r# (jè)r$ }r% (hUh}r& (h]h]h]h]h]uh j h]r' (jí)r( }r) (hUh}r* (h]h]h]h]h]uh j$ h]r+ jò)r, }r- (hUh}r. (U anchornameUUrefurih¼h]h]h]h]h]Uinternalˆuh j( h]r/ hX#Welcome to Varnish's documentation!r0 …r1 }r2 (hhÄh j, ubah!júubah!jûubjã)r3 }r4 (hUh}r5 (h]h]h]h]h]uh j$ h]r6 j2)r7 }r8 (hUh}r9 (UnumberedKUparenth¼U titlesonly‰Uglob‰h]h]h]h]h]Uentries]r: (Nj°†r; Nj±†r< Nj²†r= Nj³†r> Nj´†r? eUhidden‰U includefiles]r@ (j°j±j²j³j´eUmaxdepthKuh j3 h]h!j5ubah!jéubeh!j$ubjè)rA }rB (hUh}rC (h]h]h]h]h]uh j h]rD jí)rE }rF (hUh}rG (h]h]h]h]h]uh jA h]rH jò)rI }rJ (hUh}rK (U anchornameU#indices-and-tablesUrefurih¼h]h]h]h]h]Uinternalˆuh jE h]rL hXIndices and tablesrM …rN }rO (hXIndices and tablesh jI ubah!júubah!jûubah!j$ubeh!jéubhÅjã)rP }rQ (hUh}rR (h]h]h]h]h]uh]rS jè)rT }rU (hUh}rV (h]h]h]h]h]uh jP h]rW (jí)rX }rY (hUh}rZ (h]h]h]h]h]uh jT h]r[ jò)r\ }r] (hUh}r^ (U anchornameUUrefurihÅh]h]h]h]h]Uinternalˆuh jX h]r_ hXPurging and banningr` …ra }rb (hhÍh j\ ubah!júubah!jûubjã)rc }rd (hUh}re (h]h]h]h]h]uh jT h]rf (jè)rg }rh (hUh}ri (h]h]h]h]h]uh jc h]rj jí)rk }rl (hUh}rm (h]h]h]h]h]uh jg h]rn jò)ro }rp (hUh}rq (U anchornameU #http-purgesUrefurihÅh]h]h]h]h]Uinternalˆuh jk h]rr hX HTTP Purgesrs …rt }ru (hX HTTP Purgesh jo ubah!júubah!jûubah!j$ubjè)rv }rw (hUh}rx (h]h]h]h]h]uh jc h]ry jí)rz }r{ (hUh}r| (h]h]h]h]h]uh jv h]r} jò)r~ }r (hUh}r€ (U anchornameU#bansUrefurihÅh]h]h]h]h]Uinternalˆuh jz h]r hXBansr‚ …rƒ }r„ (hXBansh j~ ubah!júubah!jûubah!j$ubjè)r… }r† (hUh}r‡ (h]h]h]h]h]uh jc h]rˆ jí)r‰ }rŠ (hUh}r‹ (h]h]h]h]h]uh j… h]rŒ jò)r }rŽ (hUh}r (U anchornameU#forcing-a-cache-missUrefurihÅh]h]h]h]h]Uinternalˆuh j‰ h]r hXForcing a cache missr‘ …r’ }r“ (hXForcing a cache missh j ubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubhÎjã)r” }r• (hUh}r– (h]h]h]h]h]uh]r— jè)r˜ }r™ (hUh}rš (h]h]h]h]h]uh j” h]r› jí)rœ }r (hUh}rž (h]h]h]h]h]uh j˜ h]rŸ jò)r  }r¡ (hUh}r¢ (U anchornameUUrefurihÎh]h]h]h]h]Uinternalˆuh jœ h]r£ hXLogging in Varnishr¤ …r¥ }r¦ (hhÖh j  ubah!júubah!jûubah!j$ubah!jéubh×jã)r§ }r¨ (hUh}r© (h]h]h]h]h]uh]rª jè)r« }r¬ (hUh}r­ (h]h]h]h]h]uh j§ h]r® (jí)r¯ }r° (hUh}r± (h]h]h]h]h]uh j« h]r² jò)r³ }r´ (hUh}rµ (U anchornameUUrefurih×h]h]h]h]h]Uinternalˆuh j¯ h]r¶ hXWhat do you mean by 'backend' ?r· …r¸ }r¹ (hhßh j³ ubah!júubah!jûubjã)rº }r» (hUh}r¼ (h]h]h]h]h]uh j« h]r½ (jè)r¾ }r¿ (hUh}rÀ (h]h]h]h]h]uh jº h]rÁ jí)r }rà (hUh}rÄ (h]h]h]h]h]uh j¾ h]rÅ jò)rÆ }rÇ (hUh}rÈ (U anchornameU#share-and-enjoyUrefurih×h]h]h]h]h]Uinternalˆuh j h]rÉ hXShare And EnjoyrÊ …rË }rÌ (hXShare And Enjoyh jÆ ubah!júubah!jûubah!j$ubjè)rÍ }rÎ (hUh}rÏ (h]h]h]h]h]uh jº h]rÐ jí)rÑ }rÒ (hUh}rÓ (h]h]h]h]h]uh jÍ h]rÔ jò)rÕ }rÖ (hUh}r× (U anchornameU&#no-information-without-representationUrefurih×h]h]h]h]h]Uinternalˆuh jÑ h]rØ hX%No Information without RepresentationrÙ …rÚ }rÛ (hX%No Information without Representationh jÕ ubah!júubah!jûubah!j$ubjè)rÜ }rÝ (hUh}rÞ (h]h]h]h]h]uh jº h]rß jí)rà }rá (hUh}râ (h]h]h]h]h]uh jÜ h]rã jò)rä }rå (hUh}ræ (U anchornameU#sharing-health-statusUrefurih×h]h]h]h]h]Uinternalˆuh jà h]rç hXSharing Health Statusrè …ré }rê (hXSharing Health Statush jä ubah!júubah!jûubah!j$ubjè)rë }rì (hUh}rí (h]h]h]h]h]uh jº h]rî jí)rï }rð (hUh}rñ (h]h]h]h]h]uh jë h]rò jò)ró }rô (hUh}rõ (U anchornameU#implementationUrefurih×h]h]h]h]h]Uinternalˆuh jï h]rö hXImplementationr÷ …rø }rù (hXImplementationh jó ubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubhàjã)rú }rû (hUh}rü (h]h]h]h]h]uh]rý jè)rþ }rÿ (hUh}r (h]h]h]h]h]uh jú h]r (jí)r }r (hUh}r (h]h]h]h]h]uh jþ h]r jò)r }r (hUh}r (U anchornameUUrefurihàh]h]h]h]h]Uinternalˆuh j h]r hXCookiesr …r }r (hhèh j ubah!júubah!jûubjã)r }r (hUh}r (h]h]h]h]h]uh jþ h]r (jè)r }r (hUh}r (h]h]h]h]h]uh j h]r jí)r }r (hUh}r (h]h]h]h]h]uh j h]r jò)r }r (hUh}r (U anchornameU#cookies-from-the-clientUrefurihàh]h]h]h]h]Uinternalˆuh j h]r hXCookies from the clientr …r }r (hXCookies from the clienth j ubah!júubah!jûubah!j$ubjè)r }r! (hUh}r" (h]h]h]h]h]uh j h]r# jí)r$ }r% (hUh}r& (h]h]h]h]h]uh j h]r' jò)r( }r) (hUh}r* (U anchornameU #cookies-coming-from-the-backendUrefurihàh]h]h]h]h]Uinternalˆuh j$ h]r+ hXCookies coming from the backendr, …r- }r. (hXCookies coming from the backendh j( ubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubhéjã)r/ }r0 (hUh}r1 (h]h]h]h]h]uh]r2 jè)r3 }r4 (hUh}r5 (h]h]h]h]h]uh j/ h]r6 (jí)r7 }r8 (hUh}r9 (h]h]h]h]h]uh j3 h]r: jò)r; }r< (hUh}r= (U anchornameUUrefurihéh]h]h]h]h]Uinternalˆuh j7 h]r> hXVarnish Installationr? …r@ }rA (hhñh j; ubah!júubah!jûubjã)rB }rC (hUh}rD (h]h]h]h]h]uh j3 h]rE j2)rF }rG (hUh}rH (UnumberedKUparenthéU titlesonly‰Uglob‰h]h]h]h]h]Uentries]rI (Nj̆rJ Nj͆rK NjΆrL NjφrM NjІrN eUhidden‰U includefiles]rO (jÌjÍjÎjÏjÐeUmaxdepthJÿÿÿÿuh jB h]h!j5ubah!jéubeh!j$ubah!jéubhòjã)rP }rQ (hUh}rR (h]h]h]h]h]uh]rS jè)rT }rU (hUh}rV (h]h]h]h]h]uh jP h]rW jí)rX }rY (hUh}rZ (h]h]h]h]h]uh jT h]r[ jò)r\ }r] (hUh}r^ (U anchornameUUrefurihòh]h]h]h]h]Uinternalˆuh jX h]r_ hXUsing Websocketsr` …ra }rb (hhúh j\ ubah!júubah!jûubah!j$ubah!jéubhûjã)rc }rd (hUh}re (h]h]h]h]h]uh]rf jè)rg }rh (hUh}ri (h]h]h]h]h]uh jc h]rj (jí)rk }rl (hUh}rm (h]h]h]h]h]uh jg h]rn jò)ro }rp (hUh}rq (U anchornameUUrefurihûh]h]h]h]h]Uinternalˆuh jk h]rr hXTroubleshooting Varnishrs …rt }ru (hjh jo ubah!júubah!jûubjã)rv }rw (hUh}rx (h]h]h]h]h]uh jg h]ry (jè)rz }r{ (hUh}r| (h]h]h]h]h]uh jv h]r} jí)r~ }r (hUh}r€ (h]h]h]h]h]uh jz h]r jò)r‚ }rƒ (hUh}r„ (U anchornameU#when-varnish-won-t-startUrefurihûh]h]h]h]h]Uinternalˆuh j~ h]r… hXWhen Varnish won't startr† …r‡ }rˆ (hXWhen Varnish won't startr‰ h j‚ ubah!júubah!jûubah!j$ubjè)rŠ }r‹ (hUh}rŒ (h]h]h]h]h]uh jv h]r jí)rŽ }r (hUh}r (h]h]h]h]h]uh jŠ h]r‘ jò)r’ }r“ (hUh}r” (U anchornameU#varnish-is-crashingUrefurihûh]h]h]h]h]Uinternalˆuh jŽ h]r• hXVarnish is crashingr– …r— }r˜ (hXVarnish is crashingr™ h j’ ubah!júubah!jûubah!j$ubjè)rš }r› (hUh}rœ (h]h]h]h]h]uh jv h]r jí)rž }rŸ (hUh}r  (h]h]h]h]h]uh jš h]r¡ jò)r¢ }r£ (hUh}r¤ (U anchornameU!#varnish-gives-me-guru-meditationUrefurihûh]h]h]h]h]Uinternalˆuh jž h]r¥ hX Varnish gives me Guru meditationr¦ …r§ }r¨ (hX Varnish gives me Guru meditationr© h j¢ ubah!júubah!jûubah!j$ubjè)rª }r« (hUh}r¬ (h]h]h]h]h]uh jv h]r­ jí)r® }r¯ (hUh}r° (h]h]h]h]h]uh jª h]r± jò)r² }r³ (hUh}r´ (U anchornameU#varnish-doesn-t-cacheUrefurihûh]h]h]h]h]Uinternalˆuh j® h]rµ hXVarnish doesn't cacher¶ …r· }r¸ (hXVarnish doesn't cacher¹ h j² ubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubjjã)rº }r» (hUh}r¼ (h]h]h]h]h]uh]r½ jè)r¾ }r¿ (hUh}rÀ (h]h]h]h]h]uh jº h]rÁ jí)r }rà (hUh}rÄ (h]h]h]h]h]uh j¾ h]rÅ jò)rÆ }rÇ (hUh}rÈ (U anchornameUUrefurijh]h]h]h]h]Uinternalˆuh j h]rÉ hXStarting VarnishrÊ …rË }rÌ (hj h jÆ ubah!júubah!jûubah!j$ubah!jéubj jã)rÍ }rÎ (hUh}rÏ (h]h]h]h]h]uh]rÐ jè)rÑ }rÒ (hUh}rÓ (h]h]h]h]h]uh jÍ h]rÔ (jí)rÕ }rÖ (hUh}r× (h]h]h]h]h]uh jÑ h]rØ jò)rÙ }rÚ (hUh}rÛ (U anchornameUUrefurij h]h]h]h]h]Uinternalˆuh jÕ h]rÜ hXThe Varnish Reference ManualrÝ …rÞ }rß (hjh jÙ ubah!júubah!jûubjã)rà }rá (hUh}râ (h]h]h]h]h]uh jÑ h]rã j2)rä }rå (hUh}ræ (UnumberedKUparentj U titlesonly‰Uglob‰h]h]h]h]h]Uentriesj;Uhidden‰U includefilesj^UmaxdepthJÿÿÿÿuh jà h]h!j5ubah!jéubeh!j$ubah!jéubjjã)rç }rè (hUh}ré (h]h]h]h]h]uh]rê jè)rë }rì (hUh}rí (h]h]h]h]h]uh jç h]rî jí)rï }rð (hUh}rñ (h]h]h]h]h]uh jë h]rò jò)ró }rô (hUh}rõ (U anchornameUUrefurijh]h]h]h]h]Uinternalˆuh jï h]rö (hXWhy r÷ …rø }rù (hjh jó ubhXSphinxrú …rû }rü (hUh jó ubhX and rý …rþ }rÿ (hj%h jó ubhXreStructuredTextr…r}r(hUh jó ubhX ?r…r}r(hj,h jó ubeh!júubah!jûubah!j$ubah!jéubj-jã)r}r(hUh}r(h]h]h]h]h]uh]r jè)r }r (hUh}r (h]h]h]h]h]uh jh]r jí)r}r(hUh}r(h]h]h]h]h]uh j h]rjò)r}r(hUh}r(U anchornameUUrefurij-h]h]h]h]h]Uinternalˆuh jh]rhXSizing your cacher…r}r(hj5h jubah!júubah!jûubah!j$ubah!jéubj6jã)r}r(hUh}r(h]h]h]h]h]uh]rjè)r}r(hUh}r(h]h]h]h]h]uh jh]r (jí)r!}r"(hUh}r#(h]h]h]h]h]uh jh]r$jò)r%}r&(hUh}r'(U anchornameUUrefurij6h]h]h]h]h]Uinternalˆuh j!h]r(hX!Upgrading from Varnish 2.1 to 3.0r)…r*}r+(hj>h j%ubah!júubah!jûubjã)r,}r-(hUh}r.(h]h]h]h]h]uh jh]r/(jè)r0}r1(hUh}r2(h]h]h]h]h]uh j,h]r3(jí)r4}r5(hUh}r6(h]h]h]h]h]uh j0h]r7jò)r8}r9(hUh}r:(U anchornameU#changes-to-vclUrefurij6h]h]h]h]h]Uinternalˆuh j4h]r;hXChanges to VCLr<…r=}r>(hXChanges to VCLh j8ubah!júubah!jûubjã)r?}r@(hUh}rA(h]h]h]h]h]uh j0h]rB(jè)rC}rD(hUh}rE(h]h]h]h]h]uh j?h]rFjí)rG}rH(hUh}rI(h]h]h]h]h]uh jCh]rJjò)rK}rL(hUh}rM(U anchornameU#string-concatenation-operatorUrefurij6h]h]h]h]h]Uinternalˆuh jGh]rNhXstring concatenation operatorrO…rP}rQ(hXstring concatenation operatorh jKubah!júubah!jûubah!j$ubjè)rR}rS(hUh}rT(h]h]h]h]h]uh j?h]rUjí)rV}rW(hUh}rX(h]h]h]h]h]uh jRh]rYjò)rZ}r[(hUh}r\(U anchornameU#no-more-escapes-in-stringsUrefurij6h]h]h]h]h]Uinternalˆuh jVh]r]hXno more %-escapes in stringsr^…r_}r`(hXno more %-escapes in stringsh jZubah!júubah!jûubah!j$ubjè)ra}rb(hUh}rc(h]h]h]h]h]uh j?h]rdjí)re}rf(hUh}rg(h]h]h]h]h]uh jah]rhjò)ri}rj(hUh}rk(U anchornameU#log-moved-to-the-std-vmodUrefurij6h]h]h]h]h]Uinternalˆuh jeh]rl(cdocutils.nodes literal rm)rn}ro(hX``log``h}rp(h]h]h]h]h]uh jih]rqhXlogrr…rs}rt(hUh jnubah!UliteralruubhX moved to the std vmodrv…rw}rx(hX moved to the std vmodh jiubeh!júubah!jûubah!j$ubjè)ry}rz(hUh}r{(h]h]h]h]h]uh j?h]r|jí)r}}r~(hUh}r(h]h]h]h]h]uh jyh]r€jò)r}r‚(hUh}rƒ(U anchornameU#purges-are-now-called-bansUrefurij6h]h]h]h]h]Uinternalˆuh j}h]r„hXpurges are now called bansr……r†}r‡(hXpurges are now called bansh jubah!júubah!jûubah!j$ubjè)rˆ}r‰(hUh}rŠ(h]h]h]h]h]uh j?h]r‹jí)rŒ}r(hUh}rŽ(h]h]h]h]h]uh jˆh]rjò)r}r‘(hUh}r’(U anchornameU,#beresp-cacheable-and-obj-cacheable-are-goneUrefurij6h]h]h]h]h]Uinternalˆuh jŒh]r“(jm)r”}r•(hX``beresp.cacheable``h}r–(h]h]h]h]h]uh jh]r—hXberesp.cacheabler˜…r™}rš(hUh j”ubah!juubhX and r›…rœ}r(hX and h jubjm)rž}rŸ(hX``obj.cacheable``h}r (h]h]h]h]h]uh jh]r¡hX obj.cacheabler¢…r£}r¤(hUh jžubah!juubhX are goner¥…r¦}r§(hX are goneh jubeh!júubah!jûubah!j$ubjè)r¨}r©(hUh}rª(h]h]h]h]h]uh j?h]r«jí)r¬}r­(hUh}r®(h]h]h]h]h]uh j¨h]r¯jò)r°}r±(hUh}r²(U anchornameU.#returns-are-now-done-with-the-return-functionUrefurij6h]h]h]h]h]Uinternalˆuh j¬h]r³(hXreturns are now done with the r´…rµ}r¶(hXreturns are now done with the h j°ubjm)r·}r¸(hX ``return()``h}r¹(h]h]h]h]h]uh j°h]rºhXreturn()r»…r¼}r½(hUh j·ubah!juubhX functionr¾…r¿}rÀ(hX functionh j°ubeh!júubah!jûubah!j$ubjè)rÁ}rÂ(hUh}rÃ(h]h]h]h]h]uh j?h]rÄjí)rÅ}rÆ(hUh}rÇ(h]h]h]h]h]uh jÁh]rÈjò)rÉ}rÊ(hUh}rË(U anchornameU$#req-hash-is-replaced-with-hash-dataUrefurij6h]h]h]h]h]Uinternalˆuh jÅh]rÌ(jm)rÍ}rÎ(hX ``req.hash``h}rÏ(h]h]h]h]h]uh jÉh]rÐhXreq.hashrÑ…rÒ}rÓ(hUh jÍubah!juubhX is replaced with rÔ…rÕ}rÖ(hX is replaced with h jÉubjm)r×}rØ(hX``hash_data()``h}rÙ(h]h]h]h]h]uh jÉh]rÚhX hash_data()rÛ…rÜ}rÝ(hUh j×ubah!juubeh!júubah!jûubah!j$ubjè)rÞ}rß(hUh}rà(h]h]h]h]h]uh j?h]rájí)râ}rã(hUh}rä(h]h]h]h]h]uh jÞh]råjò)ræ}rç(hUh}rè(U anchornameU##esi-is-replaced-with-beresp-do-esiUrefurij6h]h]h]h]h]Uinternalˆuh jâh]ré(jm)rê}rë(hX``esi``h}rì(h]h]h]h]h]uh jæh]ríhXesirî…rï}rð(hUh jêubah!juubhX is replaced with rñ…rò}ró(hX is replaced with h jæubjm)rô}rõ(hX``beresp.do_esi``h}rö(h]h]h]h]h]uh jæh]r÷hX beresp.do_esirø…rù}rú(hUh jôubah!juubeh!júubah!jûubah!j$ubjè)rû}rü(hUh}rý(h]h]h]h]h]uh j?h]rþjí)rÿ}r(hUh}r(h]h]h]h]h]uh jûh]rjò)r}r(hUh}r(U anchornameU*#pass-in-vcl-fetch-renamed-to-hit-for-passUrefurij6h]h]h]h]h]Uinternalˆuh jÿh]r(jm)r}r(hX``pass``h}r (h]h]h]h]h]uh jh]r hXpassr …r }r (hUh jubah!juubhX in r…r}r(hX in h jubjm)r}r(hX ``vcl_fetch``h}r(h]h]h]h]h]uh jh]rhX vcl_fetchr…r}r(hUh jubah!juubhX renamed to r…r}r(hX renamed to h jubjm)r}r(hX``hit_for_pass``h}r(h]h]h]h]h]uh jh]rhX hit_for_passr…r }r!(hUh jubah!juubeh!júubah!jûubah!j$ubeh!jéubeh!j$ubjè)r"}r#(hUh}r$(h]h]h]h]h]uh j,h]r%(jí)r&}r'(hUh}r((h]h]h]h]h]uh j"h]r)jò)r*}r+(hUh}r,(U anchornameU#changes-to-runtime-parametersUrefurij6h]h]h]h]h]Uinternalˆuh j&h]r-hXChanges to runtime parametersr.…r/}r0(hXChanges to runtime parametersh j*ubah!júubah!jûubjã)r1}r2(hUh}r3(h]h]h]h]h]uh j"h]r4(jè)r5}r6(hUh}r7(h]h]h]h]h]uh j1h]r8jí)r9}r:(hUh}r;(h]h]h]h]h]uh j5h]r<jò)r=}r>(hUh}r?(U anchornameU#deleted-parametersUrefurij6h]h]h]h]h]Uinternalˆuh j9h]r@hXDeleted parametersrA…rB}rC(hXDeleted parametersh j=ubah!júubah!jûubah!j$ubjè)rD}rE(hUh}rF(h]h]h]h]h]uh j1h]rGjí)rH}rI(hUh}rJ(h]h]h]h]h]uh jDh]rKjò)rL}rM(hUh}rN(U anchornameU#new-parametersUrefurij6h]h]h]h]h]Uinternalˆuh jHh]rOhXNew parametersrP…rQ}rR(hXNew parametersh jLubah!júubah!jûubah!j$ubjè)rS}rT(hUh}rU(h]h]h]h]h]uh j1h]rVjí)rW}rX(hUh}rY(h]h]h]h]h]uh jSh]rZjò)r[}r\(hUh}r](U anchornameU#changed-default-valuesUrefurij6h]h]h]h]h]Uinternalˆuh jWh]r^hXChanged default valuesr_…r`}ra(hXChanged default valuesh j[ubah!júubah!jûubah!j$ubjè)rb}rc(hUh}rd(h]h]h]h]h]uh j1h]rejí)rf}rg(hUh}rh(h]h]h]h]h]uh jbh]rijò)rj}rk(hUh}rl(U anchornameU#changed-parameter-namesUrefurij6h]h]h]h]h]Uinternalˆuh jfh]rmhXChanged parameter namesrn…ro}rp(hXChanged parameter namesh jjubah!júubah!jûubah!j$ubeh!jéubeh!j$ubjè)rq}rr(hUh}rs(h]h]h]h]h]uh j,h]rtjí)ru}rv(hUh}rw(h]h]h]h]h]uh jqh]rxjò)ry}rz(hUh}r{(U anchornameU#changes-to-behaviourUrefurij6h]h]h]h]h]Uinternalˆuh juh]r|hXChanges to behaviourr}…r~}r(hXChanges to behaviourh jyubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubj?jã)r€}r(hUh}r‚(h]h]h]h]h]uh]rƒjè)r„}r…(hUh}r†(h]h]h]h]h]uh j€h]r‡jí)rˆ}r‰(hUh}rŠ(h]h]h]h]h]uh j„h]r‹jò)rŒ}r(hUh}rŽ(U anchornameUUrefurij?h]h]h]h]h]Uinternalˆuh jˆh]rhX Prerequisitesr…r‘}r’(hjGh jŒubah!júubah!jûubah!j$ubah!jéubjHjã)r“}r”(hUh}r•(h]h]h]h]h]uh]r–jè)r—}r˜(hUh}r™(h]h]h]h]h]uh j“h]rš(jí)r›}rœ(hUh}r(h]h]h]h]h]uh j—h]ržjò)rŸ}r (hUh}r¡(U anchornameUUrefurijHh]h]h]h]h]Uinternalˆuh j›h]r¢hXvarnishdr£…r¤}r¥(hjPh jŸubah!júubah!jûubjã)r¦}r§(hUh}r¨(h]h]h]h]h]uh j—h]r©jè)rª}r«(hUh}r¬(h]h]h]h]h]uh j¦h]r­(jí)r®}r¯(hUh}r°(h]h]h]h]h]uh jªh]r±jò)r²}r³(hUh}r´(U anchornameU#http-accelerator-daemonUrefurijHh]h]h]h]h]Uinternalˆuh j®h]rµhXHTTP accelerator daemonr¶…r·}r¸(hXHTTP accelerator daemonh j²ubah!júubah!jûubjã)r¹}rº(hUh}r»(h]h]h]h]h]uh jªh]r¼(jè)r½}r¾(hUh}r¿(h]h]h]h]h]uh j¹h]rÀjí)rÁ}rÂ(hUh}rÃ(h]h]h]h]h]uh j½h]rÄjò)rÅ}rÆ(hUh}rÇ(U anchornameU #synopsisUrefurijHh]h]h]h]h]Uinternalˆuh jÁh]rÈhXSYNOPSISrÉ…rÊ}rË(hXSYNOPSISh jÅubah!júubah!jûubah!j$ubjè)rÌ}rÍ(hUh}rÎ(h]h]h]h]h]uh j¹h]rÏjí)rÐ}rÑ(hUh}rÒ(h]h]h]h]h]uh jÌh]rÓjò)rÔ}rÕ(hUh}rÖ(U anchornameU #descriptionUrefurijHh]h]h]h]h]Uinternalˆuh jÐh]r×hX DESCRIPTIONrØ…rÙ}rÚ(hX DESCRIPTIONh jÔubah!júubah!jûubah!j$ubjè)rÛ}rÜ(hUh}rÝ(h]h]h]h]h]uh j¹h]rÞ(jí)rß}rà(hUh}rá(h]h]h]h]h]uh jÛh]râjò)rã}rä(hUh}rå(U anchornameU#optionsUrefurijHh]h]h]h]h]Uinternalˆuh jßh]ræhXOPTIONSrç…rè}ré(hXOPTIONSh jãubah!júubah!jûubjã)rê}rë(hUh}rì(h]h]h]h]h]uh jÛh]rí(jè)rî}rï(hUh}rð(h]h]h]h]h]uh jêh]rñjí)rò}ró(hUh}rô(h]h]h]h]h]uh jîh]rõjò)rö}r÷(hUh}rø(U anchornameU#hash-algorithmsUrefurijHh]h]h]h]h]Uinternalˆuh jòh]rùhXHash Algorithmsrú…rû}rü(hXHash Algorithmsh jöubah!júubah!jûubah!j$ubjè)rý}rþ(hUh}rÿ(h]h]h]h]h]uh jêh]rjí)r}r(hUh}r(h]h]h]h]h]uh jýh]rjò)r}r(hUh}r(U anchornameU#storage-typesUrefurijHh]h]h]h]h]Uinternalˆuh jh]rhX Storage Typesr …r }r (hX Storage Typesh jubah!júubah!jûubah!j$ubjè)r }r (hUh}r(h]h]h]h]h]uh jêh]rjí)r}r(hUh}r(h]h]h]h]h]uh j h]rjò)r}r(hUh}r(U anchornameU#transient-storageUrefurijHh]h]h]h]h]Uinternalˆuh jh]rhXTransient Storager…r}r(hXTransient Storageh jubah!júubah!jûubah!j$ubjè)r}r(hUh}r(h]h]h]h]h]uh jêh]rjí)r}r (hUh}r!(h]h]h]h]h]uh jh]r"jò)r#}r$(hUh}r%(U anchornameU#management-interfaceUrefurijHh]h]h]h]h]Uinternalˆuh jh]r&hXManagement Interfacer'…r(}r)(hXManagement Interfaceh j#ubah!júubah!jûubah!j$ubjè)r*}r+(hUh}r,(h]h]h]h]h]uh jêh]r-jí)r.}r/(hUh}r0(h]h]h]h]h]uh j*h]r1jò)r2}r3(hUh}r4(U anchornameU#run-time-parametersUrefurijHh]h]h]h]h]Uinternalˆuh j.h]r5hXRun-Time Parametersr6…r7}r8(hXRun-Time Parametersh j2ubah!júubah!jûubah!j$ubeh!jéubeh!j$ubjè)r9}r:(hUh}r;(h]h]h]h]h]uh j¹h]r<jí)r=}r>(hUh}r?(h]h]h]h]h]uh j9h]r@jò)rA}rB(hUh}rC(U anchornameU #see-alsoUrefurijHh]h]h]h]h]Uinternalˆuh j=h]rDhXSEE ALSOrE…rF}rG(hXSEE ALSOh jAubah!júubah!jûubah!j$ubjè)rH}rI(hUh}rJ(h]h]h]h]h]uh j¹h]rKjí)rL}rM(hUh}rN(h]h]h]h]h]uh jHh]rOjò)rP}rQ(hUh}rR(U anchornameU#historyUrefurijHh]h]h]h]h]Uinternalˆuh jLh]rShXHISTORYrT…rU}rV(hXHISTORYh jPubah!júubah!jûubah!j$ubjè)rW}rX(hUh}rY(h]h]h]h]h]uh j¹h]rZjí)r[}r\(hUh}r](h]h]h]h]h]uh jWh]r^jò)r_}r`(hUh}ra(U anchornameU #copyrightUrefurijHh]h]h]h]h]Uinternalˆuh j[h]rbhX COPYRIGHTrc…rd}re(hX COPYRIGHTh j_ubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubeh!j$ubah!jéubjQjã)rf}rg(hUh}rh(h]h]h]h]h]uh]rijè)rj}rk(hUh}rl(h]h]h]h]h]uh jfh]rmjí)rn}ro(hUh}rp(h]h]h]h]h]uh jjh]rqjò)rr}rs(hUh}rt(U anchornameUUrefurijQh]h]h]h]h]Uinternalˆuh jnh]ruhXWhat were they thinking ?rv…rw}rx(hjYh jrubah!júubah!jûubah!j$ubah!jéubjZjã)ry}rz(hUh}r{(h]h]h]h]h]uh]r|jè)r}}r~(hUh}r(h]h]h]h]h]uh jyh]r€jí)r}r‚(hUh}rƒ(h]h]h]h]h]uh j}h]r„jò)r…}r†(hUh}r‡(U anchornameUUrefurijZh]h]h]h]h]Uinternalˆuh jh]rˆhXThe Tools We Work Withr‰…rŠ}r‹(hjbh j…ubah!júubah!jûubah!j$ubah!jéubjcjã)rŒ}r(hUh}rŽ(h]h]h]h]h]uh]rjè)r}r‘(hUh}r’(h]h]h]h]h]uh jŒh]r“(jí)r”}r•(hUh}r–(h]h]h]h]h]uh jh]r—jò)r˜}r™(hUh}rš(U anchornameUUrefurijch]h]h]h]h]Uinternalˆuh j”h]r›hXVarnish Does Not Hashrœ…r}rž(hjkh j˜ubah!júubah!jûubjã)rŸ}r (hUh}r¡(h]h]h]h]h]uh jh]r¢jè)r£}r¤(hUh}r¥(h]h]h]h]h]uh jŸh]r¦jí)r§}r¨(hUh}r©(h]h]h]h]h]uh j£h]rªjò)r«}r¬(hUh}r­(U anchornameU#what-varnish-doesUrefurijch]h]h]h]h]Uinternalˆuh j§h]r®hXWhat Varnish Doesr¯…r°}r±(hXWhat Varnish Doesh j«ubah!júubah!jûubah!j$ubah!jéubeh!j$ubah!jéubjljã)r²}r³(hUh}r´(h]h]h]h]h]uh]rµjè)r¶}r·(hUh}r¸(h]h]h]h]h]uh j²h]r¹(jí)rº}r»(hUh}r¼(h]h]h]h]h]uh j¶h]r½jò)r¾}r¿(hUh}rÀ(U anchornameUUrefurijlh]h]h]h]h]Uinternalˆuh jºh]rÁhXGetting hold of usrÂ…rÃ}rÄ(hjth j¾ubah!júubah!jûubjã)rÅ}rÆ(hUh}rÇ(h]h]h]h]h]uh j¶h]rÈ(jè)rÉ}rÊ(hUh}rË(h]h]h]h]h]uh jÅh]rÌjí)rÍ}rÎ(hUh}rÏ(h]h]h]h]h]uh jÉh]rÐjò)rÑ}rÒ(hUh}rÓ(U anchornameU #irc-channelUrefurijlh]h]h]h]h]Uinternalˆuh jÍh]rÔhX IRC ChannelrÕ…rÖ}r×(hX IRC Channelh jÑubah!júubah!jûubah!j$ubjè)rØ}rÙ(hUh}rÚ(h]h]h]h]h]uh jÅh]rÛjí)rÜ}rÝ(hUh}rÞ(h]h]h]h]h]uh jØh]rßjò)rà}rá(hUh}râ(U anchornameU#mailing-listsUrefurijlh]h]h]h]h]Uinternalˆuh jÜh]rãhX Mailing Listsrä…rå}ræ(hX Mailing Listsh jàubah!júubah!jûubah!j$ubjè)rç}rè(hUh}ré(h]h]h]h]h]uh jÅh]rêjí)rë}rì(hUh}rí(h]h]h]h]h]uh jçh]rîjò)rï}rð(hUh}rñ(U anchornameU#trouble-ticketsUrefurijlh]h]h]h]h]Uinternalˆuh jëh]ròhXTrouble Ticketsró…rô}rõ(hXTrouble Ticketsh jïubah!júubah!jûubah!j$ubjè)rö}r÷(hUh}rø(h]h]h]h]h]uh jÅh]rùjí)rú}rû(hUh}rü(h]h]h]h]h]uh jöh]rýjò)rþ}rÿ(hUh}r(U anchornameU#commercial-supportUrefurijlh]h]h]h]h]Uinternalˆuh júh]rhXCommercial Supportr…r}r(hXCommercial Supporth jþubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubjujã)r}r(hUh}r(h]h]h]h]h]uh]rjè)r }r (hUh}r (h]h]h]h]h]uh jh]r (jí)r }r(hUh}r(h]h]h]h]h]uh j h]rjò)r}r(hUh}r(U anchornameUUrefurijuh]h]h]h]h]Uinternalˆuh j h]rhX Using Varnishr…r}r(hj}h jubah!júubah!jûubjã)r}r(hUh}r(h]h]h]h]h]uh j h]rj2)r}r(hUh}r(UnumberedKUparentjuU titlesonly‰Uglob‰h]h]h]h]h]Uentries]r(Nj¶†r Nj·†r!Nj¸†r"Nj¹†r#Njº†r$Nj»†r%Nj¼†r&Nj½†r'Nj¾†r(Nj¿†r)NjÀ†r*NjÁ†r+Nj†r,NjÆr-NjĆr.Njņr/NjƆr0Njdžr1NjȆr2NjɆr3Njʆr4eUhidden‰U includefiles]r5(j¶j·j¸j¹jºj»j¼j½j¾j¿jÀjÁjÂjÃjÄjÅjÆjÇjÈjÉjÊeUmaxdepthKuh jh]h!j5ubah!jéubeh!j$ubah!jéubj~jã)r6}r7(hUh}r8(h]h]h]h]h]uh]r9jè)r:}r;(hUh}r<(h]h]h]h]h]uh j6h]r=(jí)r>}r?(hUh}r@(h]h]h]h]h]uh j:h]rAjò)rB}rC(hUh}rD(U anchornameUUrefurij~h]h]h]h]h]Uinternalˆuh j>h]rEhX varnishhistrF…rG}rH(hj†h jBubah!júubah!jûubjã)rI}rJ(hUh}rK(h]h]h]h]h]uh j:h]rLjè)rM}rN(hUh}rO(h]h]h]h]h]uh jIh]rP(jí)rQ}rR(hUh}rS(h]h]h]h]h]uh jMh]rTjò)rU}rV(hUh}rW(U anchornameU#varnish-request-histogramUrefurij~h]h]h]h]h]Uinternalˆuh jQh]rXhXVarnish request histogramrY…rZ}r[(hXVarnish request histogramh jUubah!júubah!jûubjã)r\}r](hUh}r^(h]h]h]h]h]uh jMh]r_(jè)r`}ra(hUh}rb(h]h]h]h]h]uh j\h]rcjí)rd}re(hUh}rf(h]h]h]h]h]uh j`h]rgjò)rh}ri(hUh}rj(U anchornameU #synopsisUrefurij~h]h]h]h]h]Uinternalˆuh jdh]rkhXSYNOPSISrl…rm}rn(hXSYNOPSISh jhubah!júubah!jûubah!j$ubjè)ro}rp(hUh}rq(h]h]h]h]h]uh j\h]rrjí)rs}rt(hUh}ru(h]h]h]h]h]uh joh]rvjò)rw}rx(hUh}ry(U anchornameU #descriptionUrefurij~h]h]h]h]h]Uinternalˆuh jsh]rzhX DESCRIPTIONr{…r|}r}(hX DESCRIPTIONh jwubah!júubah!jûubah!j$ubjè)r~}r(hUh}r€(h]h]h]h]h]uh j\h]rjí)r‚}rƒ(hUh}r„(h]h]h]h]h]uh j~h]r…jò)r†}r‡(hUh}rˆ(U anchornameU #see-alsoUrefurij~h]h]h]h]h]Uinternalˆuh j‚h]r‰hXSEE ALSOrŠ…r‹}rŒ(hXSEE ALSOh j†ubah!júubah!jûubah!j$ubjè)r}rŽ(hUh}r(h]h]h]h]h]uh j\h]rjí)r‘}r’(hUh}r“(h]h]h]h]h]uh jh]r”jò)r•}r–(hUh}r—(U anchornameU#historyUrefurij~h]h]h]h]h]Uinternalˆuh j‘h]r˜hXHISTORYr™…rš}r›(hXHISTORYh j•ubah!júubah!jûubah!j$ubjè)rœ}r(hUh}rž(h]h]h]h]h]uh j\h]rŸjí)r }r¡(hUh}r¢(h]h]h]h]h]uh jœh]r£jò)r¤}r¥(hUh}r¦(U anchornameU #copyrightUrefurij~h]h]h]h]h]Uinternalˆuh j h]r§hX COPYRIGHTr¨…r©}rª(hX COPYRIGHTh j¤ubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubeh!j$ubah!jéubj‡jã)r«}r¬(hUh}r­(h]h]h]h]h]uh]r®jè)r¯}r°(hUh}r±(h]h]h]h]h]uh j«h]r²(jí)r³}r´(hUh}rµ(h]h]h]h]h]uh j¯h]r¶jò)r·}r¸(hUh}r¹(U anchornameUUrefurij‡h]h]h]h]h]Uinternalˆuh j³h]rºhX varnishtopr»…r¼}r½(hjh j·ubah!júubah!jûubjã)r¾}r¿(hUh}rÀ(h]h]h]h]h]uh j¯h]rÁjè)rÂ}rÃ(hUh}rÄ(h]h]h]h]h]uh j¾h]rÅ(jí)rÆ}rÇ(hUh}rÈ(h]h]h]h]h]uh jÂh]rÉjò)rÊ}rË(hUh}rÌ(U anchornameU#varnish-log-entry-rankingUrefurij‡h]h]h]h]h]Uinternalˆuh jÆh]rÍhXVarnish log entry rankingrÎ…rÏ}rÐ(hXVarnish log entry rankingh jÊubah!júubah!jûubjã)rÑ}rÒ(hUh}rÓ(h]h]h]h]h]uh jÂh]rÔ(jè)rÕ}rÖ(hUh}r×(h]h]h]h]h]uh jÑh]rØjí)rÙ}rÚ(hUh}rÛ(h]h]h]h]h]uh jÕh]rÜjò)rÝ}rÞ(hUh}rß(U anchornameU #synopsisUrefurij‡h]h]h]h]h]Uinternalˆuh jÙh]ràhXSYNOPSISrá…râ}rã(hXSYNOPSISh jÝubah!júubah!jûubah!j$ubjè)rä}rå(hUh}ræ(h]h]h]h]h]uh jÑh]rçjí)rè}ré(hUh}rê(h]h]h]h]h]uh jäh]rëjò)rì}rí(hUh}rî(U anchornameU #descriptionUrefurij‡h]h]h]h]h]Uinternalˆuh jèh]rïhX DESCRIPTIONrð…rñ}rò(hX DESCRIPTIONh jìubah!júubah!jûubah!j$ubjè)ró}rô(hUh}rõ(h]h]h]h]h]uh jÑh]röjí)r÷}rø(hUh}rù(h]h]h]h]h]uh jóh]rújò)rû}rü(hUh}rý(U anchornameU #examplesUrefurij‡h]h]h]h]h]Uinternalˆuh j÷h]rþhXEXAMPLESrÿ…r}r(hXEXAMPLESh jûubah!júubah!jûubah!j$ubjè)r}r(hUh}r(h]h]h]h]h]uh jÑh]rjí)r}r(hUh}r(h]h]h]h]h]uh jh]r jò)r }r (hUh}r (U anchornameU #see-alsoUrefurij‡h]h]h]h]h]Uinternalˆuh jh]r hXSEE ALSOr…r}r(hXSEE ALSOh j ubah!júubah!jûubah!j$ubjè)r}r(hUh}r(h]h]h]h]h]uh jÑh]rjí)r}r(hUh}r(h]h]h]h]h]uh jh]rjò)r}r(hUh}r(U anchornameU#historyUrefurij‡h]h]h]h]h]Uinternalˆuh jh]rhXHISTORYr…r}r(hXHISTORYh jubah!júubah!jûubah!j$ubjè)r }r!(hUh}r"(h]h]h]h]h]uh jÑh]r#jí)r$}r%(hUh}r&(h]h]h]h]h]uh j h]r'jò)r(}r)(hUh}r*(U anchornameU #copyrightUrefurij‡h]h]h]h]h]Uinternalˆuh j$h]r+hX COPYRIGHTr,…r-}r.(hX COPYRIGHTh j(ubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubeh!j$ubah!jéubjjã)r/}r0(hUh}r1(h]h]h]h]h]uh]r2jè)r3}r4(hUh}r5(h]h]h]h]h]uh j/h]r6jí)r7}r8(hUh}r9(h]h]h]h]h]uh j3h]r:jò)r;}r<(hUh}r=(U anchornameUUrefurijh]h]h]h]h]Uinternalˆuh j7h]r>hXVCL Expressionsr?…r@}rA(hj˜h j;ubah!júubah!jûubah!j$ubah!jéubj™jã)rB}rC(hUh}rD(h]h]h]h]h]uh]rEjè)rF}rG(hUh}rH(h]h]h]h]h]uh jBh]rI(jí)rJ}rK(hUh}rL(h]h]h]h]h]uh jFh]rMjò)rN}rO(hUh}rP(U anchornameUUrefurij™h]h]h]h]h]Uinternalˆuh jJh]rQhXAdvanced topicsrR…rS}rT(hj¡h jNubah!júubah!jûubjã)rU}rV(hUh}rW(h]h]h]h]h]uh jFh]rX(jè)rY}rZ(hUh}r[(h]h]h]h]h]uh jUh]r\jí)r]}r^(hUh}r_(h]h]h]h]h]uh jYh]r`jò)ra}rb(hUh}rc(U anchornameU #more-vclUrefurij™h]h]h]h]h]Uinternalˆuh j]h]rdhXMore VCLre…rf}rg(hXMore VCLh jaubah!júubah!jûubah!j$ubjè)rh}ri(hUh}rj(h]h]h]h]h]uh jUh]rkjí)rl}rm(hUh}rn(h]h]h]h]h]uh jhh]rojò)rp}rq(hUh}rr(U anchornameU"#using-in-line-c-to-extend-varnishUrefurij™h]h]h]h]h]Uinternalˆuh jlh]rshX!Using In-line C to extend Varnishrt…ru}rv(hX!Using In-line C to extend Varnishh jpubah!júubah!jûubah!j$ubjè)rw}rx(hUh}ry(h]h]h]h]h]uh jUh]rzjí)r{}r|(hUh}r}(h]h]h]h]h]uh jwh]r~jò)r}r€(hUh}r(U anchornameU#edge-side-includesUrefurij™h]h]h]h]h]Uinternalˆuh j{h]r‚hXEdge Side Includesrƒ…r„}r…(hXEdge Side Includesh jubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubj¢jã)r†}r‡(hUh}rˆ(h]h]h]h]h]uh]r‰jè)rŠ}r‹(hUh}rŒ(h]h]h]h]h]uh j†h]r(jí)rŽ}r(hUh}r(h]h]h]h]h]uh jŠh]r‘jò)r’}r“(hUh}r”(U anchornameUUrefurij¢h]h]h]h]h]Uinternalˆuh jŽh]r•hX varnishadmr–…r—}r˜(hjªh j’ubah!júubah!jûubjã)r™}rš(hUh}r›(h]h]h]h]h]uh jŠh]rœjè)r}rž(hUh}rŸ(h]h]h]h]h]uh j™h]r (jí)r¡}r¢(hUh}r£(h]h]h]h]h]uh jh]r¤jò)r¥}r¦(hUh}r§(U anchornameU##control-a-running-varnish-instanceUrefurij¢h]h]h]h]h]Uinternalˆuh j¡h]r¨hX"Control a running varnish instancer©…rª}r«(hX"Control a running varnish instanceh j¥ubah!júubah!jûubjã)r¬}r­(hUh}r®(h]h]h]h]h]uh jh]r¯(jè)r°}r±(hUh}r²(h]h]h]h]h]uh j¬h]r³jí)r´}rµ(hUh}r¶(h]h]h]h]h]uh j°h]r·jò)r¸}r¹(hUh}rº(U anchornameU #synopsisUrefurij¢h]h]h]h]h]Uinternalˆuh j´h]r»hXSYNOPSISr¼…r½}r¾(hXSYNOPSISh j¸ubah!júubah!jûubah!j$ubjè)r¿}rÀ(hUh}rÁ(h]h]h]h]h]uh j¬h]rÂjí)rÃ}rÄ(hUh}rÅ(h]h]h]h]h]uh j¿h]rÆjò)rÇ}rÈ(hUh}rÉ(U anchornameU #descriptionUrefurij¢h]h]h]h]h]Uinternalˆuh jÃh]rÊhX DESCRIPTIONrË…rÌ}rÍ(hX DESCRIPTIONh jÇubah!júubah!jûubah!j$ubjè)rÎ}rÏ(hUh}rÐ(h]h]h]h]h]uh j¬h]rÑjí)rÒ}rÓ(hUh}rÔ(h]h]h]h]h]uh jÎh]rÕjò)rÖ}r×(hUh}rØ(U anchornameU#optionsUrefurij¢h]h]h]h]h]Uinternalˆuh jÒh]rÙhXOPTIONSrÚ…rÛ}rÜ(hXOPTIONSh jÖubah!júubah!jûubah!j$ubjè)rÝ}rÞ(hUh}rß(h]h]h]h]h]uh j¬h]ràjí)rá}râ(hUh}rã(h]h]h]h]h]uh jÝh]räjò)rå}ræ(hUh}rç(U anchornameU #exit-statusUrefurij¢h]h]h]h]h]Uinternalˆuh jáh]rèhX EXIT STATUSré…rê}rë(hX EXIT STATUSh jåubah!júubah!jûubah!j$ubjè)rì}rí(hUh}rî(h]h]h]h]h]uh j¬h]rïjí)rð}rñ(hUh}rò(h]h]h]h]h]uh jìh]rójò)rô}rõ(hUh}rö(U anchornameU #examplesUrefurij¢h]h]h]h]h]Uinternalˆuh jðh]r÷hXEXAMPLESrø…rù}rú(hXEXAMPLESh jôubah!júubah!jûubah!j$ubjè)rû}rü(hUh}rý(h]h]h]h]h]uh j¬h]rþjí)rÿ}r(hUh}r(h]h]h]h]h]uh jûh]rjò)r}r(hUh}r(U anchornameU #see-alsoUrefurij¢h]h]h]h]h]Uinternalˆuh jÿh]rhXSEE ALSOr…r}r (hXSEE ALSOh jubah!júubah!jûubah!j$ubjè)r }r (hUh}r (h]h]h]h]h]uh j¬h]r jí)r}r(hUh}r(h]h]h]h]h]uh j h]rjò)r}r(hUh}r(U anchornameU#historyUrefurij¢h]h]h]h]h]Uinternalˆuh jh]rhXHISTORYr…r}r(hXHISTORYh jubah!júubah!jûubah!j$ubjè)r}r(hUh}r(h]h]h]h]h]uh j¬h]rjí)r}r(hUh}r(h]h]h]h]h]uh jh]r jò)r!}r"(hUh}r#(U anchornameU #copyrightUrefurij¢h]h]h]h]h]Uinternalˆuh jh]r$hX COPYRIGHTr%…r&}r'(hX COPYRIGHTh j!ubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubeh!j$ubah!jéubj«jã)r(}r)(hUh}r*(h]h]h]h]h]uh]r+jè)r,}r-(hUh}r.(h]h]h]h]h]uh j(h]r/(jí)r0}r1(hUh}r2(h]h]h]h]h]uh j,h]r3jò)r4}r5(hUh}r6(U anchornameUUrefurij«h]h]h]h]h]Uinternalˆuh j0h]r7hX varnishlogr8…r9}r:(hj³h j4ubah!júubah!jûubjã)r;}r<(hUh}r=(h]h]h]h]h]uh j,h]r>jè)r?}r@(hUh}rA(h]h]h]h]h]uh j;h]rB(jí)rC}rD(hUh}rE(h]h]h]h]h]uh j?h]rFjò)rG}rH(hUh}rI(U anchornameU#display-varnish-logsUrefurij«h]h]h]h]h]Uinternalˆuh jCh]rJhXDisplay Varnish logsrK…rL}rM(hXDisplay Varnish logsh jGubah!júubah!jûubjã)rN}rO(hUh}rP(h]h]h]h]h]uh j?h]rQ(jè)rR}rS(hUh}rT(h]h]h]h]h]uh jNh]rUjí)rV}rW(hUh}rX(h]h]h]h]h]uh jRh]rYjò)rZ}r[(hUh}r\(U anchornameU #synopsisUrefurij«h]h]h]h]h]Uinternalˆuh jVh]r]hXSYNOPSISr^…r_}r`(hXSYNOPSISh jZubah!júubah!jûubah!j$ubjè)ra}rb(hUh}rc(h]h]h]h]h]uh jNh]rdjí)re}rf(hUh}rg(h]h]h]h]h]uh jah]rhjò)ri}rj(hUh}rk(U anchornameU #descriptionUrefurij«h]h]h]h]h]Uinternalˆuh jeh]rlhX DESCRIPTIONrm…rn}ro(hX DESCRIPTIONh jiubah!júubah!jûubah!j$ubjè)rp}rq(hUh}rr(h]h]h]h]h]uh jNh]rsjí)rt}ru(hUh}rv(h]h]h]h]h]uh jph]rwjò)rx}ry(hUh}rz(U anchornameU#tagsUrefurij«h]h]h]h]h]Uinternalˆuh jth]r{hXTAGSr|…r}}r~(hXTAGSh jxubah!júubah!jûubah!j$ubjè)r}r€(hUh}r(h]h]h]h]h]uh jNh]r‚jí)rƒ}r„(hUh}r…(h]h]h]h]h]uh jh]r†jò)r‡}rˆ(hUh}r‰(U anchornameU #examplesUrefurij«h]h]h]h]h]Uinternalˆuh jƒh]rŠhXEXAMPLESr‹…rŒ}r(hXEXAMPLESh j‡ubah!júubah!jûubah!j$ubjè)rŽ}r(hUh}r(h]h]h]h]h]uh jNh]r‘jí)r’}r“(hUh}r”(h]h]h]h]h]uh jŽh]r•jò)r–}r—(hUh}r˜(U anchornameU #see-alsoUrefurij«h]h]h]h]h]Uinternalˆuh j’h]r™hXSEE ALSOrš…r›}rœ(hXSEE ALSOh j–ubah!júubah!jûubah!j$ubjè)r}rž(hUh}rŸ(h]h]h]h]h]uh jNh]r jí)r¡}r¢(hUh}r£(h]h]h]h]h]uh jh]r¤jò)r¥}r¦(hUh}r§(U anchornameU#historyUrefurij«h]h]h]h]h]Uinternalˆuh j¡h]r¨hXHISTORYr©…rª}r«(hXHISTORYh j¥ubah!júubah!jûubah!j$ubjè)r¬}r­(hUh}r®(h]h]h]h]h]uh jNh]r¯jí)r°}r±(hUh}r²(h]h]h]h]h]uh j¬h]r³jò)r´}rµ(hUh}r¶(U anchornameU #copyrightUrefurij«h]h]h]h]h]Uinternalˆuh j°h]r·hX COPYRIGHTr¸…r¹}rº(hX COPYRIGHTh j´ubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubeh!j$ubah!jéubj´jã)r»}r¼(hUh}r½(h]h]h]h]h]uh]r¾jè)r¿}rÀ(hUh}rÁ(h]h]h]h]h]uh j»h]rÂ(jí)rÃ}rÄ(hUh}rÅ(h]h]h]h]h]uh j¿h]rÆjò)rÇ}rÈ(hUh}rÉ(U anchornameUUrefurij´h]h]h]h]h]Uinternalˆuh jÃh]rÊhX$Shared Memory Logging and StatisticsrË…rÌ}rÍ(hj¼h jÇubah!júubah!jûubjã)rÎ}rÏ(hUh}rÐ(h]h]h]h]h]uh j¿h]rÑ(jè)rÒ}rÓ(hUh}rÔ(h]h]h]h]h]uh jÎh]rÕjí)rÖ}r×(hUh}rØ(h]h]h]h]h]uh jÒh]rÙjò)rÚ}rÛ(hUh}rÜ(U anchornameU #allocationsUrefurij´h]h]h]h]h]Uinternalˆuh jÖh]rÝhX AllocationsrÞ…rß}rà(hX Allocationsh jÚubah!júubah!jûubah!j$ubjè)rá}râ(hUh}rã(h]h]h]h]h]uh jÎh]räjí)rå}ræ(hUh}rç(h]h]h]h]h]uh jáh]rèjò)ré}rê(hUh}rë(U anchornameU#deallocationsUrefurij´h]h]h]h]h]Uinternalˆuh jåh]rìhX Deallocationsrí…rî}rï(hX Deallocationsh jéubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubj½jã)rð}rñ(hUh}rò(h]h]h]h]h]uh]rójè)rô}rõ(hUh}rö(h]h]h]h]h]uh jðh]r÷jí)rø}rù(hUh}rú(h]h]h]h]h]uh jôh]rûjò)rü}rý(hUh}rþ(U anchornameUUrefurij½h]h]h]h]h]Uinternalˆuh jøh]rÿ(hXDid you call them r…r}r(hjÅh jüubjÆ)r}r(hjÉh}r(h]h]h]h]h]uh jüh]rhXautocrapr…r}r (hUh jubah!jÏubhX tools ?r …r }r (hjÓh jüubeh!júubah!jûubah!j$ubah!jéubjÔjã)r }r(hUh}r(h]h]h]h]h]uh]r(jè)r}r(hUh}r(h]h]h]h]h]uh j h]rjí)r}r(hUh}r(h]h]h]h]h]uh jh]rjò)r}r(hUh}r(U anchornameUUrefurijÔh]h]h]h]h]Uinternalˆuh jh]rhXAdvanced Backend configurationr…r}r(hjÜh jubah!júubah!jûubah!j$ubjè)r }r!(hUh}r"(h]h]h]h]h]uh j h]r#jí)r$}r%(hUh}r&(h]h]h]h]h]uh j h]r'jò)r(}r)(hUh}r*(U anchornameU #directorsUrefurijÔh]h]h]h]h]Uinternalˆuh j$h]r+hX Directorsr,…r-}r.(hX Directorsr/h j(ubah!júubah!jûubah!j$ubjè)r0}r1(hUh}r2(h]h]h]h]h]uh j h]r3jí)r4}r5(hUh}r6(h]h]h]h]h]uh j0h]r7jò)r8}r9(hUh}r:(U anchornameU#health-checksUrefurijÔh]h]h]h]h]Uinternalˆuh j4h]r;hX Health checksr<…r=}r>(hX Health checksr?h j8ubah!júubah!jûubah!j$ubeh!jéubjÝjã)r@}rA(hUh}rB(h]h]h]h]h]uh]rCjè)rD}rE(hUh}rF(h]h]h]h]h]uh j@h]rG(jí)rH}rI(hUh}rJ(h]h]h]h]h]uh jDh]rKjò)rL}rM(hUh}rN(U anchornameUUrefurijÝh]h]h]h]h]Uinternalˆuh jHh]rOhXWhat is Varnish?rP…rQ}rR(hjåh jLubah!júubah!jûubjã)rS}rT(hUh}rU(h]h]h]h]h]uh jDh]rV(jè)rW}rX(hUh}rY(h]h]h]h]h]uh jSh]rZjí)r[}r\(hUh}r](h]h]h]h]h]uh jWh]r^jò)r_}r`(hUh}ra(U anchornameU #performanceUrefurijÝh]h]h]h]h]Uinternalˆuh j[h]rbhX Performancerc…rd}re(hX Performancerfh j_ubah!júubah!jûubah!j$ubjè)rg}rh(hUh}ri(h]h]h]h]h]uh jSh]rjjí)rk}rl(hUh}rm(h]h]h]h]h]uh jgh]rnjò)ro}rp(hUh}rq(U anchornameU #flexibilityUrefurijÝh]h]h]h]h]Uinternalˆuh jkh]rrhX Flexibilityrs…rt}ru(hX Flexibilityrvh joubah!júubah!jûubah!j$ubjè)rw}rx(hUh}ry(h]h]h]h]h]uh jSh]rzjí)r{}r|(hUh}r}(h]h]h]h]h]uh jwh]r~jò)r}r€(hUh}r(U anchornameU#supported-platformsUrefurijÝh]h]h]h]h]Uinternalˆuh j{h]r‚hXSupported platformsrƒ…r„}r…(hXSupported platformsr†h jubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubjæjã)r‡}rˆ(hUh}r‰(h]h]h]h]h]uh]rŠjè)r‹}rŒ(hUh}r(h]h]h]h]h]uh j‡h]rŽjí)r}r(hUh}r‘(h]h]h]h]h]uh j‹h]r’jò)r“}r”(hUh}r•(U anchornameUUrefurijæh]h]h]h]h]Uinternalˆuh jh]r–hXVarnish Glossaryr—…r˜}r™(hjîh j“ubah!júubah!jûubah!j$ubah!jéubjïjã)rš}r›(hUh}rœ(h]h]h]h]h]uh]rjè)rž}rŸ(hUh}r (h]h]h]h]h]uh jšh]r¡(jí)r¢}r£(hUh}r¤(h]h]h]h]h]uh jžh]r¥jò)r¦}r§(hUh}r¨(U anchornameUUrefurijïh]h]h]h]h]Uinternalˆuh j¢h]r©hXVMOD - Varnish Modulesrª…r«}r¬(hj÷h j¦ubah!júubah!jûubjã)r­}r®(hUh}r¯(h]h]h]h]h]uh jžh]r°(jè)r±}r²(hUh}r³(h]h]h]h]h]uh j­h]r´jí)rµ}r¶(hUh}r·(h]h]h]h]h]uh j±h]r¸jò)r¹}rº(hUh}r»(U anchornameU#the-vmod-vcc-fileUrefurijïh]h]h]h]h]Uinternalˆuh jµh]r¼hXThe vmod.vcc filer½…r¾}r¿(hXThe vmod.vcc filerÀh j¹ubah!júubah!jûubah!j$ubjè)rÁ}rÂ(hUh}rÃ(h]h]h]h]h]uh j­h]rÄjí)rÅ}rÆ(hUh}rÇ(h]h]h]h]h]uh jÁh]rÈjò)rÉ}rÊ(hUh}rË(U anchornameU#vcl-and-c-data-typesUrefurijïh]h]h]h]h]Uinternalˆuh jÅh]rÌhXVCL and C data typesrÍ…rÎ}rÏ(hXVCL and C data typesrÐh jÉubah!júubah!jûubah!j$ubjè)rÑ}rÒ(hUh}rÓ(h]h]h]h]h]uh j­h]rÔjí)rÕ}rÖ(hUh}r×(h]h]h]h]h]uh jÑh]rØjò)rÙ}rÚ(hUh}rÛ(U anchornameU#private-pointersUrefurijïh]h]h]h]h]Uinternalˆuh jÕh]rÜhXPrivate PointersrÝ…rÞ}rß(hXPrivate Pointersràh jÙubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubjøjã)rá}râ(hUh}rã(h]h]h]h]h]uh]räjè)rå}ræ(hUh}rç(h]h]h]h]h]uh jáh]rèjí)ré}rê(hUh}rë(h]h]h]h]h]uh jåh]rìjò)rí}rî(hUh}rï(U anchornameUUrefurijøh]h]h]h]h]Uinternalˆuh jéh]rðhX IPv6 Suckagerñ…rò}ró(hjh jíubah!júubah!jûubah!j$ubah!jéubjjã)rô}rõ(hUh}rö(h]h]h]h]h]uh]r÷jè)rø}rù(hUh}rú(h]h]h]h]h]uh jôh]rû(jí)rü}rý(hUh}rþ(h]h]h]h]h]uh jøh]rÿjò)r}r(hUh}r(U anchornameUUrefurijh]h]h]h]h]Uinternalˆuh jüh]rhXDevice detectionr…r}r(hj h jubah!júubah!jûubjã)r}r(hUh}r (h]h]h]h]h]uh jøh]r (jè)r }r (hUh}r (h]h]h]h]h]uh jh]r(jí)r}r(hUh}r(h]h]h]h]h]uh j h]rjò)r}r(hUh}r(U anchornameU,#serve-the-different-content-on-the-same-urlUrefurijh]h]h]h]h]Uinternalˆuh jh]rhX+Serve the different content on the same URLr…r}r(hX+Serve the different content on the same URLrh jubah!júubah!jûubjã)r}r(hUh}r(h]h]h]h]h]uh j h]r(jè)r}r (hUh}r!(h]h]h]h]h]uh jh]r"jí)r#}r$(hUh}r%(h]h]h]h]h]uh jh]r&jò)r'}r((hUh}r)(U anchornameU&#example-1-send-http-header-to-backendUrefurijh]h]h]h]h]Uinternalˆuh j#h]r*hX&Example 1: Send HTTP header to backendr+…r,}r-(hX&Example 1: Send HTTP header to backendr.h j'ubah!júubah!jûubah!j$ubjè)r/}r0(hUh}r1(h]h]h]h]h]uh jh]r2jí)r3}r4(hUh}r5(h]h]h]h]h]uh j/h]r6jò)r7}r8(hUh}r9(U anchornameU*#example-2-normalize-the-user-agent-stringUrefurijh]h]h]h]h]Uinternalˆuh j3h]r:hX*Example 2: Normalize the User-Agent stringr;…r<}r=(hX*Example 2: Normalize the User-Agent stringr>h j7ubah!júubah!jûubah!j$ubjè)r?}r@(hUh}rA(h]h]h]h]h]uh jh]rBjí)rC}rD(hUh}rE(h]h]h]h]h]uh j?h]rFjò)rG}rH(hUh}rI(U anchornameU8#example-3-add-the-device-class-as-a-get-query-parameterUrefurijh]h]h]h]h]Uinternalˆuh jCh]rJhX8Example 3: Add the device class as a GET query parameterrK…rL}rM(hX8Example 3: Add the device class as a GET query parameterrNh jGubah!júubah!jûubah!j$ubeh!jéubeh!j$ubjè)rO}rP(hUh}rQ(h]h]h]h]h]uh jh]rRjí)rS}rT(hUh}rU(h]h]h]h]h]uh jOh]rVjò)rW}rX(hUh}rY(U anchornameU%#different-backend-for-mobile-clientsUrefurijh]h]h]h]h]Uinternalˆuh jSh]rZhX$Different backend for mobile clientsr[…r\}r](hX$Different backend for mobile clientsr^h jWubah!júubah!jûubah!j$ubjè)r_}r`(hUh}ra(h]h]h]h]h]uh jh]rbjí)rc}rd(hUh}re(h]h]h]h]h]uh j_h]rfjò)rg}rh(hUh}ri(U anchornameU#redirecting-mobile-clientsUrefurijh]h]h]h]h]Uinternalˆuh jch]rjhXRedirecting mobile clientsrk…rl}rm(hXRedirecting mobile clientsrnh jgubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubj jã)ro}rp(hUh}rq(h]h]h]h]h]uh]rrjè)rs}rt(hUh}ru(h]h]h]h]h]uh joh]rv(jí)rw}rx(hUh}ry(h]h]h]h]h]uh jsh]rzjò)r{}r|(hUh}r}(U anchornameUUrefurij h]h]h]h]h]Uinternalˆuh jwh]r~hX varnishreplayr…r€}r(hjh j{ubah!júubah!jûubjã)r‚}rƒ(hUh}r„(h]h]h]h]h]uh jsh]r…jè)r†}r‡(hUh}rˆ(h]h]h]h]h]uh j‚h]r‰(jí)rŠ}r‹(hUh}rŒ(h]h]h]h]h]uh j†h]rjò)rŽ}r(hUh}r(U anchornameU#http-traffic-replay-toolUrefurij h]h]h]h]h]Uinternalˆuh jŠh]r‘hXHTTP traffic replay toolr’…r“}r”(hXHTTP traffic replay toolh jŽubah!júubah!jûubjã)r•}r–(hUh}r—(h]h]h]h]h]uh j†h]r˜(jè)r™}rš(hUh}r›(h]h]h]h]h]uh j•h]rœjí)r}rž(hUh}rŸ(h]h]h]h]h]uh j™h]r jò)r¡}r¢(hUh}r£(U anchornameU #synopsisUrefurij h]h]h]h]h]Uinternalˆuh jh]r¤hXSYNOPSISr¥…r¦}r§(hXSYNOPSISh j¡ubah!júubah!jûubah!j$ubjè)r¨}r©(hUh}rª(h]h]h]h]h]uh j•h]r«jí)r¬}r­(hUh}r®(h]h]h]h]h]uh j¨h]r¯jò)r°}r±(hUh}r²(U anchornameU #descriptionUrefurij h]h]h]h]h]Uinternalˆuh j¬h]r³hX DESCRIPTIONr´…rµ}r¶(hX DESCRIPTIONh j°ubah!júubah!jûubah!j$ubjè)r·}r¸(hUh}r¹(h]h]h]h]h]uh j•h]rºjí)r»}r¼(hUh}r½(h]h]h]h]h]uh j·h]r¾jò)r¿}rÀ(hUh}rÁ(U anchornameU #see-alsoUrefurij h]h]h]h]h]Uinternalˆuh j»h]rÂhXSEE ALSOrÃ…rÄ}rÅ(hXSEE ALSOh j¿ubah!júubah!jûubah!j$ubjè)rÆ}rÇ(hUh}rÈ(h]h]h]h]h]uh j•h]rÉjí)rÊ}rË(hUh}rÌ(h]h]h]h]h]uh jÆh]rÍjò)rÎ}rÏ(hUh}rÐ(U anchornameU#historyUrefurij h]h]h]h]h]Uinternalˆuh jÊh]rÑhXHISTORYrÒ…rÓ}rÔ(hXHISTORYh jÎubah!júubah!jûubah!j$ubjè)rÕ}rÖ(hUh}r×(h]h]h]h]h]uh j•h]rØjí)rÙ}rÚ(hUh}rÛ(h]h]h]h]h]uh jÕh]rÜjò)rÝ}rÞ(hUh}rß(U anchornameU #copyrightUrefurij h]h]h]h]h]Uinternalˆuh jÙh]ràhX COPYRIGHTrá…râ}rã(hX COPYRIGHTh jÝubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubeh!j$ubah!jéubjjã)rä}rå(hUh}ræ(h]h]h]h]h]uh]rç(jè)rè}ré(hUh}rê(h]h]h]h]h]uh jäh]rëjí)rì}rí(hUh}rî(h]h]h]h]h]uh jèh]rïjò)rð}rñ(hUh}rò(U anchornameUUrefurijh]h]h]h]h]Uinternalˆuh jìh]róhXbereqrô…rõ}rö(hjh jðubah!júubah!jûubah!j$ubjè)r÷}rø(hUh}rù(h]h]h]h]h]uh jäh]rújí)rû}rü(hUh}rý(h]h]h]h]h]uh j÷h]rþjò)rÿ}r(hUh}r(U anchornameU#berespUrefurijh]h]h]h]h]Uinternalˆuh jûh]rhXberespr…r}r(hXberesph jÿubah!júubah!jûubah!j$ubjè)r}r(hUh}r(h]h]h]h]h]uh jäh]r jí)r }r (hUh}r (h]h]h]h]h]uh jh]r jò)r}r(hUh}r(U anchornameU#clientUrefurijh]h]h]h]h]Uinternalˆuh j h]rhXclientr…r}r(hXclienth jubah!júubah!jûubah!j$ubjè)r}r(hUh}r(h]h]h]h]h]uh jäh]rjí)r}r(hUh}r(h]h]h]h]h]uh jh]rjò)r}r(hUh}r(U anchornameU#nowUrefurijh]h]h]h]h]Uinternalˆuh jh]r hXnowr!…r"}r#(hXnowh jubah!júubah!jûubah!j$ubjè)r$}r%(hUh}r&(h]h]h]h]h]uh jäh]r'jí)r(}r)(hUh}r*(h]h]h]h]h]uh j$h]r+jò)r,}r-(hUh}r.(U anchornameU#objUrefurijh]h]h]h]h]Uinternalˆuh j(h]r/hXobjr0…r1}r2(hXobjh j,ubah!júubah!jûubah!j$ubjè)r3}r4(hUh}r5(h]h]h]h]h]uh jäh]r6jí)r7}r8(hUh}r9(h]h]h]h]h]uh j3h]r:jò)r;}r<(hUh}r=(U anchornameU#reqUrefurijh]h]h]h]h]Uinternalˆuh j7h]r>hXreqr?…r@}rA(hXreqh j;ubah!júubah!jûubah!j$ubjè)rB}rC(hUh}rD(h]h]h]h]h]uh jäh]rEjí)rF}rG(hUh}rH(h]h]h]h]h]uh jBh]rIjò)rJ}rK(hUh}rL(U anchornameU#respUrefurijh]h]h]h]h]Uinternalˆuh jFh]rMhXresprN…rO}rP(hXresph jJubah!júubah!jûubah!j$ubjè)rQ}rR(hUh}rS(h]h]h]h]h]uh jäh]rTjí)rU}rV(hUh}rW(h]h]h]h]h]uh jQh]rXjò)rY}rZ(hUh}r[(U anchornameU#serverUrefurijh]h]h]h]h]Uinternalˆuh jUh]r\hXserverr]…r^}r_(hXserverh jYubah!júubah!jûubah!j$ubeh!jéubjjã)r`}ra(hUh}rb(h]h]h]h]h]uh]rcjè)rd}re(hUh}rf(h]h]h]h]h]uh j`h]rgjí)rh}ri(hUh}rj(h]h]h]h]h]uh jdh]rkjò)rl}rm(hUh}rn(U anchornameUUrefurijh]h]h]h]h]Uinternalˆuh jhh]rohXPut Varnish on port 80rp…rq}rr(hj$h jlubah!júubah!jûubah!j$ubah!jéubj%jã)rs}rt(hUh}ru(h]h]h]h]h]uh]rvjè)rw}rx(hUh}ry(h]h]h]h]h]uh jsh]rz(jí)r{}r|(hUh}r}(h]h]h]h]h]uh jwh]r~jò)r}r€(hUh}r(U anchornameUUrefurij%h]h]h]h]h]Uinternalˆuh j{h]r‚hX Statisticsrƒ…r„}r…(hj-h jubah!júubah!jûubjã)r†}r‡(hUh}rˆ(h]h]h]h]h]uh jwh]r‰(jè)rŠ}r‹(hUh}rŒ(h]h]h]h]h]uh j†h]rjí)rŽ}r(hUh}r(h]h]h]h]h]uh jŠh]r‘jò)r’}r“(hUh}r”(U anchornameU #varnishtopUrefurij%h]h]h]h]h]Uinternalˆuh jŽh]r•hX varnishtopr–…r—}r˜(hX varnishtoph j’ubah!júubah!jûubah!j$ubjè)r™}rš(hUh}r›(h]h]h]h]h]uh j†h]rœjí)r}rž(hUh}rŸ(h]h]h]h]h]uh j™h]r jò)r¡}r¢(hUh}r£(U anchornameU #varnishhistUrefurij%h]h]h]h]h]Uinternalˆuh jh]r¤hX varnishhistr¥…r¦}r§(hX varnishhisth j¡ubah!júubah!jûubah!j$ubjè)r¨}r©(hUh}rª(h]h]h]h]h]uh j†h]r«jí)r¬}r­(hUh}r®(h]h]h]h]h]uh j¨h]r¯jò)r°}r±(hUh}r²(U anchornameU #varnishsizesUrefurij%h]h]h]h]h]Uinternalˆuh j¬h]r³hX varnishsizesr´…rµ}r¶(hX varnishsizesh j°ubah!júubah!jûubah!j$ubjè)r·}r¸(hUh}r¹(h]h]h]h]h]uh j†h]rºjí)r»}r¼(hUh}r½(h]h]h]h]h]uh j·h]r¾jò)r¿}rÀ(hUh}rÁ(U anchornameU #varnishstatUrefurij%h]h]h]h]h]Uinternalˆuh j»h]rÂhX varnishstatrÃ…rÄ}rÅ(hX varnishstath j¿ubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubj.jã)rÆ}rÇ(hUh}rÈ(h]h]h]h]h]uh]rÉjè)rÊ}rË(hUh}rÌ(h]h]h]h]h]uh jÆh]rÍ(jí)rÎ}rÏ(hUh}rÐ(h]h]h]h]h]uh jÊh]rÑjò)rÒ}rÓ(hUh}rÔ(U anchornameUUrefurij.h]h]h]h]h]Uinternalˆuh jÎh]rÕhXPlatform specific notesrÖ…r×}rØ(hj6h jÒubah!júubah!jûubjã)rÙ}rÚ(hUh}rÛ(h]h]h]h]h]uh jÊh]rÜ(jè)rÝ}rÞ(hUh}rß(h]h]h]h]h]uh jÙh]ràjí)rá}râ(hUh}rã(h]h]h]h]h]uh jÝh]räjò)rå}ræ(hUh}rç(U anchornameU3#transparent-hugepages-on-redhat-enterprise-linux-6Urefurij.h]h]h]h]h]Uinternalˆuh jáh]rèhX2Transparent hugepages on Redhat Enterprise Linux 6ré…rê}rë(hX2Transparent hugepages on Redhat Enterprise Linux 6h jåubah!júubah!jûubah!j$ubjè)rì}rí(hUh}rî(h]h]h]h]h]uh jÙh]rïjí)rð}rñ(hUh}rò(h]h]h]h]h]uh jìh]rójò)rô}rõ(hUh}rö(U anchornameU#openvzUrefurij.h]h]h]h]h]Uinternalˆuh jðh]r÷hXOpenVZrø…rù}rú(hXOpenVZh jôubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubj7jã)rû}rü(hUh}rý(h]h]h]h]h]uh]rþjè)rÿ}r(hUh}r(h]h]h]h]h]uh jûh]rjí)r}r(hUh}r(h]h]h]h]h]uh jÿh]rjò)r}r(hUh}r (U anchornameUUrefurij7h]h]h]h]h]Uinternalˆuh jh]r hXBackend serversr …r }r (hj?h jubah!júubah!jûubah!j$ubah!jéubj@jã)r}r(hUh}r(h]h]h]h]h]uh]rjè)r}r(hUh}r(h]h]h]h]h]uh jh]r(jí)r}r(hUh}r(h]h]h]h]h]uh jh]rjò)r}r(hUh}r(U anchornameUUrefurij@h]h]h]h]h]Uinternalˆuh jh]rhXVCLr…r}r (hjHh jubah!júubah!jûubjã)r!}r"(hUh}r#(h]h]h]h]h]uh jh]r$jè)r%}r&(hUh}r'(h]h]h]h]h]uh j!h]r((jí)r)}r*(hUh}r+(h]h]h]h]h]uh j%h]r,jò)r-}r.(hUh}r/(U anchornameU#varnish-configuration-languageUrefurij@h]h]h]h]h]Uinternalˆuh j)h]r0hXVarnish Configuration Languager1…r2}r3(hXVarnish Configuration Languager4h j-ubah!júubah!jûubjã)r5}r6(hUh}r7(h]h]h]h]h]uh j%h]r8(jè)r9}r:(hUh}r;(h]h]h]h]h]uh j5h]r<jí)r=}r>(hUh}r?(h]h]h]h]h]uh j9h]r@jò)rA}rB(hUh}rC(U anchornameU #descriptionUrefurij@h]h]h]h]h]Uinternalˆuh j=h]rDhX DESCRIPTIONrE…rF}rG(hX DESCRIPTIONrHh jAubah!júubah!jûubah!j$ubjè)rI}rJ(hUh}rK(h]h]h]h]h]uh j5h]rL(jí)rM}rN(hUh}rO(h]h]h]h]h]uh jIh]rPjò)rQ}rR(hUh}rS(U anchornameU#syntaxUrefurij@h]h]h]h]h]Uinternalˆuh jMh]rThXSYNTAXrU…rV}rW(hXSYNTAXrXh jQubah!júubah!jûubjã)rY}rZ(hUh}r[(h]h]h]h]h]uh jIh]r\(jè)r]}r^(hUh}r_(h]h]h]h]h]uh jYh]r`jí)ra}rb(hUh}rc(h]h]h]h]h]uh j]h]rdjò)re}rf(hUh}rg(U anchornameU#backend-declarationsUrefurij@h]h]h]h]h]Uinternalˆuh jah]rhhXBackend declarationsri…rj}rk(hXBackend declarationsrlh jeubah!júubah!jûubah!j$ubjè)rm}rn(hUh}ro(h]h]h]h]h]uh jYh]rp(jí)rq}rr(hUh}rs(h]h]h]h]h]uh jmh]rtjò)ru}rv(hUh}rw(U anchornameU #directorsUrefurij@h]h]h]h]h]Uinternalˆuh jqh]rxhX Directorsry…rz}r{(hX Directorsr|h juubah!júubah!jûubjã)r}}r~(hUh}r(h]h]h]h]h]uh jmh]r€(jè)r}r‚(hUh}rƒ(h]h]h]h]h]uh j}h]r„(jí)r…}r†(hUh}r‡(h]h]h]h]h]uh jh]rˆjò)r‰}rŠ(hUh}r‹(U anchornameU#the-family-of-random-directorsUrefurij@h]h]h]h]h]Uinternalˆuh j…h]rŒhXThe family of random directorsr…rŽ}r(hXThe family of random directorsrh j‰ubah!júubah!jûubjã)r‘}r’(hUh}r“(h]h]h]h]h]uh jh]r”(jè)r•}r–(hUh}r—(h]h]h]h]h]uh j‘h]r˜jí)r™}rš(hUh}r›(h]h]h]h]h]uh j•h]rœjò)r}rž(hUh}rŸ(U anchornameU#the-random-directorUrefurij@h]h]h]h]h]Uinternalˆuh j™h]r hXThe random directorr¡…r¢}r£(hXThe random directorr¤h jubah!júubah!jûubah!j$ubjè)r¥}r¦(hUh}r§(h]h]h]h]h]uh j‘h]r¨jí)r©}rª(hUh}r«(h]h]h]h]h]uh j¥h]r¬jò)r­}r®(hUh}r¯(U anchornameU#the-client-directorUrefurij@h]h]h]h]h]Uinternalˆuh j©h]r°hXThe client directorr±…r²}r³(hXThe client directorr´h j­ubah!júubah!jûubah!j$ubjè)rµ}r¶(hUh}r·(h]h]h]h]h]uh j‘h]r¸jí)r¹}rº(hUh}r»(h]h]h]h]h]uh jµh]r¼jò)r½}r¾(hUh}r¿(U anchornameU#the-hash-directorUrefurij@h]h]h]h]h]Uinternalˆuh j¹h]rÀhXThe hash directorrÁ…rÂ}rÃ(hXThe hash directorrÄh j½ubah!júubah!jûubah!j$ubeh!jéubeh!j$ubjè)rÅ}rÆ(hUh}rÇ(h]h]h]h]h]uh j}h]rÈjí)rÉ}rÊ(hUh}rË(h]h]h]h]h]uh jÅh]rÌjò)rÍ}rÎ(hUh}rÏ(U anchornameU#the-round-robin-directorUrefurij@h]h]h]h]h]Uinternalˆuh jÉh]rÐhXThe round-robin directorrÑ…rÒ}rÓ(hXThe round-robin directorrÔh jÍubah!júubah!jûubah!j$ubjè)rÕ}rÖ(hUh}r×(h]h]h]h]h]uh j}h]rØjí)rÙ}rÚ(hUh}rÛ(h]h]h]h]h]uh jÕh]rÜjò)rÝ}rÞ(hUh}rß(U anchornameU#the-dns-directorUrefurij@h]h]h]h]h]Uinternalˆuh jÙh]ràhXThe DNS directorrá…râ}rã(hXThe DNS directorräh jÝubah!júubah!jûubah!j$ubjè)rå}ræ(hUh}rç(h]h]h]h]h]uh j}h]rèjí)ré}rê(hUh}rë(h]h]h]h]h]uh jåh]rìjò)rí}rî(hUh}rï(U anchornameU#the-fallback-directorUrefurij@h]h]h]h]h]Uinternalˆuh jéh]rðhXThe fallback directorrñ…rò}ró(hXThe fallback directorrôh jíubah!júubah!jûubah!j$ubeh!jéubeh!j$ubjè)rõ}rö(hUh}r÷(h]h]h]h]h]uh jYh]røjí)rù}rú(hUh}rû(h]h]h]h]h]uh jõh]rüjò)rý}rþ(hUh}rÿ(U anchornameU#backend-probesUrefurij@h]h]h]h]h]Uinternalˆuh jùh]rhXBackend probesr…r}r(hXBackend probesrh jýubah!júubah!jûubah!j$ubjè)r}r(hUh}r(h]h]h]h]h]uh jYh]rjí)r }r (hUh}r (h]h]h]h]h]uh jh]r jò)r }r(hUh}r(U anchornameU#aclsUrefurij@h]h]h]h]h]Uinternalˆuh j h]rhXACLsr…r}r(hXACLsrh j ubah!júubah!jûubah!j$ubjè)r}r(hUh}r(h]h]h]h]h]uh jYh]rjí)r}r(hUh}r(h]h]h]h]h]uh jh]rjò)r}r(hUh}r(U anchornameU#regular-expressionsUrefurij@h]h]h]h]h]Uinternalˆuh jh]r hXRegular Expressionsr!…r"}r#(hXRegular Expressionsr$h jubah!júubah!jûubah!j$ubjè)r%}r&(hUh}r'(h]h]h]h]h]uh jYh]r((jí)r)}r*(hUh}r+(h]h]h]h]h]uh j%h]r,jò)r-}r.(hUh}r/(U anchornameU #functionsUrefurij@h]h]h]h]h]Uinternalˆuh j)h]r0hX Functionsr1…r2}r3(hX Functionsr4h j-ubah!júubah!jûubjã)r5}r6(hUh}r7(h]h]h]h]h]uh j%h]r8(jè)r9}r:(hUh}r;(h]h]h]h]h]uh j5h]r<jí)r=}r>(hUh}r?(h]h]h]h]h]uh j9h]r@jò)rA}rB(hUh}rC(U anchornameU #subroutinesUrefurij@h]h]h]h]h]Uinternalˆuh j=h]rDhX SubroutinesrE…rF}rG(hX SubroutinesrHh jAubah!júubah!jûubah!j$ubjè)rI}rJ(hUh}rK(h]h]h]h]h]uh j5h]rLjí)rM}rN(hUh}rO(h]h]h]h]h]uh jIh]rPjò)rQ}rR(hUh}rS(U anchornameU#multiple-subroutinesUrefurij@h]h]h]h]h]Uinternalˆuh jMh]rThXMultiple subroutinesrU…rV}rW(hXMultiple subroutinesrXh jQubah!júubah!jûubah!j$ubjè)rY}rZ(hUh}r[(h]h]h]h]h]uh j5h]r\jí)r]}r^(hUh}r_(h]h]h]h]h]uh jYh]r`jò)ra}rb(hUh}rc(U anchornameU #variablesUrefurij@h]h]h]h]h]Uinternalˆuh j]h]rdhX Variablesre…rf}rg(hX Variablesrhh jaubah!júubah!jûubah!j$ubeh!jéubeh!j$ubjè)ri}rj(hUh}rk(h]h]h]h]h]uh jYh]rljí)rm}rn(hUh}ro(h]h]h]h]h]uh jih]rpjò)rq}rr(hUh}rs(U anchornameU#grace-and-saint-modeUrefurij@h]h]h]h]h]Uinternalˆuh jmh]rthXGrace and saint moderu…rv}rw(hXGrace and saint moderxh jqubah!júubah!jûubah!j$ubeh!jéubeh!j$ubjè)ry}rz(hUh}r{(h]h]h]h]h]uh j5h]r|jí)r}}r~(hUh}r(h]h]h]h]h]uh jyh]r€jò)r}r‚(hUh}rƒ(U anchornameU #examplesUrefurij@h]h]h]h]h]Uinternalˆuh j}h]r„hXEXAMPLESr……r†}r‡(hXEXAMPLESrˆh jubah!júubah!jûubah!j$ubjè)r‰}rŠ(hUh}r‹(h]h]h]h]h]uh j5h]rŒjí)r}rŽ(hUh}r(h]h]h]h]h]uh j‰h]rjò)r‘}r’(hUh}r“(U anchornameU #see-alsoUrefurij@h]h]h]h]h]Uinternalˆuh jh]r”hXSEE ALSOr•…r–}r—(hXSEE ALSOr˜h j‘ubah!júubah!jûubah!j$ubjè)r™}rš(hUh}r›(h]h]h]h]h]uh j5h]rœjí)r}rž(hUh}rŸ(h]h]h]h]h]uh j™h]r jò)r¡}r¢(hUh}r£(U anchornameU#historyUrefurij@h]h]h]h]h]Uinternalˆuh jh]r¤hXHISTORYr¥…r¦}r§(hXHISTORYr¨h j¡ubah!júubah!jûubah!j$ubjè)r©}rª(hUh}r«(h]h]h]h]h]uh j5h]r¬jí)r­}r®(hUh}r¯(h]h]h]h]h]uh j©h]r°jò)r±}r²(hUh}r³(U anchornameU #copyrightUrefurij@h]h]h]h]h]Uinternalˆuh j­h]r´hX COPYRIGHTrµ…r¶}r·(hX COPYRIGHTr¸h j±ubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubeh!j$ubah!jéubjIjã)r¹}rº(hUh}r»(h]h]h]h]h]uh]r¼jè)r½}r¾(hUh}r¿(h]h]h]h]h]uh j¹h]rÀ(jí)rÁ}rÂ(hUh}rÃ(h]h]h]h]h]uh j½h]rÄjò)rÅ}rÆ(hUh}rÇ(U anchornameUUrefurijIh]h]h]h]h]Uinternalˆuh jÁh]rÈhXPoul-Hennings random outburstsrÉ…rÊ}rË(hjQh jÅubah!júubah!jûubjã)rÌ}rÍ(hUh}rÎ(h]h]h]h]h]uh j½h]rÏj2)rÐ}rÑ(hUh}rÒ(UnumberedKUparentjIU titlesonly‰Uglob‰h]h]h]h]h]Uentries]rÓ(NjÓ†rÔNjÔ†rÕNjÕ†rÖNjÖ†r×Nj׆rØNj؆rÙNjÙ†rÚNjÚ†rÛNjÛ†rÜNj܆rÝNj݆rÞNjÞ†rßNj߆ràeUhidden‰U includefiles]rá(jÓjÔjÕjÖj×jØjÙjÚjÛjÜjÝjÞjßeUmaxdepthJÿÿÿÿuh jÌh]h!j5ubah!jéubeh!j$ubah!jéubjRjã)râ}rã(hUh}rä(h]h]h]h]h]uh]råjè)ræ}rç(hUh}rè(h]h]h]h]h]uh jâh]ré(jí)rê}rë(hUh}rì(h]h]h]h]h]uh jæh]ríjò)rî}rï(hUh}rð(U anchornameUUrefurijRh]h]h]h]h]Uinternalˆuh jêh]rñhX varnishsizesrò…ró}rô(hjZh jîubah!júubah!jûubjã)rõ}rö(hUh}r÷(h]h]h]h]h]uh jæh]røjè)rù}rú(hUh}rû(h]h]h]h]h]uh jõh]rü(jí)rý}rþ(hUh}rÿ(h]h]h]h]h]uh jùh]rjò)r}r(hUh}r(U anchornameU&#varnish-object-size-request-histogramUrefurijRh]h]h]h]h]Uinternalˆuh jýh]rhX%Varnish object size request histogramr…r}r(hX%Varnish object size request histogramh jubah!júubah!jûubjã)r}r (hUh}r (h]h]h]h]h]uh jùh]r (jè)r }r (hUh}r(h]h]h]h]h]uh jh]rjí)r}r(hUh}r(h]h]h]h]h]uh j h]rjò)r}r(hUh}r(U anchornameU #synopsisUrefurijRh]h]h]h]h]Uinternalˆuh jh]rhXSYNOPSISr…r}r(hXSYNOPSISh jubah!júubah!jûubah!j$ubjè)r}r(hUh}r(h]h]h]h]h]uh jh]rjí)r}r (hUh}r!(h]h]h]h]h]uh jh]r"jò)r#}r$(hUh}r%(U anchornameU #descriptionUrefurijRh]h]h]h]h]Uinternalˆuh jh]r&hX DESCRIPTIONr'…r(}r)(hX DESCRIPTIONh j#ubah!júubah!jûubah!j$ubjè)r*}r+(hUh}r,(h]h]h]h]h]uh jh]r-jí)r.}r/(hUh}r0(h]h]h]h]h]uh j*h]r1jò)r2}r3(hUh}r4(U anchornameU #see-alsoUrefurijRh]h]h]h]h]Uinternalˆuh j.h]r5hXSEE ALSOr6…r7}r8(hXSEE ALSOh j2ubah!júubah!jûubah!j$ubjè)r9}r:(hUh}r;(h]h]h]h]h]uh jh]r<jí)r=}r>(hUh}r?(h]h]h]h]h]uh j9h]r@jò)rA}rB(hUh}rC(U anchornameU#historyUrefurijRh]h]h]h]h]Uinternalˆuh j=h]rDhXHISTORYrE…rF}rG(hXHISTORYh jAubah!júubah!jûubah!j$ubjè)rH}rI(hUh}rJ(h]h]h]h]h]uh jh]rKjí)rL}rM(hUh}rN(h]h]h]h]h]uh jHh]rOjò)rP}rQ(hUh}rR(U anchornameU #copyrightUrefurijRh]h]h]h]h]Uinternalˆuh jLh]rShX COPYRIGHTrT…rU}rV(hX COPYRIGHTh jPubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubeh!j$ubah!jéubj[jã)rW}rX(hUh}rY(h]h]h]h]h]uh]rZjè)r[}r\(hUh}r](h]h]h]h]h]uh jWh]r^(jí)r_}r`(hUh}ra(h]h]h]h]h]uh j[h]rbjò)rc}rd(hUh}re(U anchornameUUrefurij[h]h]h]h]h]Uinternalˆuh j_h]rfhXAchieving a high hitraterg…rh}ri(hjch jcubah!júubah!jûubjã)rj}rk(hUh}rl(h]h]h]h]h]uh j[h]rm(jè)rn}ro(hUh}rp(h]h]h]h]h]uh jjh]rqjí)rr}rs(hUh}rt(h]h]h]h]h]uh jnh]rujò)rv}rw(hUh}rx(U anchornameU#tool-varnishtopUrefurij[h]h]h]h]h]Uinternalˆuh jrh]ryhXTool: varnishtoprz…r{}r|(hXTool: varnishtopr}h jvubah!júubah!jûubah!j$ubjè)r~}r(hUh}r€(h]h]h]h]h]uh jjh]rjí)r‚}rƒ(hUh}r„(h]h]h]h]h]uh j~h]r…jò)r†}r‡(hUh}rˆ(U anchornameU#tool-varnishlogUrefurij[h]h]h]h]h]Uinternalˆuh j‚h]r‰hXTool: varnishlogrŠ…r‹}rŒ(hXTool: varnishlogrh j†ubah!júubah!jûubah!j$ubjè)rŽ}r(hUh}r(h]h]h]h]h]uh jjh]r‘jí)r’}r“(hUh}r”(h]h]h]h]h]uh jŽh]r•jò)r–}r—(hUh}r˜(U anchornameU#tool-lwp-requestUrefurij[h]h]h]h]h]Uinternalˆuh j’h]r™hXTool: lwp-requestrš…r›}rœ(hXTool: lwp-requestrh j–ubah!júubah!jûubah!j$ubjè)rž}rŸ(hUh}r (h]h]h]h]h]uh jjh]r¡jí)r¢}r£(hUh}r¤(h]h]h]h]h]uh jžh]r¥jò)r¦}r§(hUh}r¨(U anchornameU#tool-live-http-headersUrefurij[h]h]h]h]h]Uinternalˆuh j¢h]r©hXTool: Live HTTP Headersrª…r«}r¬(hXTool: Live HTTP Headersr­h j¦ubah!júubah!jûubah!j$ubjè)r®}r¯(hUh}r°(h]h]h]h]h]uh jjh]r±jí)r²}r³(hUh}r´(h]h]h]h]h]uh j®h]rµjò)r¶}r·(hUh}r¸(U anchornameU#the-role-of-http-headersUrefurij[h]h]h]h]h]Uinternalˆuh j²h]r¹hXThe role of HTTP Headersrº…r»}r¼(hXThe role of HTTP Headersr½h j¶ubah!júubah!jûubah!j$ubjè)r¾}r¿(hUh}rÀ(h]h]h]h]h]uh jjh]rÁjí)rÂ}rÃ(hUh}rÄ(h]h]h]h]h]uh j¾h]rÅjò)rÆ}rÇ(hUh}rÈ(U anchornameU#cache-controlUrefurij[h]h]h]h]h]Uinternalˆuh jÂh]rÉhX Cache-ControlrÊ…rË}rÌ(hX Cache-ControlrÍh jÆubah!júubah!jûubah!j$ubjè)rÎ}rÏ(hUh}rÐ(h]h]h]h]h]uh jjh]rÑjí)rÒ}rÓ(hUh}rÔ(h]h]h]h]h]uh jÎh]rÕjò)rÖ}r×(hUh}rØ(U anchornameU#ageUrefurij[h]h]h]h]h]Uinternalˆuh jÒh]rÙhXAgerÚ…rÛ}rÜ(hXAgerÝh jÖubah!júubah!jûubah!j$ubjè)rÞ}rß(hUh}rà(h]h]h]h]h]uh jjh]rájí)râ}rã(hUh}rä(h]h]h]h]h]uh jÞh]råjò)ræ}rç(hUh}rè(U anchornameU#pragmaUrefurij[h]h]h]h]h]Uinternalˆuh jâh]réhXPragmarê…rë}rì(hXPragmaríh jæubah!júubah!jûubah!j$ubjè)rî}rï(hUh}rð(h]h]h]h]h]uh jjh]rñjí)rò}ró(hUh}rô(h]h]h]h]h]uh jîh]rõjò)rö}r÷(hUh}rø(U anchornameU#authorizationUrefurij[h]h]h]h]h]Uinternalˆuh jòh]rùhX Authorizationrú…rû}rü(hX Authorizationrýh jöubah!júubah!jûubah!j$ubjè)rþ}rÿ(hUh}r(h]h]h]h]h]uh jjh]rjí)r}r(hUh}r(h]h]h]h]h]uh jþh]rjò)r}r(hUh}r(U anchornameU #overriding-the-time-to-live-ttlUrefurij[h]h]h]h]h]Uinternalˆuh jh]r hX!Overriding the time-to-live (ttl)r …r }r (hX!Overriding the time-to-live (ttl)r h jubah!júubah!jûubah!j$ubjè)r}r(hUh}r(h]h]h]h]h]uh jjh]rjí)r}r(hUh}r(h]h]h]h]h]uh jh]rjò)r}r(hUh}r(U anchornameU;#forcing-caching-for-certain-requests-and-certain-responsesUrefurij[h]h]h]h]h]Uinternalˆuh jh]rhX:Forcing caching for certain requests and certain responsesr…r}r(hX:Forcing caching for certain requests and certain responsesrh jubah!júubah!jûubah!j$ubjè)r}r(hUh}r (h]h]h]h]h]uh jjh]r!jí)r"}r#(hUh}r$(h]h]h]h]h]uh jh]r%jò)r&}r'(hUh}r((U anchornameU#normalizing-your-namespaceUrefurij[h]h]h]h]h]Uinternalˆuh j"h]r)hXNormalizing your namespacer*…r+}r,(hXNormalizing your namespacer-h j&ubah!júubah!jûubah!j$ubjè)r.}r/(hUh}r0(h]h]h]h]h]uh jjh]r1jí)r2}r3(hUh}r4(h]h]h]h]h]uh j.h]r5jò)r6}r7(hUh}r8(U anchornameU*#ways-of-increasing-your-hitrate-even-moreUrefurij[h]h]h]h]h]Uinternalˆuh j2h]r9hX)Ways of increasing your hitrate even morer:…r;}r<(hX)Ways of increasing your hitrate even morer=h j6ubah!júubah!jûubah!j$ubeh!jéubeh!j$ubah!jéubuU indexentriesr>}r?(h ]h#]h,]h5]h>]hG]hP]hY]hb]hk]ht]h}]h†]h]h˜]h¡]hª]h³]r@((UsinglerAjjUmainrBtrC(jAjjjBtrD(jAj j!jBtrE(jAjÔjÕjBtrF(jAjôjõjBtrG(jAjØjÙjBtrH(jAjjjBtrI(jAjjjBtrJ(jAjïjðjBtrK(jAjÚjÛjBtrL(jAjjjBtrM(jAjñjòjBtrN(jAjöj÷jBtrO(jAjÒjÓjBtrP(jAjjjBtrQ(jAj j jBtrR(jAjjjBtrS(jAj"j#jBtrT(jAjçjèjBtrU(jAjjjBtrVeh¼]hÅ]hÎ]h×]hà]hé]hò]hû]j]j ]j]j-]j6]j?]jH]jQ]jZ]jc]jl]ju]j~]j‡]j]j™]j¢]j«]j´]j½]jÔ]jÝ]jæ]rW((jAjújûjBtrX(jAjíjîjBtrY(jAjàjájBtrZ(jAjÞjßjBtr[(jAjjjBtr\(jAjøjùjBtr](jAjåjæjBtr^(jAjjjBtr_(jAjþjÿjBtr`(jAjÖj×jBtra(jAjÜjÝjBtrb(jAjÐjÑjBtrc(jAj j jBtrd(jAjéjêjBtre(jAXvarnishd (NB: with 'd')jójBtrf(jAjj jBtrg(jAjjjBtrh(jAjüjýjBtri(jAjëjìjBtrj(jAjjjBtrk(jAjjjBtrl(jAXVCLjâjBtrm(jAjãjäjBtrnejï]jø]j]j ]j]j]j%]j.]j7]j@]jI]jR]j[]uUall_docsro}rp(h GAÔ§¢[,h#GAÔ§¢-ñh,GAÔ§¢! .h5GAÔ§¢CENh>GAÔ§¢\vBhGGAÔ§¢"U&hPGAÔ§¢)µhYGAÔ§¢G+íhbGAÔ§¢HuXhkGAÔ§¢mÓ³htGAÔ§¢c«2h}GAÔ§¢&øh†GAÔ§¢ïáhGAÔ§¢$mßh˜GAÔ§¢kýøh¡GAÔ§¢_¹€hªGAÔ§¢bªLh³GAÔ§¢/OHh¼GAÔ§¢÷ùhÅGAÔ§¢hŠøhÎGAÔ§¢g†h×GAÔ§¢ 8 hàGAÔ§¢`nãhéGAÔ§¢”[hòGAÔ§¢n3QhûGAÔ§¢kc²jGAÔ§¢j j GAÔ§¢+øßjGAÔ§¢&I#j-GAÔ§¢iZ–j6GAÔ§¢j?GAÔ§¢}xjHGAÔ§¢<—$jQGAÔ§¢(èŠjZGAÔ§¢(bÇjcGAÔ§¢*µRjlGAÔ§¢üjuGAÔ§¢eÈ`j~GAÔ§¢>Ëój‡GAÔ§¢I÷ìjGAÔ§¢+|-j™GAÔ§¢^{Ùj¢GAÔ§¢0ž0j«GAÔ§¢A}j´GAÔ§¢, ýj½GAÔ§¢,™jÔGAÔ§¢]Þ˜jÝGAÔ§¢fI€jæGAÔ§¢V;jïGAÔ§¢Y!÷jøGAÔ§¢#hjGAÔ§¢aûÎj GAÔ§¢D=£jGAÔ§¢W+™jGAÔ§¢hêÝj%GAÔ§¢j³Fj.GAÔ§¢gTj7GAÔ§¢^øÂj@GAÔ§¢Q¯ÍjIGAÔ§¢"½”jRGAÔ§¢E´j[GAÔ§¢e=«uj²}rq(jÕˆjÖ‰jÄKjÚ‰jɉjìjíjó‰jÏcsphinx.util.nodes WarningStream rr)rs}rt(U_rerucre _compile rvU+\((DEBUG|INFO|WARNING|ERROR|SEVERE)/[0-4]\)rwK†RrxUwarnfuncryNubj×hj¸j¹jèˆjàjáuUfiles_to_rebuildrz}r{(jXh]r|j a…Rr}jÏh]r~héa…RrjÜh]r€jIa…RrjHh]r‚j a…RrƒjZh]r„j a…Rr…j×h]r†jIa…Rr‡jÕh]rˆjIa…Rr‰jNh]rŠj a…Rr‹jPh]rŒj a…Rrj»h]rŽjua…RrjÍh]rhéa…Rr‘jÛh]r’jIa…Rr“jÀh]r”jua…Rr•j¶h]r–jua…Rr—jÇh]r˜jua…Rr™j>h]ršj a…Rr›j¼h]rœjua…Rrj³h]ržh¼a…RrŸj¹h]r jua…Rr¡jÚh]r¢jIa…Rr£j¿h]r¤jua…Rr¥j°h]r¦h¼a…Rr§jÅh]r¨jua…Rr©jÊh]rªjua…Rr«j¸h]r¬jua…Rr­j²h]r®h¼a…Rr¯jßh]r°jIa…Rr±jºh]r²jua…Rr³jÐh]r´héa…RrµjÌh]r¶héa…Rr·jBh]r¸j a…Rr¹jÝh]rºjIa…Rr»jÔh]r¼jIa…Rr½jÓh]r¾jIa…Rr¿jÎh]rÀhéa…RrÁj±h]rÂh¼a…RrÃjDh]rÄj a…RrÅjRh]rÆj a…RrÇjØh]rÈjIa…RrÉjÉh]rÊjua…RrËj@h]rÌj a…RrÍjFh]rÎj a…RrÏjTh]rÐj a…RrÑjÂh]rÒjua…RrÓjÞh]rÔjIa…RrÕjÃh]rÖjua…Rr×j´h]rØh¼a…RrÙjVh]rÚj a…RrÛjÙh]rÜjIa…RrÝjÆh]rÞjua…RrßjJh]ràj a…RrájÁh]râjua…RrãjÈh]räjua…Rråj½h]ræjua…RrçjÄh]rèjua…Rréj·h]rêjua…Rrëj<h]rìj a…RríjÖh]rîjIa…RrïjLh]rðj a…Rrñj¾h]ròjua…RróuUtoc_secnumbersrô}U_nitpick_ignorerõh]…Rröub.varnish-3.0.5/doc/sphinx/=build/doctrees/phk/0000755000175000017500000000000012247037213016037 500000000000000varnish-3.0.5/doc/sphinx/=build/doctrees/phk/index.doctree0000644000175000017500000000753712247037213020451 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(XphkqˆXpoul-hennings random outburstsqNuUsubstitution_defsq}q Uparse_messagesq ]q Ucurrent_sourceq NU decorationq NUautofootnote_startqKUnameidsq}q(hUphkqhUpoul-hennings-random-outburstsquUchildrenq]q(cdocutils.nodes target q)q}q(U rawsourceqX.. _phk:UparentqhUsourceqcdocutils.nodes reprunicode qX-/home/tfheen/varnish/doc/sphinx/phk/index.rstq…q}qbUtagnameqUtargetq U attributesq!}q"(Uidsq#]Ubackrefsq$]Udupnamesq%]Uclassesq&]Unamesq']Urefidq(huUlineq)KUdocumentq*hh]ubcdocutils.nodes section q+)q,}q-(hUhhhhUexpect_referenced_by_nameq.}q/hhshUsectionq0h!}q1(h%]h&]h$]h#]q2(hheh']q3(hheuh)Kh*hUexpect_referenced_by_idq4}q5hhsh]q6(cdocutils.nodes title q7)q8}q9(hXPoul-Hennings random outburstsq:hh,hhhUtitleq;h!}q<(h%]h&]h$]h#]h']uh)Kh*hh]q=cdocutils.nodes Text q>XPoul-Hennings random outburstsq?…q@}qA(hh:hh8ubaubcdocutils.nodes paragraph qB)qC}qD(hX9You may or may not want to know what Poul-Henning thinks.qEhh,hhhU paragraphqFh!}qG(h%]h&]h$]h#]h']uh)Kh*hh]qHh>X9You may or may not want to know what Poul-Henning thinks.qI…qJ}qK(hhEhhCubaubcdocutils.nodes compound qL)qM}qN(hUhh,hhhUcompoundqOh!}qP(h%]h&]qQUtoctree-wrapperqRah$]h#]h']uh)Kh*hh]qScsphinx.addnodes toctree qT)qU}qV(hUhhMhhhUtoctreeqWh!}qX(UnumberedqYKhU phk/indexqZU titlesonlyq[‰Uglobq\‰h#]h$]h%]h&]h']Uentriesq]]q^(NXphk/varnish_does_not_hashq_†q`NXphk/thetoolsweworkwithqa†qbNXphk/three-zeroqc†qdNXphk/sslqe†qfNXphk/gzipqg†qhNX phk/vcl_exprqi†qjNXphk/ipv6suckageqk†qlNX phk/backendsqm†qnNX phk/platformsqo†qpNX phk/barriersqq†qrNX phk/thoughtsqs†qtNX phk/autocrapqu†qvNX phk/sphinxqw†qxeUhiddenqy‰U includefilesqz]q{(h_hahchehghihkhmhohqhshuhweUmaxdepthq|Jÿÿÿÿuh)K h]ubaubeubehUU transformerq}NU footnote_refsq~}qUrefnamesq€}qUsymbol_footnotesq‚]qƒUautofootnote_refsq„]q…Usymbol_footnote_refsq†]q‡U citationsqˆ]q‰h*hU current_lineqŠNUtransform_messagesq‹]qŒcdocutils.nodes system_message q)qŽ}q(hUh!}q(h%]UlevelKh#]h$]Usourcehh&]h']UlineKUtypeUINFOq‘uh]q’hB)q“}q”(hUh!}q•(h%]h&]h$]h#]h']uhhŽh]q–h>X)Hyperlink target "phk" is not referenced.q—…q˜}q™(hUhh“ubahhFubahUsystem_messageqšubaUreporterq›NUid_startqœKU autofootnotesq]qžU citation_refsqŸ}q Uindirect_targetsq¡]q¢Usettingsq£(cdocutils.frontend Values q¤oq¥}q¦(Ufootnote_backlinksq§KUrecord_dependenciesq¨NU rfc_base_urlq©Uhttp://tools.ietf.org/html/qªU tracebackq«ˆUpep_referencesq¬NUstrip_commentsq­NU toc_backlinksq®Uentryq¯U language_codeq°Uenq±U datestampq²NU report_levelq³KU _destinationq´NU halt_levelqµKU strip_classesq¶Nh;NUerror_encoding_error_handlerq·Ubackslashreplaceq¸Udebugq¹NUembed_stylesheetqº‰Uoutput_encoding_error_handlerq»Ustrictq¼U sectnum_xformq½KUdump_transformsq¾NU docinfo_xformq¿KUwarning_streamqÀNUpep_file_url_templateqÁUpep-%04dqÂUexit_status_levelqÃKUconfigqÄNUstrict_visitorqÅNUcloak_email_addressesqƈUtrim_footnote_reference_spaceqljUenvqÈNUdump_pseudo_xmlqÉNUexpose_internalsqÊNUsectsubtitle_xformqˉU source_linkqÌNUrfc_referencesqÍNUoutput_encodingqÎUutf-8qÏU source_urlqÐNUinput_encodingqÑU utf-8-sigqÒU_disable_configqÓNU id_prefixqÔUU tab_widthqÕKUerror_encodingqÖUUTF-8q×U_sourceqØU-/home/tfheen/varnish/doc/sphinx/phk/index.rstqÙUgettext_compactqÚˆU generatorqÛNUdump_internalsqÜNU smart_quotesq݉U pep_base_urlqÞUhttp://www.python.org/dev/peps/qßUsyntax_highlightqàUlongqáUinput_encoding_error_handlerqâh¼Uauto_id_prefixqãUidqäUdoctitle_xformqå‰Ustrip_elements_with_classesqæNU _config_filesqç]qèUfile_insertion_enabledqéKU raw_enabledqêKU dump_settingsqëNubUsymbol_footnote_startqìKUidsqí}qî(hh,hh,uUsubstitution_namesqï}qðhh*h!}qñ(h%]h#]h$]Usourcehh&]h']uU footnotesqò]qóUrefidsqô}qõh]qöhasub.varnish-3.0.5/doc/sphinx/=build/doctrees/phk/thoughts.doctree0000644000175000017500000001444612247037213021204 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(Xwhat were they thinking ?qNX phk_thoughtsqˆuUsubstitution_defsq}q Uparse_messagesq ]q Ucurrent_sourceq NU decorationq NUautofootnote_startqKUnameidsq}q(hUwhat-were-they-thinkingqhU phk-thoughtsquUchildrenq]q(cdocutils.nodes target q)q}q(U rawsourceqX.. _phk_thoughts:UparentqhUsourceqcdocutils.nodes reprunicode qX0/home/tfheen/varnish/doc/sphinx/phk/thoughts.rstq…q}qbUtagnameqUtargetq U attributesq!}q"(Uidsq#]Ubackrefsq$]Udupnamesq%]Uclassesq&]Unamesq']Urefidq(huUlineq)KUdocumentq*hh]ubcdocutils.nodes section q+)q,}q-(hUhhhhUexpect_referenced_by_nameq.}q/hhshUsectionq0h!}q1(h%]h&]h$]h#]q2(hheh']q3(hheuh)Kh*hUexpect_referenced_by_idq4}q5hhsh]q6(cdocutils.nodes title q7)q8}q9(hXWhat were they thinking ?q:hh,hhhUtitleq;h!}q<(h%]h&]h$]h#]h']uh)Kh*hh]q=cdocutils.nodes Text q>XWhat were they thinking ?q?…q@}qA(hh:hh8ubaubcdocutils.nodes paragraph qB)qC}qD(hX:The reason I try to write these notes is the chinese wall.qEhh,hhhU paragraphqFh!}qG(h%]h&]h$]h#]h']uh)Kh*hh]qHh>X:The reason I try to write these notes is the chinese wall.qI…qJ}qK(hhEhhCubaubhB)qL}qM(hXqEver since I first saw it on a school-book map, I have been wondering what the decision making process were like.qNhh,hhhhFh!}qO(h%]h&]h$]h#]h']uh)K h*hh]qPh>XqEver since I first saw it on a school-book map, I have been wondering what the decision making process were like.qQ…qR}qS(hhNhhLubaubhB)qT}qU(hXð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.qVhh,hhhhFh!}qW(h%]h&]h$]h#]h']uh)K h*hh]qXh>Xð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.qY…qZ}q[(hhVhhTubaubhB)q\}q](hX¡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.q^hh,hhhhFh!}q_(h%]h&]h$]h#]h']uh)Kh*hh]q`h>X¡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.qa…qb}qc(hh^hh\ubaubhB)qd}qe(hX¸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.qfhh,hhhhFh!}qg(h%]h&]h$]h#]h']uh)Kh*hh]qhh>X¸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.qi…qj}qk(hhfhhdubaubhB)ql}qm(hX8If somebody had written some notes, we might have known.qnhh,hhhhFh!}qo(h%]h&]h$]h#]h']uh)K!h*hh]qph>X8If somebody had written some notes, we might have known.qq…qr}qs(hhnhhlubaubhB)qt}qu(hXPoul-Henning, 2010-05-28qvhh,hhhhFh!}qw(h%]h&]h$]h#]h']uh)K#h*hh]qxh>XPoul-Henning, 2010-05-28qy…qz}q{(hhvhhtubaubeubehUU transformerq|NU footnote_refsq}}q~Urefnamesq}q€Usymbol_footnotesq]q‚Uautofootnote_refsqƒ]q„Usymbol_footnote_refsq…]q†U citationsq‡]qˆh*hU current_lineq‰NUtransform_messagesqŠ]q‹cdocutils.nodes system_message qŒ)q}qŽ(hUh!}q(h%]UlevelKh#]h$]Usourcehh&]h']UlineKUtypeUINFOquh]q‘hB)q’}q“(hUh!}q”(h%]h&]h$]h#]h']uhhh]q•h>X2Hyperlink target "phk-thoughts" is not referenced.q–…q—}q˜(hUhh’ubahhFubahUsystem_messageq™ubaUreporterqšNUid_startq›KU autofootnotesqœ]qU citation_refsqž}qŸUindirect_targetsq ]q¡Usettingsq¢(cdocutils.frontend Values q£oq¤}q¥(Ufootnote_backlinksq¦KUrecord_dependenciesq§NU rfc_base_urlq¨Uhttp://tools.ietf.org/html/q©U tracebackqªˆUpep_referencesq«NUstrip_commentsq¬NU toc_backlinksq­Uentryq®U language_codeq¯Uenq°U datestampq±NU report_levelq²KU _destinationq³NU halt_levelq´KU strip_classesqµNh;NUerror_encoding_error_handlerq¶Ubackslashreplaceq·Udebugq¸NUembed_stylesheetq¹‰Uoutput_encoding_error_handlerqºUstrictq»U sectnum_xformq¼KUdump_transformsq½NU docinfo_xformq¾KUwarning_streamq¿NUpep_file_url_templateqÀUpep-%04dqÁUexit_status_levelqÂKUconfigqÃNUstrict_visitorqÄNUcloak_email_addressesqňUtrim_footnote_reference_spaceqƉUenvqÇNUdump_pseudo_xmlqÈNUexpose_internalsqÉNUsectsubtitle_xformqʉU source_linkqËNUrfc_referencesqÌNUoutput_encodingqÍUutf-8qÎU source_urlqÏNUinput_encodingqÐU utf-8-sigqÑU_disable_configqÒNU id_prefixqÓUU tab_widthqÔKUerror_encodingqÕUUTF-8qÖU_sourceq×U0/home/tfheen/varnish/doc/sphinx/phk/thoughts.rstqØUgettext_compactqÙˆU generatorqÚNUdump_internalsqÛNU smart_quotesq܉U pep_base_urlqÝUhttp://www.python.org/dev/peps/qÞUsyntax_highlightqßUlongqàUinput_encoding_error_handlerqáh»Uauto_id_prefixqâUidqãUdoctitle_xformqä‰Ustrip_elements_with_classesqåNU _config_filesqæ]Ufile_insertion_enabledqçKU raw_enabledqèKU dump_settingsqéNubUsymbol_footnote_startqêKUidsqë}qì(hh,hh,uUsubstitution_namesqí}qîhh*h!}qï(h%]h#]h$]Usourcehh&]h']uU footnotesqð]qñUrefidsqò}qóh]qôhasub.varnish-3.0.5/doc/sphinx/=build/doctrees/phk/gzip.doctree0000644000175000017500000005116512247037213020307 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(Xtuning, tweaking and frobbingqNXphk_gzipqˆXwhat does http_gzip_support doqNX'how gzip, and gzip+esi works in varnishq NX gzip and esiq NuUsubstitution_defsq }q Uparse_messagesq ]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hUtuning-tweaking-and-frobbingqhUphk-gzipqhUwhat-does-http-gzip-support-doqh U&how-gzip-and-gzip-esi-works-in-varnishqh U gzip-and-esiquUchildrenq]q(cdocutils.nodes target q)q}q(U rawsourceqX .. _phk_gzip:UparentqhUsourceq cdocutils.nodes reprunicode q!X,/home/tfheen/varnish/doc/sphinx/phk/gzip.rstq"…q#}q$bUtagnameq%Utargetq&U attributesq'}q((Uidsq)]Ubackrefsq*]Udupnamesq+]Uclassesq,]Unamesq-]Urefidq.huUlineq/KUdocumentq0hh]ubcdocutils.nodes section q1)q2}q3(hUhhh h#Uexpect_referenced_by_nameq4}q5hhsh%Usectionq6h'}q7(h+]h,]h*]h)]q8(hheh-]q9(h heuh/Kh0hUexpect_referenced_by_idq:}q;hhsh]q<(cdocutils.nodes title q=)q>}q?(hX'How GZIP, and GZIP+ESI works in Varnishq@hh2h h#h%UtitleqAh'}qB(h+]h,]h*]h)]h-]uh/Kh0hh]qCcdocutils.nodes Text qDX'How GZIP, and GZIP+ESI works in VarnishqE…qF}qG(hh@hh>ubaubcdocutils.nodes paragraph qH)qI}qJ(hXRFirst of all, everything you read about GZIP here, is controlled by the parameter:qKhh2h h#h%U paragraphqLh'}qM(h+]h,]h*]h)]h-]uh/Kh0hh]qNhDXRFirst of all, everything you read about GZIP here, is controlled by the parameter:qO…qP}qQ(hhKhhIubaubcdocutils.nodes block_quote qR)qS}qT(hUhh2h h#h%U block_quoteqUh'}qV(h+]h,]h*]h)]h-]uh/Nh0hh]qWhH)qX}qY(hXhttp_gzip_supportqZhhSh h#h%hLh'}q[(h+]h,]h*]h)]h-]uh/K h]q\hDXhttp_gzip_supportq]…q^}q_(hhZhhXubaubaubhH)q`}qa(hXpWhich defaults to "on" if you do not want Varnish to try to be smart about compression, set it to "off" instead.qbhh2h h#h%hLh'}qc(h+]h,]h*]h)]h-]uh/K h0hh]qdhDXpWhich defaults to "on" if you do not want Varnish to try to be smart about compression, set it to "off" instead.qe…qf}qg(hhbhh`ubaubh1)qh}qi(hUhh2h h#h%h6h'}qj(h+]h,]h*]h)]qkhah-]qlhauh/Kh0hh]qm(h=)qn}qo(hXWhat does http_gzip_support doqphhhh h#h%hAh'}qq(h+]h,]h*]h)]h-]uh/Kh0hh]qrhDXWhat does http_gzip_support doqs…qt}qu(hhphhnubaubhH)qv}qw(hXœ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.qxhhhh h#h%hLh'}qy(h+]h,]h*]h)]h-]uh/Kh0hh]qzhDXœ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.q{…q|}q}(hhxhhvubaubhH)q~}q(hXˆUnless vcl_recv{} results in "pipe" or "pass", we determine if the client is capable of receiving gzip'ed content. The test amounts to:q€hhhh h#h%hLh'}q(h+]h,]h*]h)]h-]uh/Kh0hh]q‚hDXˆUnless vcl_recv{} results in "pipe" or "pass", we determine if the client is capable of receiving gzip'ed content. The test amounts to:qƒ…q„}q…(hh€hh~ubaubhR)q†}q‡(hUhhhh h#h%hUh'}qˆ(h+]h,]h*]h)]h-]uh/Nh0hh]q‰hH)qŠ}q‹(hXiIs there a Accept-Encoding header that mentions gzip, and if is has a q=# number, is it larger than zero.qŒhh†h h#h%hLh'}q(h+]h,]h*]h)]h-]uh/Kh]qŽhDXiIs there a Accept-Encoding header that mentions gzip, and if is has a q=# number, is it larger than zero.q…q}q‘(hhŒhhŠubaubaubhH)q’}q“(hX:Clients which can do gzip, gets their header rewritten to:q”hhhh h#h%hLh'}q•(h+]h,]h*]h)]h-]uh/Kh0hh]q–hDX:Clients which can do gzip, gets their header rewritten to:q—…q˜}q™(hh”hh’ubaubhR)qš}q›(hUhhhh h#h%hUh'}qœ(h+]h,]h*]h)]h-]uh/Nh0hh]qhH)qž}qŸ(hXAccept-Encoding: gzipq hhšh h#h%hLh'}q¡(h+]h,]h*]h)]h-]uh/Kh]q¢hDXAccept-Encoding: gzipq£…q¤}q¥(hh hhžubaubaubhH)q¦}q§(hX¨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.q¨hhhh h#h%hLh'}q©(h+]h,]h*]h)]h-]uh/K h0hh]qªhDX¨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.q«…q¬}q­(hh¨hh¦ubaubhH)q®}q¯(hX7During 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.)q°hhhh h#h%hLh'}q±(h+]h,]h*]h)]h-]uh/K$h0hh]q²hDX7During 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.)q³…q´}qµ(hh°hh®ubaubhH)q¶}q·(hXŒ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.q¸hhhh h#h%hLh'}q¹(h+]h,]h*]h)]h-]uh/K*h0hh]qºhDXŒ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.q»…q¼}q½(hh¸hh¶ubaubhH)q¾}q¿(hXSBefore vcl_miss{} is called, the backend requests Accept-Encoding is always set to:qÀhhhh h#h%hLh'}qÁ(h+]h,]h*]h)]h-]uh/K-h0hh]qÂhDXSBefore vcl_miss{} is called, the backend requests Accept-Encoding is always set to:qÃ…qÄ}qÅ(hhÀhh¾ubaubhR)qÆ}qÇ(hUhhhh h#h%hUh'}qÈ(h+]h,]h*]h)]h-]uh/Nh0hh]qÉhH)qÊ}qË(hXAccept-Encoding: gzipqÌhhÆh h#h%hLh'}qÍ(h+]h,]h*]h)]h-]uh/K0h]qÎhDXAccept-Encoding: gzipqÏ…qÐ}qÑ(hhÌhhÊubaubaubhH)qÒ}qÓ(hX/Even if this particular client does not supportqÔhhhh h#h%hLh'}qÕ(h+]h,]h*]h)]h-]uh/K2h0hh]qÖhDX/Even if this particular client does not supportq×…qØ}qÙ(hhÔhhÒubaubhH)qÚ}qÛ(hX=To always entice the backend into sending us gzip'ed content.qÜhhhh h#h%hLh'}qÝ(h+]h,]h*]h)]h-]uh/K4h0hh]qÞhDX=To always entice the backend into sending us gzip'ed content.qß…qà}qá(hhÜhhÚubaubhH)qâ}qã(hXž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)qähhhh h#h%hLh'}qå(h+]h,]h*]h)]h-]uh/K6h0hh]qæhDXž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)qç…qè}qé(hhähhâubaubhH)qê}që(hX¶If in vcl_fetch{} 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.qìhhhh h#h%hLh'}qí(h+]h,]h*]h)]h-]uh/K:h0hh]qîhDX¶If in vcl_fetch{} 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.qï…qð}qñ(hhìhhêubaubeubh1)qò}qó(hUhh2h h#h%h6h'}qô(h+]h,]h*]h)]qõhah-]qöhauh/K?h0hh]q÷(h=)qø}qù(hXTuning, tweaking and frobbingqúhhòh h#h%hAh'}qû(h+]h,]h*]h)]h-]uh/K?h0hh]qühDXTuning, tweaking and frobbingqý…qþ}qÿ(hhúhhøubaubhH)r}r(hXlIn vcl_recv{} you have a chance to modify the client's Accept-Encoding: header before anything else happens.rhhòh h#h%hLh'}r(h+]h,]h*]h)]h-]uh/KAh0hh]rhDXlIn vcl_recv{} you have a chance to modify the client's Accept-Encoding: header before anything else happens.r…r}r(hjhjubaubhH)r}r (hX 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.r hhòh h#h%hLh'}r (h+]h,]h*]h)]h-]uh/KDh0hh]r hDX 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.r …r}r(hj hjubaubhH)r}r(hXtIn vcl_miss{} you can remove the "Accept-Encoding: gzip" header, if you do not want the backend to gzip this object.rhhòh h#h%hLh'}r(h+]h,]h*]h)]h-]uh/KJh0hh]rhDXtIn vcl_miss{} you can remove the "Accept-Encoding: gzip" header, if you do not want the backend to gzip this object.r…r}r(hjhjubaubhH)r}r(hX[In vcl_fetch{} two new variables allow you to modify the gzip-ness of objects during fetch:rhhòh h#h%hLh'}r(h+]h,]h*]h)]h-]uh/KMh0hh]rhDX[In vcl_fetch{} two new variables allow you to modify the gzip-ness of objects during fetch:r…r}r(hjhjubaubhR)r }r!(hUhhòh h#h%hUh'}r"(h+]h,]h*]h)]h-]uh/Nh0hh]r#hH)r$}r%(hXset beresp.do_gunzip = true;r&hj h h#h%hLh'}r'(h+]h,]h*]h)]h-]uh/KPh]r(hDXset beresp.do_gunzip = true;r)…r*}r+(hj&hj$ubaubaubhH)r,}r-(hX‚Will make varnish gunzip an already gzip'ed object from the backend during fetch. (I have no idea why/when you would use this...)r.hhòh h#h%hLh'}r/(h+]h,]h*]h)]h-]uh/KRh0hh]r0hDX‚Will make varnish gunzip an already gzip'ed object from the backend during fetch. (I have no idea why/when you would use this...)r1…r2}r3(hj.hj,ubaubhR)r4}r5(hUhhòh h#h%hUh'}r6(h+]h,]h*]h)]h-]uh/Nh0hh]r7hH)r8}r9(hXset beresp.do_gzip = true;r:hj4h h#h%hLh'}r;(h+]h,]h*]h)]h-]uh/KUh]r<hDXset beresp.do_gzip = true;r=…r>}r?(hj:hj8ubaubaubhH)r@}rA(hXvWill make varnish gzip the object during fetch from the backend, provided the backend didn't send us a gzip'ed object.rBhhòh h#h%hLh'}rC(h+]h,]h*]h)]h-]uh/KWh0hh]rDhDXvWill make varnish gzip the object during fetch from the backend, provided the backend didn't send us a gzip'ed object.rE…rF}rG(hjBhj@ubaubhH)rH}rI(hXRemember 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::hhòh h#h%hLh'}rJ(h+]h,]h*]h)]h-]uh/KZh0hh]rKhDXœ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:rL…rM}rN(hXœ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:hjHubaubcdocutils.nodes literal_block rO)rP}rQ(hXgsub vcl_fetch { if (req.url ~ "html$") { set beresp.do_gzip = true; } }hhòh h#h%U literal_blockrRh'}rS(U xml:spacerTUpreserverUh)]h*]h+]h,]h-]uh/K^h0hh]rVhDXgsub vcl_fetch { if (req.url ~ "html$") { set beresp.do_gzip = true; } }rW…rX}rY(hUhjPubaubeubh1)rZ}r[(hUhh2h h#h%h6h'}r\(h+]h,]h*]h)]r]hah-]r^h auh/Keh0hh]r_(h=)r`}ra(hX GZIP and ESIrbhjZh h#h%hAh'}rc(h+]h,]h*]h)]h-]uh/Keh0hh]rdhDX GZIP and ESIre…rf}rg(hjbhj`ubaubhH)rh}ri(hX/First, note the new syntax for activating ESI::rjhjZh h#h%hLh'}rk(h+]h,]h*]h)]h-]uh/Kgh0hh]rlhDX.First, note the new syntax for activating ESI:rm…rn}ro(hX.First, note the new syntax for activating ESI:hjhubaubjO)rp}rq(hX3sub vcl_fetch { set beresp.do_esi = true; }hjZh h#h%jRh'}rr(jTjUh)]h*]h+]h,]h-]uh/Kih0hh]rshDX3sub vcl_fetch { set beresp.do_esi = true; }rt…ru}rv(hUhjpubaubhH)rw}rx(hX…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.ryhjZh h#h%hLh'}rz(h+]h,]h*]h)]h-]uh/Kmh0hh]r{hDX…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.r|…r}}r~(hjyhjwubaubhH)r}r€(hXì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 ?rhjZh h#h%hLh'}r‚(h+]h,]h*]h)]h-]uh/Kph0hh]rƒhDXì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 ?r„…r…}r†(hjhjubaubhH)r‡}rˆ(hXAThings can get really hairy here, so let me explain it in stages.r‰hjZh h#h%hLh'}rŠ(h+]h,]h*]h)]h-]uh/Kuh0hh]r‹hDXAThings can get really hairy here, so let me explain it in stages.rŒ…r}rŽ(hj‰hj‡ubaubhH)r}r(hX9Assume we have a ungzipped object we want to ESI process.r‘hjZh h#h%hLh'}r’(h+]h,]h*]h)]h-]uh/Kwh0hh]r“hDX9Assume we have a ungzipped object we want to ESI process.r”…r•}r–(hj‘hjubaubhH)r—}r˜(hX“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.r™hjZh h#h%hLh'}rš(h+]h,]h*]h)]h-]uh/Kyh0hh]r›hDX“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.rœ…r}rž(hj™hj—ubaubhH)rŸ}r (hX˜The VEC contains instructions like "skip 234 bytes", "deliver 12919 bytes", "include /foobar", "deliver 122 bytes" etc and it is stored with the object.r¡hjZh h#h%hLh'}r¢(h+]h,]h*]h)]h-]uh/K}h0hh]r£hDX˜The VEC contains instructions like "skip 234 bytes", "deliver 12919 bytes", "include /foobar", "deliver 122 bytes" etc and it is stored with the object.r¤…r¥}r¦(hj¡hjŸubaubhH)r§}r¨(hXWhen 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.r©hjZh h#h%hLh'}rª(h+]h,]h*]h)]h-]uh/Kh0hh]r«hDXWhen 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.r¬…r­}r®(hj©hj§ubaubhH)r¯}r°(hXç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.r±hjZh h#h%hLh'}r²(h+]h,]h*]h)]h-]uh/K„h0hh]r³hDXç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.r´…rµ}r¶(hj±hj¯ubaubhH)r·}r¸(hXÉ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.r¹hjZh h#h%hLh'}rº(h+]h,]h*]h)]h-]uh/K‰h0hh]r»hDXÉ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.r¼…r½}r¾(hj¹hj·ubaubhH)r¿}rÀ(hX˜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.rÁhjZh h#h%hLh'}rÂ(h+]h,]h*]h)]h-]uh/Kh0hh]rÃhDX˜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.rÄ…rÅ}rÆ(hjÁhj¿ubaubhH)rÇ}rÈ(hX¹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.rÉhjZh h#h%hLh'}rÊ(h+]h,]h*]h)]h-]uh/K‘h0hh]rËhDX¹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.rÌ…rÍ}rÎ(hjÉhjÇubaubhH)rÏ}rÐ(hXgSo in order to avoid unnecessary work, and in order to get maximum compression efficiency, you should::hjZh h#h%hLh'}rÑ(h+]h,]h*]h)]h-]uh/K•h0hh]rÒhDXfSo in order to avoid unnecessary work, and in order to get maximum compression efficiency, you should:rÓ…rÔ}rÕ(hXfSo in order to avoid unnecessary work, and in order to get maximum compression efficiency, you should:hjÏubaubjO)rÖ}r×(hXsub vcl_miss { if (object needs ESI processing) { unset bereq.http.accept-encoding; } } sub vcl_fetch { if (object needs ESI processing) { set beresp.do_esi = true; set beresp.do_gzip = true; } }hjZh h#h%jRh'}rØ(jTjUh)]h*]h+]h,]h-]uh/K˜h0hh]rÙhDXsub vcl_miss { if (object needs ESI processing) { unset bereq.http.accept-encoding; } } sub vcl_fetch { if (object needs ESI processing) { set beresp.do_esi = true; set beresp.do_gzip = true; } }rÚ…rÛ}rÜ(hUhjÖubaubhH)rÝ}rÞ(hX@So that the backend sends these objects uncompressed to varnish.rßhjZh h#h%hLh'}rà(h+]h,]h*]h)]h-]uh/K¥h0hh]ráhDX@So that the backend sends these objects uncompressed to varnish.râ…rã}rä(hjßhjÝubaubhH)rå}ræ(hX—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.rçhjZh h#h%hLh'}rè(h+]h,]h*]h)]h-]uh/K§h0hh]réhDX—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.rê…rë}rì(hjçhjåubaubeubeubehUU transformerríNU footnote_refsrî}rïUrefnamesrð}rñUsymbol_footnotesrò]róUautofootnote_refsrô]rõUsymbol_footnote_refsrö]r÷U citationsrø]rùh0hU current_linerúNUtransform_messagesrû]rücdocutils.nodes system_message rý)rþ}rÿ(hUh'}r(h+]UlevelKh)]h*]Usourceh#h,]h-]UlineKUtypeUINFOruh]rhH)r}r(hUh'}r(h+]h,]h*]h)]h-]uhjþh]rhDX.Hyperlink target "phk-gzip" is not referenced.r…r}r (hUhjubah%hLubah%Usystem_messager ubaUreporterr NUid_startr KU autofootnotesr ]rU citation_refsr}rUindirect_targetsr]rUsettingsr(cdocutils.frontend Values ror}r(Ufootnote_backlinksrKUrecord_dependenciesrNU rfc_base_urlrUhttp://tools.ietf.org/html/rU tracebackrˆUpep_referencesrNUstrip_commentsrNU toc_backlinksrUentryrU language_coder Uenr!U datestampr"NU report_levelr#KU _destinationr$NU halt_levelr%KU strip_classesr&NhANUerror_encoding_error_handlerr'Ubackslashreplacer(Udebugr)NUembed_stylesheetr*‰Uoutput_encoding_error_handlerr+Ustrictr,U sectnum_xformr-KUdump_transformsr.NU docinfo_xformr/KUwarning_streamr0NUpep_file_url_templater1Upep-%04dr2Uexit_status_levelr3KUconfigr4NUstrict_visitorr5NUcloak_email_addressesr6ˆUtrim_footnote_reference_spacer7‰Uenvr8NUdump_pseudo_xmlr9NUexpose_internalsr:NUsectsubtitle_xformr;‰U source_linkr<NUrfc_referencesr=NUoutput_encodingr>Uutf-8r?U source_urlr@NUinput_encodingrAU utf-8-sigrBU_disable_configrCNU id_prefixrDUU tab_widthrEKUerror_encodingrFUUTF-8rGU_sourcerHU,/home/tfheen/varnish/doc/sphinx/phk/gzip.rstrIUgettext_compactrJˆU generatorrKNUdump_internalsrLNU smart_quotesrM‰U pep_base_urlrNUhttp://www.python.org/dev/peps/rOUsyntax_highlightrPUlongrQUinput_encoding_error_handlerrRj,Uauto_id_prefixrSUidrTUdoctitle_xformrU‰Ustrip_elements_with_classesrVNU _config_filesrW]rXUfile_insertion_enabledrYKU raw_enabledrZKU dump_settingsr[NubUsymbol_footnote_startr\KUidsr]}r^(hh2hhhhhòhh2hjZuUsubstitution_namesr_}r`h%h0h'}ra(h+]h)]h*]Usourceh#h,]h-]uU footnotesrb]rcUrefidsrd}reh]rfhasub.varnish-3.0.5/doc/sphinx/=build/doctrees/phk/platforms.doctree0000644000175000017500000003744612247037213021353 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(X phk_platformsqˆX$is that it ? abandon all hope etc. ?qNXpicking platformsqNXwrt54gq ˆX!b - platforms we try not to breakq NXruns on a nokia n900q ˆXc - platforms we tolerateq NXa - platforms we care aboutq NuUsubstitution_defsq}qUparse_messagesq]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hU phk-platformsqhUis-that-it-abandon-all-hope-etcqhUpicking-platformsqh Uwrt54gqh Ub-platforms-we-try-not-to-breakqh Uruns-on-a-nokia-n900qh Uc-platforms-we-tolerateqh Ua-platforms-we-care-aboutquUchildrenq]q (cdocutils.nodes target q!)q"}q#(U rawsourceq$X.. _phk_platforms:Uparentq%hUsourceq&cdocutils.nodes reprunicode q'X1/home/tfheen/varnish/doc/sphinx/phk/platforms.rstq(…q)}q*bUtagnameq+Utargetq,U attributesq-}q.(Uidsq/]Ubackrefsq0]Udupnamesq1]Uclassesq2]Unamesq3]Urefidq4huUlineq5KUdocumentq6hh]ubcdocutils.nodes section q7)q8}q9(h$Uh%hh&h)Uexpect_referenced_by_nameq:}q;hh"sh+Usectionq(hheh3]q?(hheuh5Kh6hUexpect_referenced_by_idq@}qAhh"sh]qB(cdocutils.nodes title qC)qD}qE(h$XPicking platformsqFh%h8h&h)h+UtitleqGh-}qH(h1]h2]h0]h/]h3]uh5Kh6hh]qIcdocutils.nodes Text qJXPicking platformsqK…qL}qM(h$hFh%hDubaubcdocutils.nodes paragraph qN)qO}qP(h$XnWhenever you write Open Source Software, you have to make a choice of what platforms you are going to support.qQh%h8h&h)h+U paragraphqRh-}qS(h1]h2]h0]h/]h3]uh5Kh6hh]qThJXnWhenever you write Open Source Software, you have to make a choice of what platforms you are going to support.qU…qV}qW(h$hQh%hOubaubhN)qX}qY(h$X…Generally you want to make your program as portable as possible and cover as many platforms, distros and weird computers as possible.qZh%h8h&h)h+hRh-}q[(h1]h2]h0]h/]h3]uh5K h6hh]q\hJX…Generally you want to make your program as portable as possible and cover as many platforms, distros and weird computers as possible.q]…q^}q_(h$hZh%hXubaubhN)q`}qa(h$XFBut making your program run on everything is hard work very hard work.qbh%h8h&h)h+hRh-}qc(h1]h2]h0]h/]h3]uh5K h6hh]qdhJXFBut making your program run on everything is hard work very hard work.qe…qf}qg(h$hbh%h`ubaubhN)qh}qi(h$X For instance, did you know that:qjh%h8h&h)h+hRh-}qk(h1]h2]h0]h/]h3]uh5Kh6hh]qlhJX For instance, did you know that:qm…qn}qo(h$hjh%hhubaubcdocutils.nodes block_quote qp)qq}qr(h$Uh%h8h&h)h+U block_quoteqsh-}qt(h1]h2]h0]h/]h3]uh5Nh6hh]quhN)qv}qw(h$X%sizeof(void*) != sizeof(void * const)qxh%hqh&h)h+hRh-}qy(h1]h2]h0]h/]h3]uh5Kh]qzhJX%sizeof(void*) != sizeof(void * const)q{…q|}q}(h$hxh%hvubaubaubhN)q~}q(h$X+is legal in a ISO-C compliant environment ?q€h%h8h&h)h+hRh-}q(h1]h2]h0]h/]h3]uh5Kh6hh]q‚hJX+is legal in a ISO-C compliant environment ?qƒ…q„}q…(h$h€h%h~ubaubhN)q†}q‡(h$X‹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.h%h8h&h)h+hRh-}qˆ(h1]h2]h0]h/]h3]uh5Kh6hh]q‰(hJXVarnish qŠ…q‹}qŒ(h$XVarnish h%h†ubcdocutils.nodes reference q)qŽ}q(h$X6`runs on a Nokia N900 `_h-}q(UnameXruns on a Nokia N900Urefuriq‘Xhttp://hellarvik.com/node/66q’h/]h0]h1]h2]h3]uh%h†h]q“hJXruns on a Nokia N900q”…q•}q–(h$Uh%hŽubah+U referenceq—ubh!)q˜}q™(h$X U referencedqšKh%h†h+h,h-}q›(Urefurih’h/]qœhah0]h1]h2]h3]qh auh]ubhJXM but I am not going to go out of my way to make sure that is always the case.qž…qŸ}q (h$XM but I am not going to go out of my way to make sure that is always the case.h%h†ubeubhN)q¡}q¢(h$Xœ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.q£h%h8h&h)h+hRh-}q¤(h1]h2]h0]h/]h3]uh5Kh6hh]q¥hJXœ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.q¦…q§}q¨(h$h£h%h¡ubaubhN)q©}qª(h$X¬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.q«h%h8h&h)h+hRh-}q¬(h1]h2]h0]h/]h3]uh5Kh6hh]q­hJX¬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.q®…q¯}q°(h$h«h%h©ubaubhN)q±}q²(h$XEIf we did the same for Varnish, the result would look something like:q³h%h8h&h)h+hRh-}q´(h1]h2]h0]h/]h3]uh5K!h6hh]qµhJXEIf we did the same for Varnish, the result would look something like:q¶…q·}q¸(h$h³h%h±ubaubh7)q¹}qº(h$Uh%h8h&h)h+h`_ but if you have a real computer, you can expect Varnish to work "ok or better" on any distro that has a package available.h%h¹h&h)h+hRh-}qó(h1]h2]h0]h/]h3]uh5K1h6hh]qô(hJX7Obviously you can forget about running Varnish on your qõ…qö}q÷(h$X7Obviously you can forget about running Varnish on your h%hñubh)qø}qù(h$X>`WRT54G `_h-}qú(UnameXWRT54Gh‘X2http://en.wikipedia.org/wiki/Linksys_WRT54G_seriesqûh/]h0]h1]h2]h3]uh%hñh]qühJXWRT54Gqý…qþ}qÿ(h$Uh%høubah+h—ubh!)r}r(h$X5 hšKh%hñh+h,h-}r(Urefurihûh/]rhah0]h1]h2]h3]rh auh]ubhJX{ but if you have a real computer, you can expect Varnish to work "ok or better" on any distro that has a package available.r…r}r(h$X{ but if you have a real computer, you can expect Varnish to work "ok or better" on any distro that has a package available.h%hñubeubeubh7)r}r (h$Uh%h8h&h)h+h}r?(h$X.h%j2ubeubhN)r@}rA(h$XäYes, we'd like to bump Solaris to tier-A but I have to say that the uncertainty about the future for OpenSolaris, and lack of time to care and feed the somewhat altmodishe socket-API on Solaris, does keep the enthusiasm bounded.rBh%jh&h)h+hRh-}rC(h1]h2]h0]h/]h3]uh5KEh6hh]rDhJXäYes, we'd like to bump Solaris to tier-A but I have to say that the uncertainty about the future for OpenSolaris, and lack of time to care and feed the somewhat altmodishe socket-API on Solaris, does keep the enthusiasm bounded.rE…rF}rG(h$jBh%j@ubaubhN)rH}rI(h$XyNetBSD, AIX and HP-UX are conceivably candidates for this level, but so far I have not heard much, if any, user interest.rJh%jh&h)h+hRh-}rK(h1]h2]h0]h/]h3]uh5KJh6hh]rLhJXyNetBSD, AIX and HP-UX are conceivably candidates for this level, but so far I have not heard much, if any, user interest.rM…rN}rO(h$jJh%jHubaubeubh7)rP}rQ(h$Uh%h8h&h)h+hX Why no SSL ?q?…q@}qA(hh:hh8ubaubcdocutils.nodes paragraph qB)qC}qD(hXeThis is turning into a bit of a FAQ, but the answer is too big to fit in the margin we use for those.qEhh,hhhU paragraphqFh!}qG(h%]h&]h$]h#]h']uh)Kh*hh]qHh>XeThis is turning into a bit of a FAQ, but the answer is too big to fit in the margin we use for those.qI…qJ}qK(hhEhhCubaubhB)qL}qM(hXdThere are a number of reasons why there are no plans in sight that will grow SSL support in Varnish.qNhh,hhhhFh!}qO(h%]h&]h$]h#]h']uh)K h*hh]qPh>XdThere are a number of reasons why there are no plans in sight that will grow SSL support in Varnish.qQ…qR}qS(hhNhhLubaubhB)qT}qU(hXPFirst, I have yet to see a SSL library where the source code is not a nightmare.qVhh,hhhhFh!}qW(h%]h&]h$]h#]h']uh)K h*hh]qXh>XPFirst, I have yet to see a SSL library where the source code is not a nightmare.qY…qZ}q[(hhVhhTubaubhB)q\}q](hX—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).q^hh,hhhhFh!}q_(h%]h&]h$]h#]h']uh)Kh*hh]q`h>X—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).qa…qb}qc(hh^hh\ubaubhB)qd}qe(hX›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.qfhh,hhhhFh!}qg(h%]h&]h$]h#]h']uh)Kh*hh]qhh>X›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.qi…qj}qk(hhfhhdubaubhB)ql}qm(hXdThis should give you some indication of how insanely complex the canonical implementation of SSL is.qnhh,hhhhFh!}qo(h%]h&]h$]h#]h']uh)Kh*hh]qph>XdThis should give you some indication of how insanely complex the canonical implementation of SSL is.qq…qr}qs(hhnhhlubaubhB)qt}qu(hXŽ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.qvhh,hhhhFh!}qw(h%]h&]h$]h#]h']uh)Kh*hh]qxh>XŽ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.qy…qz}q{(hhvhhtubaubhB)q|}q}(hX=Take this example in a comment, randomly found in s3-srvr.c::q~hh,hhhhFh!}q(h%]h&]h$]h#]h']uh)Kh*hh]q€h>X<Take this example in a comment, randomly found in s3-srvr.c:q…q‚}qƒ(hX<Take this example in a comment, randomly found in s3-srvr.c:hh|ubaubcdocutils.nodes literal_block q„)q…}q†(hXô/* 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 ... */hh,hhhU literal_blockq‡h!}qˆ(U xml:spaceq‰UpreserveqŠh#]h$]h%]h&]h']uh)K!h*hh]q‹h>Xô/* 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 ... */qŒ…q}qŽ(hUhh…ubaubhB)q}q(hXgI hope they know what they are doing, but this comment doesn't exactly carry that point home, does it ?q‘hh,hhhhFh!}q’(h%]h&]h$]h#]h']uh)K&h*hh]q“h>XgI hope they know what they are doing, but this comment doesn't exactly carry that point home, does it ?q”…q•}q–(hh‘hhubaubhB)q—}q˜(hXWBut let us assume that a good SSL library can be found, what would Varnish do with it ?q™hh,hhhhFh!}qš(h%]h&]h$]h#]h']uh)K)h*hh]q›h>XWBut let us assume that a good SSL library can be found, what would Varnish do with it ?qœ…q}qž(hh™hh—ubaubhB)qŸ}q (hX5We would terminate SSL sessions, and we would burn CPU cycles doing that. You can kiss the highly optimized delivery path in Varnish goodby 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.q¡hh,hhhhFh!}q¢(h%]h&]h$]h#]h']uh)K,h*hh]q£h>X5We would terminate SSL sessions, and we would burn CPU cycles doing that. You can kiss the highly optimized delivery path in Varnish goodby 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.q¤…q¥}q¦(hh¡hhŸubaubhB)q§}q¨(hXfWill that be significantly different, performance wise, from running a SSL proxy in separate process ?q©hh,hhhhFh!}qª(h%]h&]h$]h#]h']uh)K2h*hh]q«h>XfWill that be significantly different, performance wise, from running a SSL proxy in separate process ?q¬…q­}q®(hh©hh§ubaubhB)q¯}q°(hX}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.q±hh,hhhhFh!}q²(h%]h&]h$]h#]h']uh)K5h*hh]q³h>X}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.q´…qµ}q¶(hh±hh¯ubaubhB)q·}q¸(hXThere 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.q¹hh,hhhhFh!}qº(h%]h&]h$]h#]h']uh)K8h*hh]q»h>XThere 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.q¼…q½}q¾(hh¹hh·ubaubhB)q¿}qÀ(hXdWould I be able to write a better stand-alone SSL proxy process than the many which already exists ?qÁhh,hhhhFh!}qÂ(h%]h&]h$]h#]h']uh)K=h*hh]qÃh>XdWould I be able to write a better stand-alone SSL proxy process than the many which already exists ?qÄ…qÅ}qÆ(hhÁhh¿ubaubhB)qÇ}qÈ(hXProbably not, unless I also write my own SSL implementation library, including support for hardware crypto engines and the works.qÉhh,hhhhFh!}qÊ(h%]h&]h$]h#]h']uh)K@h*hh]qËh>XProbably not, unless I also write my own SSL implementation library, including support for hardware crypto engines and the works.qÌ…qÍ}qÎ(hhÉhhÇubaubhB)qÏ}qÐ(hXnThat 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.qÑhh,hhhhFh!}qÒ(h%]h&]h$]h#]h']uh)KCh*hh]qÓh>XnThat 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.qÔ…qÕ}qÖ(hhÑhhÏubaubhB)q×}qØ(hXà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..qÙhh,hhhhFh!}qÚ(h%]h&]h$]h#]h']uh)KFh*hh]qÛh>Xà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..qÜ…qÝ}qÞ(hhÙhh×ubaubhB)qß}qà(hXPoul-Henning, 2011-02-15qáhh,hhhhFh!}qâ(h%]h&]h$]h#]h']uh)KKh*hh]qãh>XPoul-Henning, 2011-02-15qä…qå}qæ(hháhhßubaubeubehUU transformerqçNU footnote_refsqè}qéUrefnamesqê}qëUsymbol_footnotesqì]qíUautofootnote_refsqî]qïUsymbol_footnote_refsqð]qñU citationsqò]qóh*hU current_lineqôNUtransform_messagesqõ]qöcdocutils.nodes system_message q÷)qø}qù(hUh!}qú(h%]UlevelKh#]h$]Usourcehh&]h']UlineKUtypeUINFOqûuh]qühB)qý}qþ(hUh!}qÿ(h%]h&]h$]h#]h']uhhøh]rh>X-Hyperlink target "phk-ssl" is not referenced.r…r}r(hUhhýubahhFubahUsystem_messagerubaUreporterrNUid_startrKU autofootnotesr]rU citation_refsr }r Uindirect_targetsr ]r Usettingsr (cdocutils.frontend Values ror}r(Ufootnote_backlinksrKUrecord_dependenciesrNU rfc_base_urlrUhttp://tools.ietf.org/html/rU tracebackrˆUpep_referencesrNUstrip_commentsrNU toc_backlinksrUentryrU language_coderUenrU datestamprNU report_levelrKU _destinationrNU halt_levelrKU strip_classesr Nh;NUerror_encoding_error_handlerr!Ubackslashreplacer"Udebugr#NUembed_stylesheetr$‰Uoutput_encoding_error_handlerr%Ustrictr&U sectnum_xformr'KUdump_transformsr(NU docinfo_xformr)KUwarning_streamr*NUpep_file_url_templater+Upep-%04dr,Uexit_status_levelr-KUconfigr.NUstrict_visitorr/NUcloak_email_addressesr0ˆUtrim_footnote_reference_spacer1‰Uenvr2NUdump_pseudo_xmlr3NUexpose_internalsr4NUsectsubtitle_xformr5‰U source_linkr6NUrfc_referencesr7NUoutput_encodingr8Uutf-8r9U source_urlr:NUinput_encodingr;U utf-8-sigr<U_disable_configr=NU id_prefixr>UU tab_widthr?KUerror_encodingr@UUTF-8rAU_sourcerBU+/home/tfheen/varnish/doc/sphinx/phk/ssl.rstrCUgettext_compactrDˆU generatorrENUdump_internalsrFNU smart_quotesrG‰U pep_base_urlrHUhttp://www.python.org/dev/peps/rIUsyntax_highlightrJUlongrKUinput_encoding_error_handlerrLj&Uauto_id_prefixrMUidrNUdoctitle_xformrO‰Ustrip_elements_with_classesrPNU _config_filesrQ]rRUfile_insertion_enabledrSKU raw_enabledrTKU dump_settingsrUNubUsymbol_footnote_startrVKUidsrW}rX(hh,hh,uUsubstitution_namesrY}rZhh*h!}r[(h%]h#]h$]Usourcehh&]h']uU footnotesr\]r]Urefidsr^}r_h]r`hasub.varnish-3.0.5/doc/sphinx/=build/doctrees/phk/barriers.doctree0000644000175000017500000004271612247037213021151 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(Xall the other barriersqNXthe really important barrierqNXthe admin/oper barrierqNXsecurity barriers in varnishq NX phk_barriersq ˆuUsubstitution_defsq }q Uparse_messagesq ]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hUall-the-other-barriersqhUthe-really-important-barrierqhUthe-admin-oper-barrierqh Usecurity-barriers-in-varnishqh U phk-barriersquUchildrenq]q(cdocutils.nodes target q)q}q(U rawsourceqX.. _phk_barriers:UparentqhUsourceq cdocutils.nodes reprunicode q!X0/home/tfheen/varnish/doc/sphinx/phk/barriers.rstq"…q#}q$bUtagnameq%Utargetq&U attributesq'}q((Uidsq)]Ubackrefsq*]Udupnamesq+]Uclassesq,]Unamesq-]Urefidq.huUlineq/KUdocumentq0hh]ubcdocutils.nodes section q1)q2}q3(hUhhh h#Uexpect_referenced_by_nameq4}q5h hsh%Usectionq6h'}q7(h+]h,]h*]h)]q8(hheh-]q9(h h euh/Kh0hUexpect_referenced_by_idq:}q;hhsh]q<(cdocutils.nodes title q=)q>}q?(hXSecurity barriers in Varnishq@hh2h h#h%UtitleqAh'}qB(h+]h,]h*]h)]h-]uh/Kh0hh]qCcdocutils.nodes Text qDXSecurity barriers in VarnishqE…qF}qG(hh@hh>ubaubcdocutils.nodes paragraph qH)qI}qJ(hX¦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.qKhh2h h#h%U paragraphqLh'}qM(h+]h,]h*]h)]h-]uh/Kh0hh]qNhDX¦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.qO…qP}qQ(hhKhhIubaubhH)qR}qS(hXwThe Varnish security model is based on some very crude but easy to understand barriers between the various components::hh2h h#h%hLh'}qT(h+]h,]h*]h)]h-]uh/K h0hh]qUhDXvThe Varnish security model is based on some very crude but easy to understand barriers between the various components:qV…qW}qX(hXvThe Varnish security model is based on some very crude but easy to understand barriers between the various components:hhRubaubcdocutils.nodes literal_block qY)qZ}q[(hXP .-->- 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 --<--'hh2h h#h%U literal_blockq\h'}q](U xml:spaceq^Upreserveq_h)]h*]h+]h,]h-]uh/Kh0hh]q`hDXP .-->- 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 --<--'qa…qb}qc(hUhhZubaubhH)qd}qe(hX(ASCII-ART rules!)qfhh2h h#h%hLh'}qg(h+]h,]h*]h)]h-]uh/K.h0hh]qhhDX(ASCII-ART rules!)qi…qj}qk(hhfhhdubaubh1)ql}qm(hUhh2h h#h%h6h'}qn(h+]h,]h*]h)]qohah-]qphauh/K1h0hh]qq(h=)qr}qs(hXThe really Important Barrierqthhlh h#h%hAh'}qu(h+]h,]h*]h)]h-]uh/K1h0hh]qvhDXThe really Important Barrierqw…qx}qy(hhthhrubaubhH)qz}q{(hXThe central actor in Varnish is the Manager process, "MGR", which is the process the administrator "(ADMIN)" starts to get web-cache service.q|hhlh h#h%hLh'}q}(h+]h,]h*]h)]h-]uh/K3h0hh]q~hDXThe central actor in Varnish is the Manager process, "MGR", which is the process the administrator "(ADMIN)" starts to get web-cache service.q…q€}q(hh|hhzubaubhH)q‚}qƒ(hX'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 ?q„hhlh h#h%hLh'}q…(h+]h,]h*]h)]h-]uh/K6h0hh]q†hDX'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 ?q‡…qˆ}q‰(hh„hh‚ubaubhH)qŠ}q‹(hX˜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.qŒhhlh h#h%hLh'}q(h+]h,]h*]h)]h-]uh/K;h0hh]qŽhDX˜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.q…q}q‘(hhŒhhŠubaubhH)q’}q“(hXÀ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.q”hhlh h#h%hLh'}q•(h+]h,]h*]h)]h-]uh/K?h0hh]q–hDXÀ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.q—…q˜}q™(hh”hh’ubaubhH)qš}q›(hXž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.qœhhlh h#h%hLh'}q(h+]h,]h*]h)]h-]uh/KCh0hh]qžhDXž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.qŸ…q }q¡(hhœhhšubaubhH)q¢}q£(hX²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.q¤hhlh h#h%hLh'}q¥(h+]h,]h*]h)]h-]uh/KGh0hh]q¦hDX²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.q§…q¨}q©(hh¤hh¢ubaubhH)qª}q«(hXŸ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.q¬hhlh h#h%hLh'}q­(h+]h,]h*]h)]h-]uh/KKh0hh]q®hDXŸ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.q¯…q°}q±(hh¬hhªubaubhH)q²}q³(hXó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.q´hhlh h#h%hLh'}qµ(h+]h,]h*]h)]h-]uh/KOh0hh]q¶hDXó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.q·…q¸}q¹(hh´hh²ubaubeubh1)qº}q»(hUhh2h h#h%h6h'}q¼(h+]h,]h*]h)]q½hah-]q¾hauh/KUh0hh]q¿(h=)qÀ}qÁ(hXThe Admin/Oper BarrierqÂhhºh h#h%hAh'}qÃ(h+]h,]h*]h)]h-]uh/KUh0hh]qÄhDXThe Admin/Oper BarrierqÅ…qÆ}qÇ(hhÂhhÀubaubhH)qÈ}qÉ(hX˜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.qÊhhºh h#h%hLh'}qË(h+]h,]h*]h)]h-]uh/KWh0hh]qÌhDX˜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.qÍ…qÎ}qÏ(hhÊhhÈubaubhH)qÐ}qÑ(hXThe Administrator does things, changes stuff etc. The Operator keeps an eye on things to make sure they are as they should be.qÒhhºh h#h%hLh'}qÓ(h+]h,]h*]h)]h-]uh/KZh0hh]qÔhDXThe Administrator does things, changes stuff etc. The Operator keeps an eye on things to make sure they are as they should be.qÕ…qÖ}q×(hhÒhhÐubaubhH)qØ}qÙ(hXÆ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.qÚhhºh h#h%hLh'}qÛ(h+]h,]h*]h)]h-]uh/K]h0hh]qÜhDXÆ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.qÝ…qÞ}qß(hhÚhhØubaubhH)qà}qá(hXD(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.)qâhhºh h#h%hLh'}qã(h+]h,]h*]h)]h-]uh/Kah0hh]qähDXD(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.)qå…qæ}qç(hhâhhàubaubhH)qè}qé(hX‰The Administrator has the final say, and of course, the administrator can decide under which circumstances that authority will be shared.qêhhºh h#h%hLh'}që(h+]h,]h*]h)]h-]uh/Kgh0hh]qìhDX‰The Administrator has the final say, and of course, the administrator can decide under which circumstances that authority will be shared.qí…qî}qï(hhêhhèubaubhH)qð}qñ(hXŠNeedless to say, if the system on which Varnish runs is not properly secured, the Administrator's monopoly of control will be compromised.qòhhºh h#h%hLh'}qó(h+]h,]h*]h)]h-]uh/Kjh0hh]qôhDXŠNeedless to say, if the system on which Varnish runs is not properly secured, the Administrator's monopoly of control will be compromised.qõ…qö}q÷(hhòhhðubaubeubh1)qø}qù(hUhh2h h#h%h6h'}qú(h+]h,]h*]h)]qûhah-]qühauh/Knh0hh]qý(h=)qþ}qÿ(hXAll the other barriersrhhøh h#h%hAh'}r(h+]h,]h*]h)]h-]uh/Knh0hh]rhDXAll the other barriersr…r}r(hjhhþubaubhH)r}r(hXÞ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.rhhøh h#h%hLh'}r (h+]h,]h*]h)]h-]uh/Kph0hh]r hDXÞ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.r …r }r (hjhjubaubhH)r}r(hX²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.rhhøh h#h%hLh'}r(h+]h,]h*]h)]h-]uh/Kuh0hh]rhDX²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.r…r}r(hjhjubaubhH)r}r(hXoHope this explanation helps understand why Varnish is not just a single process like all other server programs.rhhøh h#h%hLh'}r(h+]h,]h*]h)]h-]uh/Kyh0hh]rhDXoHope this explanation helps understand why Varnish is not just a single process like all other server programs.r…r}r(hjhjubaubhH)r}r(hXPoul-Henning, 2010-06-28r hhøh h#h%hLh'}r!(h+]h,]h*]h)]h-]uh/K|h0hh]r"hDXPoul-Henning, 2010-06-28r#…r$}r%(hj hjubaubeubeubehUU transformerr&NU footnote_refsr'}r(Urefnamesr)}r*Usymbol_footnotesr+]r,Uautofootnote_refsr-]r.Usymbol_footnote_refsr/]r0U citationsr1]r2h0hU current_liner3NUtransform_messagesr4]r5cdocutils.nodes system_message r6)r7}r8(hUh'}r9(h+]UlevelKh)]h*]Usourceh#h,]h-]UlineKUtypeUINFOr:uh]r;hH)r<}r=(hUh'}r>(h+]h,]h*]h)]h-]uhj7h]r?hDX2Hyperlink target "phk-barriers" is not referenced.r@…rA}rB(hUhj<ubah%hLubah%Usystem_messagerCubaUreporterrDNUid_startrEKU autofootnotesrF]rGU citation_refsrH}rIUindirect_targetsrJ]rKUsettingsrL(cdocutils.frontend Values rMorN}rO(Ufootnote_backlinksrPKUrecord_dependenciesrQNU rfc_base_urlrRUhttp://tools.ietf.org/html/rSU tracebackrTˆUpep_referencesrUNUstrip_commentsrVNU toc_backlinksrWUentryrXU language_coderYUenrZU datestampr[NU report_levelr\KU _destinationr]NU halt_levelr^KU strip_classesr_NhANUerror_encoding_error_handlerr`UbackslashreplaceraUdebugrbNUembed_stylesheetrc‰Uoutput_encoding_error_handlerrdUstrictreU sectnum_xformrfKUdump_transformsrgNU docinfo_xformrhKUwarning_streamriNUpep_file_url_templaterjUpep-%04drkUexit_status_levelrlKUconfigrmNUstrict_visitorrnNUcloak_email_addressesroˆUtrim_footnote_reference_spacerp‰UenvrqNUdump_pseudo_xmlrrNUexpose_internalsrsNUsectsubtitle_xformrt‰U source_linkruNUrfc_referencesrvNUoutput_encodingrwUutf-8rxU source_urlryNUinput_encodingrzU utf-8-sigr{U_disable_configr|NU id_prefixr}UU tab_widthr~KUerror_encodingrUUTF-8r€U_sourcerU0/home/tfheen/varnish/doc/sphinx/phk/barriers.rstr‚Ugettext_compactrƒˆU generatorr„NUdump_internalsr…NU smart_quotesr†‰U pep_base_urlr‡Uhttp://www.python.org/dev/peps/rˆUsyntax_highlightr‰UlongrŠUinput_encoding_error_handlerr‹jeUauto_id_prefixrŒUidrUdoctitle_xformrމUstrip_elements_with_classesrNU _config_filesr]Ufile_insertion_enabledr‘KU raw_enabledr’KU dump_settingsr“NubUsymbol_footnote_startr”KUidsr•}r–(hh2hhºhhlhhøhh2uUsubstitution_namesr—}r˜h%h0h'}r™(h+]h)]h*]Usourceh#h,]h-]uU footnotesrš]r›Urefidsrœ}rh]ržhasub.varnish-3.0.5/doc/sphinx/=build/doctrees/phk/ipv6suckage.doctree0000644000175000017500000002413312247037213021560 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(X ipv6 suckageqNXphk_ipv6suckageqˆuUsubstitution_defsq}q Uparse_messagesq ]q Ucurrent_sourceq NU decorationq NUautofootnote_startqKUnameidsq}q(hU ipv6-suckageqhUphk-ipv6suckagequUchildrenq]q(cdocutils.nodes target q)q}q(U rawsourceqX.. _phk_ipv6suckage:UparentqhUsourceqcdocutils.nodes reprunicode qX3/home/tfheen/varnish/doc/sphinx/phk/ipv6suckage.rstq…q}qbUtagnameqUtargetq U attributesq!}q"(Uidsq#]Ubackrefsq$]Udupnamesq%]Uclassesq&]Unamesq']Urefidq(huUlineq)KUdocumentq*hh]ubcdocutils.nodes section q+)q,}q-(hUhhhhUexpect_referenced_by_nameq.}q/hhshUsectionq0h!}q1(h%]h&]h$]h#]q2(hheh']q3(hheuh)Kh*hUexpect_referenced_by_idq4}q5hhsh]q6(cdocutils.nodes title q7)q8}q9(hX IPv6 Suckageq:hh,hhhUtitleq;h!}q<(h%]h&]h$]h#]h']uh)Kh*hh]q=cdocutils.nodes Text q>X IPv6 Suckageq?…q@}qA(hh:hh8ubaubcdocutils.nodes paragraph qB)qC}qD(hX®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.qEhh,hhhU paragraphqFh!}qG(h%]h&]h$]h#]h']uh)Kh*hh]qHh>X®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.qI…qJ}qK(hhEhhCubaubhB)qL}qM(hX¼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.qNhh,hhhhFh!}qO(h%]h&]h$]h#]h']uh)K h*hh]qPh>X¼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.qQ…qR}qS(hhNhhLubaubhB)qT}qU(hXLIPv4 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:417AqVhh,hhhhFh!}qW(h%]h&]h$]h#]h']uh)Kh*hh]qXh>XLIPv4 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:417AqY…qZ}q[(hhVhhTubaubhB)q\}q](hX 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.q^hh,hhhhFh!}q_(h%]h&]h$]h#]h']uh)Kh*hh]q`h>X 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.qa…qb}qc(hh^hh\ubaubhB)qd}qe(hX•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.qfhh,hhhhFh!}qg(h%]h&]h$]h#]h']uh)Kh*hh]qhh>X•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.qi…qj}qk(hhfhhdubaubhB)ql}qm(hX_Except when they don't, for instance when they run more than one webserver on the same machine.qnhh,hhhhFh!}qo(h%]h&]h$]h#]h']uh)Kh*hh]qph>X_Except when they don't, for instance when they run more than one webserver on the same machine.qq…qr}qs(hhnhhlubaubhB)qt}qu(hX|No worries, says the power that controls what URLs look like, we will just stick the port number after the IP# with a colon:qvhh,hhhhFh!}qw(h%]h&]h$]h#]h']uh)K h*hh]qxh>X|No worries, says the power that controls what URLs look like, we will just stick the port number after the IP# with a colon:qy…qz}q{(hhvhhtubaubcdocutils.nodes block_quote q|)q}}q~(hUhh,hhhU block_quoteqh!}q€(h%]h&]h$]h#]h']uh)Nh*hh]qhB)q‚}qƒ(hXhttp://192.168.0.1:8080/...hh}hhhhFh!}q„(h%]h&]h$]h#]h']uh)K#h]q…(cdocutils.nodes reference q†)q‡}qˆ(hXhttp://192.168.0.1:8080/q‰h!}qŠ(Urefurih‰h#]h$]h%]h&]h']uhh‚h]q‹h>Xhttp://192.168.0.1:8080/qŒ…q}qŽ(hUhh‡ubahU referencequbh>X...q…q‘}q’(hX...hh‚ubeubaubhB)q“}q”(hX–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:q•hh,hhhhFh!}q–(h%]h&]h$]h#]h']uh)K%h*hh]q—h>X–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:q˜…q™}qš(hh•hh“ubaubh|)q›}qœ(hUhh,hhhhh!}q(h%]h&]h$]h#]h']uh)Nh*hh]qžhB)qŸ}q (hX$http://[1080::8:800:200C:417A]:8080/q¡hh›hhhhFh!}q¢(h%]h&]h$]h#]h']uh)K)h]q£h†)q¤}q¥(hh¡h!}q¦(Urefurih¡h#]h$]h%]h&]h']uhhŸh]q§h>X$http://[1080::8:800:200C:417A]:8080/q¨…q©}qª(hUhh¤ubahhubaubaubhB)q«}q¬(hXDRemember that "harmless in shells" detail ? Yeah, sorry about that.q­hh,hhhhFh!}q®(h%]h&]h$]h#]h']uh)K+h*hh]q¯h>XDRemember that "harmless in shells" detail ? Yeah, sorry about that.q°…q±}q²(hh­hh«ubaubhB)q³}q´(hXNow, 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.qµhh,hhhhFh!}q¶(h%]h&]h$]h#]h']uh)K-h*hh]q·h>XNow, 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.q¸…q¹}qº(hhµhh³ubaubhB)q»}q¼(hXñ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 doq½hh,hhhhFh!}q¾(h%]h&]h$]h#]h']uh)K2h*hh]q¿h>Xñ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 doqÀ…qÁ}qÂ(hh½hh»ubaubh|)qÃ}qÄ(hUhh,hhhhh!}qÅ(h%]h&]h$]h#]h']uh)Nh*hh]qÆhB)qÇ}qÈ(hX"%s:%s", host, portqÉhhÃhhhhFh!}qÊ(h%]h&]h$]h#]h']uh)K7h]qËh>X"%s:%s", host, portqÌ…qÍ}qÎ(hhÉhhÇubaubaubhB)qÏ}qÐ(hXorqÑhh,hhhhFh!}qÒ(h%]h&]h$]h#]h']uh)K9h*hh]qÓh>XorqÔ…qÕ}qÖ(hhÑhhÏubaubh|)q×}qØ(hUhh,hhhhh!}qÙ(h%]h&]h$]h#]h']uh)Nh*hh]qÚhB)qÛ}qÜ(hX"[%s]:%s", host, portqÝhh×hhhhFh!}qÞ(h%]h&]h$]h#]h']uh)K;h]qßh>X"[%s]:%s", host, portqà…qá}qâ(hhÝhhÛubaubaubhB)qã}qä(hXCCareless standardization costs code, have I mentioned this before ?qåhh,hhhhFh!}qæ(h%]h&]h$]h#]h']uh)K=h*hh]qçh>XCCareless standardization costs code, have I mentioned this before ?qè…qé}qê(hhåhhãubaubhB)që}qì(hXPVarnish reports socket addresses as two fields: IP space PORT, now you know why.qíhh,hhhhFh!}qî(h%]h&]h$]h#]h']uh)K?h*hh]qïh>XPVarnish reports socket addresses as two fields: IP space PORT, now you know why.qð…qñ}qò(hhíhhëubaubhB)qó}qô(hXUntil next time,qõhh,hhhhFh!}qö(h%]h&]h$]h#]h']uh)KBh*hh]q÷h>XUntil next time,qø…qù}qú(hhõhhóubaubhB)qû}qü(hXPoul-Henning, 2010-08-24qýhh,hhhhFh!}qþ(h%]h&]h$]h#]h']uh)KDh*hh]qÿh>XPoul-Henning, 2010-08-24r…r}r(hhýhhûubaubeubehUU transformerrNU footnote_refsr}rUrefnamesr}rUsymbol_footnotesr]r Uautofootnote_refsr ]r Usymbol_footnote_refsr ]r U citationsr]rh*hU current_linerNUtransform_messagesr]rcdocutils.nodes system_message r)r}r(hUh!}r(h%]UlevelKh#]h$]Usourcehh&]h']UlineKUtypeUINFOruh]rhB)r}r(hUh!}r(h%]h&]h$]h#]h']uhjh]rh>X5Hyperlink target "phk-ipv6suckage" is not referenced.r…r}r(hUhjubahhFubahUsystem_messager ubaUreporterr!NUid_startr"KU autofootnotesr#]r$U citation_refsr%}r&Uindirect_targetsr']r(Usettingsr)(cdocutils.frontend Values r*or+}r,(Ufootnote_backlinksr-KUrecord_dependenciesr.NU rfc_base_urlr/Uhttp://tools.ietf.org/html/r0U tracebackr1ˆUpep_referencesr2NUstrip_commentsr3NU toc_backlinksr4Uentryr5U language_coder6Uenr7U datestampr8NU report_levelr9KU _destinationr:NU halt_levelr;KU strip_classesr<Nh;NUerror_encoding_error_handlerr=Ubackslashreplacer>Udebugr?NUembed_stylesheetr@‰Uoutput_encoding_error_handlerrAUstrictrBU sectnum_xformrCKUdump_transformsrDNU docinfo_xformrEKUwarning_streamrFNUpep_file_url_templaterGUpep-%04drHUexit_status_levelrIKUconfigrJNUstrict_visitorrKNUcloak_email_addressesrLˆUtrim_footnote_reference_spacerM‰UenvrNNUdump_pseudo_xmlrONUexpose_internalsrPNUsectsubtitle_xformrQ‰U source_linkrRNUrfc_referencesrSNUoutput_encodingrTUutf-8rUU source_urlrVNUinput_encodingrWU utf-8-sigrXU_disable_configrYNU id_prefixrZUU tab_widthr[KUerror_encodingr\UUTF-8r]U_sourcer^U3/home/tfheen/varnish/doc/sphinx/phk/ipv6suckage.rstr_Ugettext_compactr`ˆU generatorraNUdump_internalsrbNU smart_quotesrc‰U pep_base_urlrdUhttp://www.python.org/dev/peps/reUsyntax_highlightrfUlongrgUinput_encoding_error_handlerrhjBUauto_id_prefixriUidrjUdoctitle_xformrk‰Ustrip_elements_with_classesrlNU _config_filesrm]rnUfile_insertion_enabledroKU raw_enabledrpKU dump_settingsrqNubUsymbol_footnote_startrrKUidsrs}rt(hh,hh,uUsubstitution_namesru}rvhh*h!}rw(h%]h#]h$]Usourcehh&]h']uU footnotesrx]ryUrefidsrz}r{h]r|hasub.varnish-3.0.5/doc/sphinx/=build/doctrees/phk/vcl_expr.doctree0000644000175000017500000003013612247037213021153 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(X phk_vcl_exprqˆXvcl expressionsqNuUsubstitution_defsq}q Uparse_messagesq ]q Ucurrent_sourceq NU decorationq NUautofootnote_startqKUnameidsq}q(hU phk-vcl-exprqhUvcl-expressionsquUchildrenq]q(cdocutils.nodes target q)q}q(U rawsourceqX.. _phk_vcl_expr:UparentqhUsourceqcdocutils.nodes reprunicode qX0/home/tfheen/varnish/doc/sphinx/phk/vcl_expr.rstq…q}qbUtagnameqUtargetq U attributesq!}q"(Uidsq#]Ubackrefsq$]Udupnamesq%]Uclassesq&]Unamesq']Urefidq(huUlineq)KUdocumentq*hh]ubcdocutils.nodes section q+)q,}q-(hUhhhhUexpect_referenced_by_nameq.}q/hhshUsectionq0h!}q1(h%]h&]h$]h#]q2(hheh']q3(hheuh)Kh*hUexpect_referenced_by_idq4}q5hhsh]q6(cdocutils.nodes title q7)q8}q9(hXVCL Expressionsq:hh,hhhUtitleq;h!}q<(h%]h&]h$]h#]h']uh)Kh*hh]q=cdocutils.nodes Text q>XVCL Expressionsq?…q@}qA(hh:hh8ubaubcdocutils.nodes paragraph qB)qC}qD(hX]I have been working on VCL expressions recently, and we are approaching the home stretch now.qEhh,hhhU paragraphqFh!}qG(h%]h&]h$]h#]h']uh)Kh*hh]qHh>X]I have been working on VCL expressions recently, and we are approaching the home stretch now.qI…qJ}qK(hhEhhCubaubhB)qL}qM(hX³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.qNhh,hhhhFh!}qO(h%]h&]h$]h#]h']uh)K h*hh]qPh>X³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.qQ…qR}qS(hhNhhLubaubhB)qT}qU(hXpFor instance, we have both a TIME and a DURATION type, a quite unusual constellation for a programming language.qVhh,hhhhFh!}qW(h%]h&]h$]h#]h']uh)Kh*hh]qXh>XpFor instance, we have both a TIME and a DURATION type, a quite unusual constellation for a programming language.qY…qZ}q[(hhVhhTubaubhB)q\}q](hX‘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).q^hh,hhhhFh!}q_(h%]h&]h$]h#]h']uh)Kh*hh]q`h>X‘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).qa…qb}qc(hh^hh\ubaubhB)qd}qe(hXAObviously, you can add a TIME and DURATION, the result is a TIME.qfhh,hhhhFh!}qg(h%]h&]h$]h#]h']uh)Kh*hh]qhh>XAObviously, you can add a TIME and DURATION, the result is a TIME.qi…qj}qk(hhfhhdubaubhB)ql}qm(hXnEqually obviously, you can not add TIME to TIME, but you can subtract TIME from TIME, resulting in a DURATION.qnhh,hhhhFh!}qo(h%]h&]h$]h#]h']uh)Kh*hh]qph>XnEqually obviously, you can not add TIME to TIME, but you can subtract TIME from TIME, resulting in a DURATION.qq…qr}qs(hhnhhlubaubhB)qt}qu(hXÅ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.qvhh,hhhhFh!}qw(h%]h&]h$]h#]h']uh)Kh*hh]qxh>XÅ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.qy…qz}q{(hhvhhtubaubhB)q|}q}(hXVGiven that we have our own types, the next question is what precedence operators have.q~hh,hhhhFh!}q(h%]h&]h$]h#]h']uh)Kh*hh]q€h>XVGiven that we have our own types, the next question is what precedence operators have.q…q‚}qƒ(hh~hh|ubaubhB)q„}q…(hXâ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.q†hh,hhhhFh!}q‡(h%]h&]h$]h#]h']uh)K!h*hh]qˆh>Xâ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.q‰…qŠ}q‹(hh†hh„ubaubhB)qŒ}q(hXSHere are the precedence rules I have settled on, from highest to lowest precedence:qŽhh,hhhhFh!}q(h%]h&]h$]h#]h']uh)K&h*hh]qh>XSHere are the precedence rules I have settled on, from highest to lowest precedence:q‘…q’}q“(hhŽhhŒubaubcdocutils.nodes definition_list q”)q•}q–(hUhh,hhhUdefinition_listq—h!}q˜(h%]h&]h$]h#]h']uh)Nh*hh]q™(cdocutils.nodes definition_list_item qš)q›}qœ(hXQAtomic 'true', 'false', constants function calls variables '(' expression ')' hh•hhhUdefinition_list_itemqh!}qž(h%]h&]h$]h#]h']uh)K0h]qŸ(cdocutils.nodes term q )q¡}q¢(hXAtomicq£hh›hhhUtermq¤h!}q¥(h%]h&]h$]h#]h']uh)K0h]q¦h>XAtomicq§…q¨}q©(hh£hh¡ubaubcdocutils.nodes definition qª)q«}q¬(hUh!}q­(h%]h&]h$]h#]h']uhh›h]q®(hB)q¯}q°(hX'true', 'false', constantsq±hh«hhhhFh!}q²(h%]h&]h$]h#]h']uh)K*h]q³h>X'true', 'false', constantsq´…qµ}q¶(hh±hh¯ubaubhB)q·}q¸(hXfunction callsq¹hh«hhhhFh!}qº(h%]h&]h$]h#]h']uh)K,h]q»h>Xfunction callsq¼…q½}q¾(hh¹hh·ubaubhB)q¿}qÀ(hX variablesqÁhh«hhhhFh!}qÂ(h%]h&]h$]h#]h']uh)K.h]qÃh>X variablesqÄ…qÅ}qÆ(hhÁhh¿ubaubhB)qÇ}qÈ(hX'(' expression ')'qÉhh«hhhhFh!}qÊ(h%]h&]h$]h#]h']uh)K0h]qËh>X'(' expression ')'qÌ…qÍ}qÎ(hhÉhhÇubaubehU definitionqÏubeubhš)qÐ}qÑ(hX6Multiply/Divide INT * INT INT / INT DURATION * REAL hh•hhhhh!}qÒ(h%]h&]h$]h#]h']uh)K7h*hh]qÓ(h )qÔ}qÕ(hXMultiply/DivideqÖhhÐhhhh¤h!}q×(h%]h&]h$]h#]h']uh)K7h]qØh>XMultiply/DivideqÙ…qÚ}qÛ(hhÖhhÔubaubhª)qÜ}qÝ(hUh!}qÞ(h%]h&]h$]h#]h']uhhÐh]qß(hB)qà}qá(hX INT * INTqâhhÜhhhhFh!}qã(h%]h&]h$]h#]h']uh)K3h]qäh>X INT * INTqå…qæ}qç(hhâhhàubaubhB)qè}qé(hX INT / INTqêhhÜhhhhFh!}që(h%]h&]h$]h#]h']uh)K5h]qìh>X INT / INTqí…qî}qï(hhêhhèubaubhB)qð}qñ(hXDURATION * REALqòhhÜhhhhFh!}qó(h%]h&]h$]h#]h']uh)K7h]qôh>XDURATION * REALqõ…qö}q÷(hhòhhðubaubehhÏubeubhš)qø}qù(hXaAdd/Subtract STRING + STRING INT +/- INT TIME +/- DURATION TIME - TIME DURATION +/- DURATION hh•hhhhh!}qú(h%]h&]h$]h#]h']uh)KBh*hh]qû(h )qü}qý(hX Add/Subtractqþhhøhhhh¤h!}qÿ(h%]h&]h$]h#]h']uh)KBh]rh>X Add/Subtractr…r}r(hhþhhüubaubhª)r}r(hUh!}r(h%]h&]h$]h#]h']uhhøh]r(hB)r}r (hXSTRING + STRINGr hjhhhhFh!}r (h%]h&]h$]h#]h']uh)K:h]r h>XSTRING + STRINGr …r}r(hj hjubaubhB)r}r(hX INT +/- INTrhjhhhhFh!}r(h%]h&]h$]h#]h']uh)KX INT +/- INTr…r}r(hjhjubaubhB)r}r(hXTIME +/- DURATIONrhjhhhhFh!}r(h%]h&]h$]h#]h']uh)K>h]rh>XTIME +/- DURATIONr…r}r(hjhjubaubhB)r }r!(hX TIME - TIMEr"hjhhhhFh!}r#(h%]h&]h$]h#]h']uh)K@h]r$h>X TIME - TIMEr%…r&}r'(hj"hj ubaubhB)r(}r)(hXDURATION +/- DURATIONr*hjhhhhFh!}r+(h%]h&]h$]h#]h']uh)KBh]r,h>XDURATION +/- DURATIONr-…r.}r/(hj*hj(ubaubehhÏubeubhš)r0}r1(hXQComparisons '==', '!=', '<', '>', '~' and '!~' string existence check (-> BOOL) hh•hhhhh!}r2(h%]h&]h$]h#]h']uh)KGh*hh]r3(h )r4}r5(hX Comparisonsr6hj0hhhh¤h!}r7(h%]h&]h$]h#]h']uh)KGh]r8h>X Comparisonsr9…r:}r;(hj6hj4ubaubhª)r<}r=(hUh!}r>(h%]h&]h$]h#]h']uhj0h]r?(hB)r@}rA(hX"'==', '!=', '<', '>', '~' and '!~'rBhj<hhhhFh!}rC(h%]h&]h$]h#]h']uh)KEh]rDh>X"'==', '!=', '<', '>', '~' and '!~'rE…rF}rG(hjBhj@ubaubhB)rH}rI(hX string existence check (-> BOOL)rJhj<hhhhFh!}rK(h%]h&]h$]h#]h']uh)KGh]rLh>X string existence check (-> BOOL)rM…rN}rO(hjJhjHubaubehhÏubeubhš)rP}rQ(hXBoolean not '!' hh•hhhhh!}rR(h%]h&]h$]h#]h']uh)KJh*hh]rS(h )rT}rU(hX Boolean notrVhjPhhhh¤h!}rW(h%]h&]h$]h#]h']uh)KJh]rXh>X Boolean notrY…rZ}r[(hjVhjTubaubhª)r\}r](hUh!}r^(h%]h&]h$]h#]h']uhjPh]r_hB)r`}ra(hX'!'rbhj\hhhhFh!}rc(h%]h&]h$]h#]h']uh)KJh]rdh>X'!'re…rf}rg(hjbhj`ubaubahhÏubeubhš)rh}ri(hXBoolean and '&&' hh•hhhhh!}rj(h%]h&]h$]h#]h']uh)KMh*hh]rk(h )rl}rm(hX Boolean andrnhjhhhhh¤h!}ro(h%]h&]h$]h#]h']uh)KMh]rph>X Boolean andrq…rr}rs(hjnhjlubaubhª)rt}ru(hUh!}rv(h%]h&]h$]h#]h']uhjhh]rwhB)rx}ry(hX'&&'rzhjthhhhFh!}r{(h%]h&]h$]h#]h']uh)KMh]r|h>X'&&'r}…r~}r(hjzhjxubaubahhÏubeubhš)r€}r(hXBoolean or '||' hh•hhhhh!}r‚(h%]h&]h$]h#]h']uh)KQh*hh]rƒ(h )r„}r…(hX Boolean orr†hj€hhhh¤h!}r‡(h%]h&]h$]h#]h']uh)KQh]rˆh>X Boolean orr‰…rŠ}r‹(hj†hj„ubaubhª)rŒ}r(hUh!}rŽ(h%]h&]h$]h#]h']uhj€h]rhB)r}r‘(hX'||'r’hjŒhhhhFh!}r“(h%]h&]h$]h#]h']uh)KPh]r”h>X'||'r•…r–}r—(hj’hjubaubahhÏubeubeubhB)r˜}r™(hX Input and feedback most welcome!ršhh,hhhhFh!}r›(h%]h&]h$]h#]h']uh)KSh*hh]rœh>X Input and feedback most welcome!r…rž}rŸ(hjšhj˜ubaubhB)r }r¡(hXUntil next time,r¢hh,hhhhFh!}r£(h%]h&]h$]h#]h']uh)KUh*hh]r¤h>XUntil next time,r¥…r¦}r§(hj¢hj ubaubhB)r¨}r©(hXPoul-Henning, 2010-09-21rªhh,hhhhFh!}r«(h%]h&]h$]h#]h']uh)KWh*hh]r¬h>XPoul-Henning, 2010-09-21r­…r®}r¯(hjªhj¨ubaubeubehUU transformerr°NU footnote_refsr±}r²Urefnamesr³}r´Usymbol_footnotesrµ]r¶Uautofootnote_refsr·]r¸Usymbol_footnote_refsr¹]rºU citationsr»]r¼h*hU current_liner½NUtransform_messagesr¾]r¿cdocutils.nodes system_message rÀ)rÁ}rÂ(hUh!}rÃ(h%]UlevelKh#]h$]Usourcehh&]h']UlineKUtypeUINFOrÄuh]rÅhB)rÆ}rÇ(hUh!}rÈ(h%]h&]h$]h#]h']uhjÁh]rÉh>X2Hyperlink target "phk-vcl-expr" is not referenced.rÊ…rË}rÌ(hUhjÆubahhFubahUsystem_messagerÍubaUreporterrÎNUid_startrÏKU autofootnotesrÐ]rÑU citation_refsrÒ}rÓUindirect_targetsrÔ]rÕUsettingsrÖ(cdocutils.frontend Values r×orØ}rÙ(Ufootnote_backlinksrÚKUrecord_dependenciesrÛNU rfc_base_urlrÜUhttp://tools.ietf.org/html/rÝU tracebackrÞˆUpep_referencesrßNUstrip_commentsràNU toc_backlinksráUentryrâU language_coderãUenräU datestampråNU report_levelræKU _destinationrçNU halt_levelrèKU strip_classesréNh;NUerror_encoding_error_handlerrêUbackslashreplacerëUdebugrìNUembed_stylesheetrí‰Uoutput_encoding_error_handlerrîUstrictrïU sectnum_xformrðKUdump_transformsrñNU docinfo_xformròKUwarning_streamróNUpep_file_url_templaterôUpep-%04drõUexit_status_levelröKUconfigr÷NUstrict_visitorrøNUcloak_email_addressesrùˆUtrim_footnote_reference_spacerú‰UenvrûNUdump_pseudo_xmlrüNUexpose_internalsrýNUsectsubtitle_xformrþ‰U source_linkrÿNUrfc_referencesrNUoutput_encodingrUutf-8rU source_urlrNUinput_encodingrU utf-8-sigrU_disable_configrNU id_prefixrUU tab_widthrKUerror_encodingr UUTF-8r U_sourcer U0/home/tfheen/varnish/doc/sphinx/phk/vcl_expr.rstr Ugettext_compactr ˆU generatorrNUdump_internalsrNU smart_quotesr‰U pep_base_urlrUhttp://www.python.org/dev/peps/rUsyntax_highlightrUlongrUinput_encoding_error_handlerrjïUauto_id_prefixrUidrUdoctitle_xformr‰Ustrip_elements_with_classesrNU _config_filesr]rUfile_insertion_enabledrKU raw_enabledrKU dump_settingsrNubUsymbol_footnote_startrKUidsr }r!(hh,hh,uUsubstitution_namesr"}r#hh*h!}r$(h%]h#]h$]Usourcehh&]h']uU footnotesr%]r&Urefidsr'}r(h]r)hasub.varnish-3.0.5/doc/sphinx/=build/doctrees/phk/backends.doctree0000644000175000017500000004052412247037213021105 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(Xwhat do you mean by 'backend' ?qNXimplementationqNX%no information without representationqNXshare and enjoyq NX phk_backendsq ˆXsharing health statusq NuUsubstitution_defsq }q Uparse_messagesq]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hUwhat-do-you-mean-by-backendqhUimplementationqhU%no-information-without-representationqh Ushare-and-enjoyqh U phk-backendsqh Usharing-health-statusquUchildrenq]q(cdocutils.nodes target q)q}q(U rawsourceq X.. _phk_backends:Uparentq!hUsourceq"cdocutils.nodes reprunicode q#X0/home/tfheen/varnish/doc/sphinx/phk/backends.rstq$…q%}q&bUtagnameq'Utargetq(U attributesq)}q*(Uidsq+]Ubackrefsq,]Udupnamesq-]Uclassesq.]Unamesq/]Urefidq0huUlineq1KUdocumentq2hh]ubcdocutils.nodes section q3)q4}q5(h Uh!hh"h%Uexpect_referenced_by_nameq6}q7h hsh'Usectionq8h)}q9(h-]h.]h,]h+]q:(hheh/]q;(hh euh1Kh2hUexpect_referenced_by_idq<}q=hhsh]q>(cdocutils.nodes title q?)q@}qA(h XWhat do you mean by 'backend' ?qBh!h4h"h%h'UtitleqCh)}qD(h-]h.]h,]h+]h/]uh1Kh2hh]qEcdocutils.nodes Text qFXWhat do you mean by 'backend' ?qG…qH}qI(h hBh!h@ubaubcdocutils.nodes paragraph qJ)qK}qL(h X¬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.qMh!h4h"h%h'U paragraphqNh)}qO(h-]h.]h,]h+]h/]uh1Kh2hh]qPhFX¬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.qQ…qR}qS(h hMh!hKubaubhJ)qT}qU(h X°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.qVh!h4h"h%h'hNh)}qW(h-]h.]h,]h+]h/]uh1K h2hh]qXhFX°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.qY…qZ}q[(h hVh!hTubaubhJ)q\}q](h XoSo imagine you have 1000 backends in your VCL, not an unreasonable number, each configured with health-polling.q^h!h4h"h%h'hNh)}q_(h-]h.]h,]h+]h/]uh1Kh2hh]q`hFXoSo imagine you have 1000 backends in your VCL, not an unreasonable number, each configured with health-polling.qa…qb}qc(h h^h!h\ubaubhJ)qd}qe(h X¿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.qfh!h4h"h%h'hNh)}qg(h-]h.]h,]h+]h/]uh1Kh2hh]qhhFX¿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.qi…qj}qk(h hfh!hdubaubhJ)ql}qm(h XvTo switch seamlessly, the health status of each backend needs to be up to date the instant we switch to the other VCL.qnh!h4h"h%h'hNh)}qo(h-]h.]h,]h+]h/]uh1Kh2hh]qphFXvTo switch seamlessly, the health status of each backend needs to be up to date the instant we switch to the other VCL.qq…qr}qs(h hnh!hlubaubhJ)qt}qu(h X_This basically means that either all VCLs poll all their backends, or they must share, somehow.qvh!h4h"h%h'hNh)}qw(h-]h.]h,]h+]h/]uh1Kh2hh]qxhFX_This basically means that either all VCLs poll all their backends, or they must share, somehow.qy…qz}q{(h hvh!htubaubhJ)q|}q}(h X»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.q~h!h4h"h%h'hNh)}q(h-]h.]h,]h+]h/]uh1Kh2hh]q€hFX»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.q…q‚}qƒ(h h~h!h|ubaubh3)q„}q…(h Uh!h4h"h%h'h8h)}q†(h-]h.]h,]h+]q‡hah/]qˆh auh1K!h2hh]q‰(h?)qŠ}q‹(h XShare And EnjoyqŒh!h„h"h%h'hCh)}q(h-]h.]h,]h+]h/]uh1K!h2hh]qŽhFXShare And Enjoyq…q}q‘(h hŒh!hŠubaubhJ)q’}q“(h XzIn addition to health-status (including the saint-list), we also want to share cached open connections and stats counters.q”h!h„h"h%h'hNh)}q•(h-]h.]h,]h+]h/]uh1K#h2hh]q–hFXzIn addition to health-status (including the saint-list), we also want to share cached open connections and stats counters.q—…q˜}q™(h h”h!h’ubaubhJ)qš}q›(h X¸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.qœh!h„h"h%h'hNh)}q(h-]h.]h,]h+]h/]uh1K&h2hh]qžhFX¸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.qŸ…q }q¡(h hœh!hšubaubhJ)q¢}q£(h X<But what is an identical backend definition in this context?q¤h!h„h"h%h'hNh)}q¥(h-]h.]h,]h+]h/]uh1K*h2hh]q¦hFX<But what is an identical backend definition in this context?q§…q¨}q©(h h¤h!h¢ubaubhJ)qª}q«(h XÂ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.q¬h!h„h"h%h'hNh)}q­(h-]h.]h,]h+]h/]uh1K,h2hh]q®hFXÂ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.q¯…q°}q±(h h¬h!hªubaubhJ)q²}q³(h Xý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.q´h!h„h"h%h'hNh)}qµ(h-]h.]h,]h+]h/]uh1K1h2hh]q¶hFXý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.q·…q¸}q¹(h h´h!h²ubaubcdocutils.nodes definition_list qº)q»}q¼(h Uh!h„h"h%h'Udefinition_listq½h)}q¾(h-]h.]h,]h+]h/]uh1Nh2hh]q¿cdocutils.nodes definition_list_item qÀ)qÁ}qÂ(h XhThe identity of the state than can be shared is therefore the triplet: {VCL-name, IPv4+port, IPv6+port} h!h»h"h%h'Udefinition_list_itemqÃh)}qÄ(h-]h.]h,]h+]h/]uh1K7h]qÅ(cdocutils.nodes term qÆ)qÇ}qÈ(h XFThe identity of the state than can be shared is therefore the triplet:qÉh!hÁh"h%h'UtermqÊh)}qË(h-]h.]h,]h+]h/]uh1K7h]qÌhFXFThe identity of the state than can be shared is therefore the triplet:qÍ…qÎ}qÏ(h hÉh!hÇubaubcdocutils.nodes definition qÐ)qÑ}qÒ(h Uh)}qÓ(h-]h.]h,]h+]h/]uh!hÁh]qÔhJ)qÕ}qÖ(h X {VCL-name, IPv4+port, IPv6+port}q×h!hÑh"h%h'hNh)}qØ(h-]h.]h,]h+]h/]uh1K7h]qÙhFX {VCL-name, IPv4+port, IPv6+port}qÚ…qÛ}qÜ(h h×h!hÕubaubah'U definitionqÝubeubaubeubh3)qÞ}qß(h Uh!h4h"h%h'h8h)}qà(h-]h.]h,]h+]qáhah/]qâhauh1K:h2hh]qã(h?)qä}qå(h X%No Information without Representationqæh!hÞh"h%h'hCh)}qç(h-]h.]h,]h+]h/]uh1K:h2hh]qèhFX%No Information without Representationqé…qê}që(h hæh!häubaubhJ)qì}qí(h Xˆ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.qîh!hÞh"h%h'hNh)}qï(h-]h.]h,]h+]h/]uh1KhFXSharing Health Statusr?…r@}rA(h j<h!j:ubaubhJ)rB}rC(h Xê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.rDh!j4h"h%h'hNh)}rE(h-]h.]h,]h+]h/]uh1Kah2hh]rFhFXê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.rG…rH}rI(h jDh!jBubaubeubh3)rJ}rK(h Uh!h4h"h%h'h8h)}rL(h-]h.]h,]h+]rMhah/]rNhauh1Kgh2hh]rO(h?)rP}rQ(h XImplementationrRh!jJh"h%h'hCh)}rS(h-]h.]h,]h+]h/]uh1Kgh2hh]rThFXImplementationrU…rV}rW(h jRh!jPubaubhJ)rX}rY(h X~The poll-policy can be implemented by updating a back-pointer to the poll-specification for all backends on vcl.use execution.rZh!jJh"h%h'hNh)}r[(h-]h.]h,]h+]h/]uh1Kih2hh]r\hFX~The poll-policy can be implemented by updating a back-pointer to the poll-specification for all backends on vcl.use execution.r]…r^}r_(h jZh!jXubaubhJ)r`}ra(h X£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.rbh!jJh"h%h'hNh)}rc(h-]h.]h,]h+]h/]uh1Klh2hh]rdhFX£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.re…rf}rg(h jbh!j`ubaubhJ)rh}ri(h XŠ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.rjh!jJh"h%h'hNh)}rk(h-]h.]h,]h+]h/]uh1Kph2hh]rlhFXŠ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.rm…rn}ro(h jjh!jhubaubhJ)rp}rq(h XBThe pattern matching is confined to CLI and possibly libvarnishapirrh!jJh"h%h'hNh)}rs(h-]h.]h,]h+]h/]uh1Ksh2hh]rthFXBThe pattern matching is confined to CLI and possibly libvarnishapiru…rv}rw(h jrh!jpubaubhJ)rx}ry(h XI think this will work,rzh!jJh"h%h'hNh)}r{(h-]h.]h,]h+]h/]uh1Kuh2hh]r|hFXI think this will work,r}…r~}r(h jzh!jxubaubhJ)r€}r(h XUntil next time,r‚h!jJh"h%h'hNh)}rƒ(h-]h.]h,]h+]h/]uh1Kwh2hh]r„hFXUntil next time,r……r†}r‡(h j‚h!j€ubaubhJ)rˆ}r‰(h XPoul-Henning, 2010-08-09rŠh!jJh"h%h'hNh)}r‹(h-]h.]h,]h+]h/]uh1Kyh2hh]rŒhFXPoul-Henning, 2010-08-09r…rŽ}r(h jŠh!jˆubaubeubeubeh UU transformerrNU footnote_refsr‘}r’Urefnamesr“}r”Usymbol_footnotesr•]r–Uautofootnote_refsr—]r˜Usymbol_footnote_refsr™]ršU citationsr›]rœh2hU current_linerNUtransform_messagesrž]rŸcdocutils.nodes system_message r )r¡}r¢(h Uh)}r£(h-]UlevelKh+]h,]Usourceh%h.]h/]UlineKUtypeUINFOr¤uh]r¥hJ)r¦}r§(h Uh)}r¨(h-]h.]h,]h+]h/]uh!j¡h]r©hFX2Hyperlink target "phk-backends" is not referenced.rª…r«}r¬(h Uh!j¦ubah'hNubah'Usystem_messager­ubaUreporterr®NUid_startr¯KU autofootnotesr°]r±U citation_refsr²}r³Uindirect_targetsr´]rµUsettingsr¶(cdocutils.frontend Values r·or¸}r¹(Ufootnote_backlinksrºKUrecord_dependenciesr»NU rfc_base_urlr¼Uhttp://tools.ietf.org/html/r½U tracebackr¾ˆUpep_referencesr¿NUstrip_commentsrÀNU toc_backlinksrÁUentryrÂU language_coderÃUenrÄU datestamprÅNU report_levelrÆKU _destinationrÇNU halt_levelrÈKU strip_classesrÉNhCNUerror_encoding_error_handlerrÊUbackslashreplacerËUdebugrÌNUembed_stylesheetr͉Uoutput_encoding_error_handlerrÎUstrictrÏU sectnum_xformrÐKUdump_transformsrÑNU docinfo_xformrÒKUwarning_streamrÓNUpep_file_url_templaterÔUpep-%04drÕUexit_status_levelrÖKUconfigr×NUstrict_visitorrØNUcloak_email_addressesrÙˆUtrim_footnote_reference_spacerÚ‰UenvrÛNUdump_pseudo_xmlrÜNUexpose_internalsrÝNUsectsubtitle_xformrÞ‰U source_linkrßNUrfc_referencesràNUoutput_encodingráUutf-8râU source_urlrãNUinput_encodingräU utf-8-sigråU_disable_configræNU id_prefixrçUU tab_widthrèKUerror_encodingréUUTF-8rêU_sourcerëU0/home/tfheen/varnish/doc/sphinx/phk/backends.rstrìUgettext_compactríˆU generatorrîNUdump_internalsrïNU smart_quotesrð‰U pep_base_urlrñUhttp://www.python.org/dev/peps/ròUsyntax_highlightróUlongrôUinput_encoding_error_handlerrõjÏUauto_id_prefixröUidr÷Udoctitle_xformrø‰Ustrip_elements_with_classesrùNU _config_filesrú]Ufile_insertion_enabledrûKU raw_enabledrüKU dump_settingsrýNubUsymbol_footnote_startrþKUidsrÿ}r(hjJhh4hh4hhÞhh„hj4uUsubstitution_namesr}rh'h2h)}r(h-]h+]h,]Usourceh%h.]h/]uU footnotesr]rUrefidsr}rh]rhasub.varnish-3.0.5/doc/sphinx/=build/doctrees/phk/thetoolsweworkwith.doctree0000644000175000017500000006317012247037213023331 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(Xthe tools we work withqNXphk_thetoolsweworkwithqˆuUsubstitution_defsq}q Uparse_messagesq ]q Ucurrent_sourceq NU decorationq NUautofootnote_startqKUnameidsq}q(hUthe-tools-we-work-withqhUphk-thetoolsweworkwithquUchildrenq]q(cdocutils.nodes target q)q}q(U rawsourceqX.. _phk_thetoolsweworkwith:UparentqhUsourceqcdocutils.nodes reprunicode qX:/home/tfheen/varnish/doc/sphinx/phk/thetoolsweworkwith.rstq…q}qbUtagnameqUtargetq U attributesq!}q"(Uidsq#]Ubackrefsq$]Udupnamesq%]Uclassesq&]Unamesq']Urefidq(huUlineq)KUdocumentq*hh]ubcdocutils.nodes section q+)q,}q-(hUhhhhUexpect_referenced_by_nameq.}q/hhshUsectionq0h!}q1(h%]h&]h$]h#]q2(hheh']q3(hheuh)Kh*hUexpect_referenced_by_idq4}q5hhsh]q6(cdocutils.nodes title q7)q8}q9(hXThe Tools We Work Withq:hh,hhhUtitleq;h!}q<(h%]h&]h$]h#]h']uh)Kh*hh]q=cdocutils.nodes Text q>XThe Tools We Work Withq?…q@}qA(hh:hh8ubaubcdocutils.nodes paragraph qB)qC}qD(hX“"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.qEhh,hhhU paragraphqFh!}qG(h%]h&]h$]h#]h']uh)Kh*hh]qHh>X“"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.qI…qJ}qK(hhEhhCubaubhB)qL}qM(hX…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.qNhh,hhhhFh!}qO(h%]h&]h$]h#]h']uh)K h*hh]qPh>X…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.qQ…qR}qS(hhNhhLubaubhB)qT}qU(hX(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.qVhh,hhhhFh!}qW(h%]h&]h$]h#]h']uh)Kh*hh]qXh>X(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.qY…qZ}q[(hhVhhTubaubhB)q\}q](hX•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.q^hh,hhhhFh!}q_(h%]h&]h$]h#]h']uh)Kh*hh]q`h>X•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.qa…qb}qc(hh^hh\ubaubhB)qd}qe(hXThe 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.qfhh,hhhhFh!}qg(h%]h&]h$]h#]h']uh)Kh*hh]qhh>XThe 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.qi…qj}qk(hhfhhdubaubhB)ql}qm(hX/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.qnhh,hhhhFh!}qo(h%]h&]h$]h#]h']uh)Kh*hh]qph>X/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.qq…qr}qs(hhnhhlubaubhB)qt}qu(hXyBut C was written to write programs, not to research computer science and that's exactly what made it useful and popular.qvhh,hhhhFh!}qw(h%]h&]h$]h#]h']uh)K"h*hh]qxh>XyBut C was written to write programs, not to research computer science and that's exactly what made it useful and popular.qy…qz}q{(hhvhhtubaubhB)q|}q}(hX­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.q~hh,hhhhFh!}q(h%]h&]h$]h#]h']uh)K%h*hh]q€h>X­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.q…q‚}qƒ(hh~hh|ubaubhB)q„}q…(hXdI won't claim that it is enough to make grown men cry, but it certainly was enough to make me angry.q†hh,hhhhFh!}q‡(h%]h&]h$]h#]h']uh)K)h*hh]qˆh>XdI won't claim that it is enough to make grown men cry, but it certainly was enough to make me angry.q‰…qŠ}q‹(hh†hh„ubaubhB)qŒ}q(hX4Let me give you an example of their utter sillyness:qŽhh,hhhhFh!}q(h%]h&]h$]h#]h']uh)K,h*hh]qh>X4Let me give you an example of their utter sillyness:q‘…q’}q“(hhŽhhŒubaubhB)q”}q•(hXµ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.q–hh,hhhhFh!}q—(h%]h&]h$]h#]h']uh)K.h*hh]q˜h>Xµ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.q™…qš}q›(hh–hh”ubaubhB)qœ}q(hX€When compiled, the assembler saw all of these words prefixed with an underscore, which made it easy to mix assembler and C code.qžhh,hhhhFh!}qŸ(h%]h&]h$]h#]h']uh)K2h*hh]q h>X€When compiled, the assembler saw all of these words prefixed with an underscore, which made it easy to mix assembler and C code.q¡…q¢}q£(hhžhhœubaubhB)q¤}q¥(hXbAll the macros for the C-preprocessor on the other hand, were UPPERCASE, making them easy to spot.q¦hh,hhhhFh!}q§(h%]h&]h$]h#]h']uh)K6h*hh]q¨h>XbAll the macros for the C-preprocessor on the other hand, were UPPERCASE, making them easy to spot.q©…qª}q«(hh¦hh¤ubaubhB)q¬}q­(hX|Which meant that if you mixed upper and lower case, in your identifiers, you were safe: That wouldn't collide with anything.q®hh,hhhhFh!}q¯(h%]h&]h$]h#]h']uh)K9h*hh]q°h>X|Which meant that if you mixed upper and lower case, in your identifiers, you were safe: That wouldn't collide with anything.q±…q²}q³(hh®hh¬ubaubhB)q´}qµ(hX“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:q¶hh,hhhhFh!}q·(h%]h&]h$]h#]h']uh)KX“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:q¹…qº}q»(hh¶hh´ubaubcdocutils.nodes block_quote q¼)q½}q¾(hUhh,hhhU block_quoteq¿h!}qÀ(h%]h&]h$]h#]h']uh)Nh*hh]qÁhB)qÂ}qÃ(hXƒAll identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use.qÄhh½hhhhFh!}qÅ(h%]h&]h$]h#]h']uh)K@h]qÆh>XƒAll identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use.qÇ…qÈ}qÉ(hhÄhhÂubaubaubhB)qÊ}qË(hXCFeel free to guess, there's more such on pdf page 200 of the draft.qÌhh,hhhhFh!}qÍ(h%]h&]h$]h#]h']uh)KDh*hh]qÎh>XCFeel free to guess, there's more such on pdf page 200 of the draft.qÏ…qÐ}qÑ(hhÌhhÊubaubhB)qÒ}qÓ(hX€Next, they broke the upper/lower rule, by adding special keywords in mixed case, probably because they thought it looked nicer::hh,hhhhFh!}qÔ(h%]h&]h$]h#]h']uh)KFh*hh]qÕh>XNext, they broke the upper/lower rule, by adding special keywords in mixed case, probably because they thought it looked nicer:qÖ…q×}qØ(hXNext, they broke the upper/lower rule, by adding special keywords in mixed case, probably because they thought it looked nicer:hhÒubaubcdocutils.nodes literal_block qÙ)qÚ}qÛ(hX_Atomic, _Bool, _Noreturn &chh,hhhU literal_blockqÜh!}qÝ(U xml:spaceqÞUpreserveqßh#]h$]h%]h&]h']uh)KIh*hh]qàh>X_Atomic, _Bool, _Noreturn &cqá…qâ}qã(hUhhÚubaubhB)qä}qå(hX>Then, presumably, somebody pointed out that this looked ugly::qæhh,hhhhFh!}qç(h%]h&]h$]h#]h']uh)KKh*hh]qèh>X=Then, presumably, somebody pointed out that this looked ugly:qé…qê}që(hX=Then, presumably, somebody pointed out that this looked ugly:hhäubaubhÙ)qì}qí(hXvoid _Noreturn foo(int bar);hh,hhhhÜh!}qî(hÞhßh#]h$]h%]h&]h']uh)KMh*hh]qïh>Xvoid _Noreturn foo(int bar);qð…qñ}qò(hUhhìubaubhB)qó}qô(hX`So they have come up with a #include file called so that instead you can write::hh,hhhhFh!}qõ(h%]h&]h$]h#]h']uh)KOh*hh]qöh>X_So they have come up with a #include file called so that instead you can write:q÷…qø}qù(hX_So they have come up with a #include file called so that instead you can write:hhóubaubhÙ)qú}qû(hX4#include void noreturn foo(int bar);hh,hhhhÜh!}qü(hÞhßh#]h$]h%]h&]h']uh)KRh*hh]qýh>X4#include void noreturn foo(int bar);qþ…qÿ}r(hUhhúubaubhB)r}r(hXTThe file according to the standard shall have exactly this content::hh,hhhhFh!}r(h%]h&]h$]h#]h']uh)KUh*hh]rh>XSThe file according to the standard shall have exactly this content:r…r}r(hXSThe file according to the standard shall have exactly this content:hjubaubhÙ)r}r (hX#define noreturn _Noreturnhh,hhhhÜh!}r (hÞhßh#]h$]h%]h&]h']uh)KXh*hh]r h>X#define noreturn _Noreturnr …r }r(hUhjubaubhB)r}r(hX1Are you crying or laughing yet ? You should be.rhh,hhhhFh!}r(h%]h&]h$]h#]h']uh)KZh*hh]rh>X1Are you crying or laughing yet ? You should be.r…r}r(hjhjubaubhB)r}r(hX¥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.rhh,hhhhFh!}r(h%]h&]h$]h#]h']uh)K\h*hh]rh>X¥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.r…r}r(hjhjubaubhB)r}r (hX’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.r!hh,hhhhFh!}r"(h%]h&]h$]h#]h']uh)K`h*hh]r#h>X’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.r$…r%}r&(hj!hjubaubhB)r'}r((hX‹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.r)hh,hhhhFh!}r*(h%]h&]h$]h#]h']uh)Kdh*hh]r+h>X‹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.r,…r-}r.(hj)hj'ubaubhB)r/}r0(hX 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.r1hh,hhhhFh!}r2(h%]h&]h$]h#]h']uh)Khh*hh]r3h>X 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.r4…r5}r6(hj1hj/ubaubhB)r7}r8(hXã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.r9hh,hhhhFh!}r:(h%]h&]h$]h#]h']uh)Kmh*hh]r;h>Xã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.r<…r=}r>(hj9hj7ubaubhB)r?}r@(hX 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".rAhh,hhhhFh!}rB(h%]h&]h$]h#]h']uh)Krh*hh]rCh>X 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".rD…rE}rF(hjAhj?ubaubhB)rG}rH(hXlThe way both pthreads and C1X threads do this, is you specify a UTC wall clock time you want to sleep until.rIhh,hhhhFh!}rJ(h%]h&]h$]h#]h']uh)Kvh*hh]rKh>XlThe way both pthreads and C1X threads do this, is you specify a UTC wall clock time you want to sleep until.rL…rM}rN(hjIhjGubaubhB)rO}rP(hX 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.rQhh,hhhhFh!}rR(h%]h&]h$]h#]h']uh)Kyh*hh]rSh>X 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.rT…rU}rV(hjQhjOubaubhB)rW}rX(hXÙ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::hh,hhhhFh!}rY(h%]h&]h$]h#]h']uh)Kh*hh]rZh>XØ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:r[…r\}r](hXØ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:hjWubaubhÙ)r^}r_(hXIint 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); }hh,hhhhÜh!}r`(hÞhßh#]h$]h%]h&]h']uh)K„h*hh]rah>XIint 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); }rb…rc}rd(hUhj^ubaubhB)re}rf(hX½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.rghh,hhhhFh!}rh(h%]h&]h$]h#]h']uh)K’h*hh]rih>X½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.rj…rk}rl(hjghjeubaubhB)rm}rn(hXê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.rohh,hhhhFh!}rp(h%]h&]h$]h#]h']uh)K–h*hh]rqh>Xê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.rr…rs}rt(hjohjmubaubhB)ru}rv(hX±Ohh, and setting the stack-size for a new thread ? That is appearantly "too dangerous" so there is no argument in the C1X API for doing so, a clear step backwards from pthreads.rwhh,hhhhFh!}rx(h%]h&]h$]h#]h']uh)K›h*hh]ryh>X±Ohh, and setting the stack-size for a new thread ? That is appearantly "too dangerous" so there is no argument in the C1X API for doing so, a clear step backwards from pthreads.rz…r{}r|(hjwhjuubaubhB)r}}r~(hXSBut guess what: Thread stacks are like T-shirts: There is no "one size fits all."rhh,hhhhFh!}r€(h%]h&]h$]h#]h']uh)KŸh*hh]rh>XSBut guess what: Thread stacks are like T-shirts: There is no "one size fits all."r‚…rƒ}r„(hjhj}ubaubhB)r…}r†(hXqI have no idea what the "danger" they perceived were, my best guess is that feared it might make the API useful ?r‡hh,hhhhFh!}rˆ(h%]h&]h$]h#]h']uh)K¢h*hh]r‰h>XqI have no idea what the "danger" they perceived were, my best guess is that feared it might make the API useful ?rŠ…r‹}rŒ(hj‡hj…ubaubhB)r}rŽ(hXOThis single idiocy will single-handedly doom the C1X thread API to uselessness.rhh,hhhhFh!}r(h%]h&]h$]h#]h']uh)K¥h*hh]r‘h>XOThis single idiocy will single-handedly doom the C1X thread API to uselessness.r’…r“}r”(hjhjubaubhB)r•}r–(hXNow, 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.r—hh,hhhhFh!}r˜(h%]h&]h$]h#]h']uh)K¨h*hh]r™h>XNow, 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.rš…r›}rœ(hj—hj•ubaubhB)r}rž(hX³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.rŸhh,hhhhFh!}r (h%]h&]h$]h#]h']uh)K­h*hh]r¡h>X³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.r¢…r£}r¤(hjŸhjubaubhB)r¥}r¦(hX~Heck, even a simple basic object facility would be good addition, now that C++ have become this huge bloated monster language.r§hh,hhhhFh!}r¨(h%]h&]h$]h#]h']uh)K±h*hh]r©h>X~Heck, even a simple basic object facility would be good addition, now that C++ have become this huge bloated monster language.rª…r«}r¬(hj§hj¥ubaubhB)r­}r®(hXuBut none of that is appearantly as important as and a new, crippled and therefore useless thread API.r¯hh,hhhhFh!}r°(h%]h&]h$]h#]h']uh)K´h*hh]r±h>XuBut none of that is appearantly as important as and a new, crippled and therefore useless thread API.r²…r³}r´(hj¯hj­ubaubhB)rµ}r¶(hXË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.r·hh,hhhhFh!}r¸(h%]h&]h$]h#]h']uh)K·h*hh]r¹h>XË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.rº…r»}r¼(hj·hjµubaubhB)r½}r¾(hX–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::hh,hhhhFh!}r¿(h%]h&]h$]h#]h']uh)K»h*hh]rÀh>X•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:rÁ…rÂ}rÃ(hX•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:hj½ubaubhÙ)rÄ}rÅ(hXi#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)hh,hhhhÜh!}rÆ(hÞhßh#]h$]h%]h&]h']uh)K¿h*hh]rÇh>Xi#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)rÈ…rÉ}rÊ(hUhjÄubaubhB)rË}rÌ(hX#To put an element on a linked list.rÍhh,hhhhFh!}rÎ(h%]h&]h$]h#]h']uh)KÆh*hh]rÏh>X#To put an element on a linked list.rÐ…rÑ}rÒ(hjÍhjËubaubhB)rÓ}rÔ(hXÜ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.rÕhh,hhhhFh!}rÖ(h%]h&]h$]h#]h']uh)KÈh*hh]r×h>XÜ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.rØ…rÙ}rÚ(hjÕhjÓubaubhB)rÛ}rÜ(hX­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.rÝhh,hhhhFh!}rÞ(h%]h&]h$]h#]h']uh)KÍh*hh]rßh>X­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.rà…rá}râ(hjÝhjÛubaubhB)rã}rä(hXHFrom where I sit, ISO WG14 are destroying the C language I use and love.råhh,hhhhFh!}ræ(h%]h&]h$]h#]h']uh)KÑh*hh]rçh>XHFrom where I sit, ISO WG14 are destroying the C language I use and love.rè…ré}rê(hjåhjãubaubhB)rë}rì(hXPoul-Henning, 2011-12-20ríhh,hhhhFh!}rî(h%]h&]h$]h#]h']uh)KÓh*hh]rïh>XPoul-Henning, 2011-12-20rð…rñ}rò(hjíhjëubaubeubehUU transformerróNU footnote_refsrô}rõUrefnamesrö}r÷Usymbol_footnotesrø]rùUautofootnote_refsrú]rûUsymbol_footnote_refsrü]rýU citationsrþ]rÿh*hU current_linerNUtransform_messagesr]rcdocutils.nodes system_message r)r}r(hUh!}r(h%]UlevelKh#]h$]Usourcehh&]h']UlineKUtypeUINFOruh]rhB)r }r (hUh!}r (h%]h&]h$]h#]h']uhjh]r h>X<Hyperlink target "phk-thetoolsweworkwith" is not referenced.r …r}r(hUhj ubahhFubahUsystem_messagerubaUreporterrNUid_startrKU autofootnotesr]rU citation_refsr}rUindirect_targetsr]rUsettingsr(cdocutils.frontend Values ror}r(Ufootnote_backlinksrKUrecord_dependenciesrNU rfc_base_urlrUhttp://tools.ietf.org/html/r U tracebackr!ˆUpep_referencesr"NUstrip_commentsr#NU toc_backlinksr$Uentryr%U language_coder&Uenr'U datestampr(NU report_levelr)KU _destinationr*NU halt_levelr+KU strip_classesr,Nh;NUerror_encoding_error_handlerr-Ubackslashreplacer.Udebugr/NUembed_stylesheetr0‰Uoutput_encoding_error_handlerr1Ustrictr2U sectnum_xformr3KUdump_transformsr4NU docinfo_xformr5KUwarning_streamr6NUpep_file_url_templater7Upep-%04dr8Uexit_status_levelr9KUconfigr:NUstrict_visitorr;NUcloak_email_addressesr<ˆUtrim_footnote_reference_spacer=‰Uenvr>NUdump_pseudo_xmlr?NUexpose_internalsr@NUsectsubtitle_xformrA‰U source_linkrBNUrfc_referencesrCNUoutput_encodingrDUutf-8rEU source_urlrFNUinput_encodingrGU utf-8-sigrHU_disable_configrINU id_prefixrJUU tab_widthrKKUerror_encodingrLUUTF-8rMU_sourcerNU:/home/tfheen/varnish/doc/sphinx/phk/thetoolsweworkwith.rstrOUgettext_compactrPˆU generatorrQNUdump_internalsrRNU smart_quotesrS‰U pep_base_urlrTUhttp://www.python.org/dev/peps/rUUsyntax_highlightrVUlongrWUinput_encoding_error_handlerrXj2Uauto_id_prefixrYUidrZUdoctitle_xformr[‰Ustrip_elements_with_classesr\NU _config_filesr]]Ufile_insertion_enabledr^KU raw_enabledr_KU dump_settingsr`NubUsymbol_footnote_startraKUidsrb}rc(hh,hh,uUsubstitution_namesrd}rehh*h!}rf(h%]h#]h$]Usourcehh&]h']uU footnotesrg]rhUrefidsri}rjh]rkhasub.varnish-3.0.5/doc/sphinx/=build/doctrees/phk/three-zero.doctree0000644000175000017500000002521612247037213021420 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(Xphk_3.0qˆX"thoughts on the eve of varnish 3.0qNXthe fraud policeqˆuUsubstitution_defsq }q Uparse_messagesq ]q Ucurrent_sourceq NU decorationqNUautofootnote_startqKUnameidsq}q(hUphk-3-0qhU"thoughts-on-the-eve-of-varnish-3-0qhUthe-fraud-policequUchildrenq]q(cdocutils.nodes target q)q}q(U rawsourceqX .. _phk_3.0:UparentqhUsourceqcdocutils.nodes reprunicode qX2/home/tfheen/varnish/doc/sphinx/phk/three-zero.rstq…q}q bUtagnameq!Utargetq"U attributesq#}q$(Uidsq%]Ubackrefsq&]Udupnamesq']Uclassesq(]Unamesq)]Urefidq*huUlineq+KUdocumentq,hh]ubcdocutils.nodes section q-)q.}q/(hUhhhhUexpect_referenced_by_nameq0}q1hhsh!Usectionq2h#}q3(h']h(]h&]h%]q4(hheh)]q5(hheuh+Kh,hUexpect_referenced_by_idq6}q7hhsh]q8(cdocutils.nodes title q9)q:}q;(hX"Thoughts on the eve of Varnish 3.0q(h']h(]h&]h%]h)]uh+Kh,hh]q?cdocutils.nodes Text q@X"Thoughts on the eve of Varnish 3.0qA…qB}qC(hh`_ 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.hh.hhh!hHh#}q¶(h']h(]h&]h%]h)]uh+K8h,hh]q·(h@XI still worry about the q¸…q¹}qº(hXI still worry about the hh´ubcdocutils.nodes reference q»)q¼}q½(hXO`The Fraud Police `_h#}q¾(UnameXThe Fraud PoliceUrefuriq¿X9http://www.theshadowbox.net/forum/index.php?topic=18041.0qÀh%]h&]h']h(]h)]uhh´h]qÁh@XThe Fraud PoliceqÂ…qÃ}qÄ(hUhh¼ubah!U referenceqÅubh)qÆ}qÇ(hX< U referencedqÈKhh´h!h"h#}qÉ(UrefurihÀh%]qÊhah&]h']h(]h)]qËhauh]ubh@X 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.qÌ…qÍ}qÎ(hX 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.hh´ubeubhD)qÏ}qÐ(hXÙ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.qÑhh.hhh!hHh#}qÒ(h']h(]h&]h%]h)]uh+K>h,hh]qÓh@XÙ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.qÔ…qÕ}qÖ(hhÑhhÏubaubhD)q×}qØ(hXMuch appreciated,qÙhh.hhh!hHh#}qÚ(h']h(]h&]h%]h)]uh+KCh,hh]qÛh@XMuch appreciated,qÜ…qÝ}qÞ(hhÙhh×ubaubhD)qß}qà(hXPoul-Henning, 2011-06-02qáhh.hhh!hHh#}qâ(h']h(]h&]h%]h)]uh+KEh,hh]qãh@XPoul-Henning, 2011-06-02qä…qå}qæ(hháhhßubaubeubehUU transformerqçNU footnote_refsqè}qéUrefnamesqê}qëUsymbol_footnotesqì]qíUautofootnote_refsqî]qïUsymbol_footnote_refsqð]qñU citationsqò]qóh,hU current_lineqôNUtransform_messagesqõ]qöcdocutils.nodes system_message q÷)qø}qù(hUh#}qú(h']UlevelKh%]h&]Usourcehh(]h)]UlineKUtypeUINFOqûuh]qühD)qý}qþ(hUh#}qÿ(h']h(]h&]h%]h)]uhhøh]rh@X-Hyperlink target "phk-3-0" is not referenced.r…r}r(hUhhýubah!hHubah!Usystem_messagerubaUreporterrNUid_startrKU autofootnotesr]rU citation_refsr }r Uindirect_targetsr ]r Usettingsr (cdocutils.frontend Values ror}r(Ufootnote_backlinksrKUrecord_dependenciesrNU rfc_base_urlrUhttp://tools.ietf.org/html/rU tracebackrˆUpep_referencesrNUstrip_commentsrNU toc_backlinksrUentryrU language_coderUenrU datestamprNU report_levelrKU _destinationrNU halt_levelrKU strip_classesr Nh=NUerror_encoding_error_handlerr!Ubackslashreplacer"Udebugr#NUembed_stylesheetr$‰Uoutput_encoding_error_handlerr%Ustrictr&U sectnum_xformr'KUdump_transformsr(NU docinfo_xformr)KUwarning_streamr*NUpep_file_url_templater+Upep-%04dr,Uexit_status_levelr-KUconfigr.NUstrict_visitorr/NUcloak_email_addressesr0ˆUtrim_footnote_reference_spacer1‰Uenvr2NUdump_pseudo_xmlr3NUexpose_internalsr4NUsectsubtitle_xformr5‰U source_linkr6NUrfc_referencesr7NUoutput_encodingr8Uutf-8r9U source_urlr:NUinput_encodingr;U utf-8-sigr<U_disable_configr=NU id_prefixr>UU tab_widthr?KUerror_encodingr@UUTF-8rAU_sourcerBU2/home/tfheen/varnish/doc/sphinx/phk/three-zero.rstrCUgettext_compactrDˆU generatorrENUdump_internalsrFNU smart_quotesrG‰U pep_base_urlrHUhttp://www.python.org/dev/peps/rIUsyntax_highlightrJUlongrKUinput_encoding_error_handlerrLj&Uauto_id_prefixrMUidrNUdoctitle_xformrO‰Ustrip_elements_with_classesrPNU _config_filesrQ]Ufile_insertion_enabledrRKU raw_enabledrSKU dump_settingsrTNubUsymbol_footnote_startrUKUidsrV}rW(hh.hhÆhh.uUsubstitution_namesrX}rYh!h,h#}rZ(h']h%]h&]Usourcehh(]h)]uU footnotesr[]r\Urefidsr]}r^h]r_hasub.varnish-3.0.5/doc/sphinx/=build/doctrees/phk/autocrap.doctree0000644000175000017500000003426612247037213021157 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(X"did you call them autocrap tools ?qNX phk_autocrapqˆuUsubstitution_defsq}q Uparse_messagesq ]q Ucurrent_sourceq NU decorationq NUautofootnote_startqKUnameidsq}q(hU did-you-call-them-autocrap-toolsqhU phk-autocrapquUchildrenq]q(cdocutils.nodes target q)q}q(U rawsourceqX.. _phk_autocrap:UparentqhUsourceqcdocutils.nodes reprunicode qX0/home/tfheen/varnish/doc/sphinx/phk/autocrap.rstq…q}qbUtagnameqUtargetq U attributesq!}q"(Uidsq#]Ubackrefsq$]Udupnamesq%]Uclassesq&]Unamesq']Urefidq(huUlineq)KUdocumentq*hh]ubcdocutils.nodes section q+)q,}q-(hUhhhhUexpect_referenced_by_nameq.}q/hhshUsectionq0h!}q1(h%]h&]h$]h#]q2(hheh']q3(hheuh)Kh*hUexpect_referenced_by_idq4}q5hhsh]q6(cdocutils.nodes title q7)q8}q9(hX$Did you call them *autocrap* tools ?q:hh,hhhUtitleq;h!}q<(h%]h&]h$]h#]h']uh)Kh*hh]q=(cdocutils.nodes Text q>XDid you call them q?…q@}qA(hXDid you call them qBhh8ubcdocutils.nodes emphasis qC)qD}qE(hX *autocrap*qFh!}qG(h%]h&]h$]h#]h']uhh8h]qHh>XautocrapqI…qJ}qK(hUhhDubahUemphasisqLubh>X tools ?qM…qN}qO(hX tools ?qPhh8ubeubcdocutils.nodes paragraph qQ)qR}qS(hXaYes, in fact I did, because they are the worst possible non-solution to a self-inflicted problem.qThh,hhhU paragraphqUh!}qV(h%]h&]h$]h#]h']uh)Kh*hh]qWh>XaYes, in fact I did, because they are the worst possible non-solution to a self-inflicted problem.qX…qY}qZ(hhThhRubaubhQ)q[}q\(hXþ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".q]hh,hhhhUh!}q^(h%]h&]h$]h#]h']uh)K h*hh]q_h>Xþ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".q`…qa}qb(hh]hh[ubaubhQ)qc}qd(hX!That "value" was incompatibility.qehh,hhhhUh!}qf(h%]h&]h$]h#]h']uh)Kh*hh]qgh>X!That "value" was incompatibility.qh…qi}qj(hhehhcubaubhQ)qk}ql(hX—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.qmhh,hhhhUh!}qn(h%]h&]h$]h#]h']uh)Kh*hh]qoh>X—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.qp…qq}qr(hhmhhkubaubhQ)qs}qt(hX˜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.hh,hhhhUh!}qu(h%]h&]h$]h#]h']uh)Kh*hh]qv(h>X;So some deranged imagination, came up with the idea of the qw…qx}qy(hX;So some deranged imagination, came up with the idea of the hhsubcdocutils.nodes literal qz)q{}q|(hX ``configure``h!}q}(h%]h&]h$]h#]h']uhhsh]q~h>X configureq…q€}q(hUhh{ubahUliteralq‚ubh>X3 script, which sniffed at your system and set up a qƒ…q„}q…(hX3 script, which sniffed at your system and set up a hhsubhz)q†}q‡(hX ``Makefile``h!}qˆ(h%]h&]h$]h#]h']uhhsh]q‰h>XMakefileqŠ…q‹}qŒ(hUhh†ubahh‚ubh>X that would work.q…qŽ}q(hX that would work.hhsubeubhQ)q}q‘(hX˜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.q’hh,hhhhUh!}q“(h%]h&]h$]h#]h']uh)Kh*hh]q”h>X˜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.q•…q–}q—(hh’hhubaubhQ)q˜}q™(hXThen 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.hh,hhhhUh!}qš(h%]h&]h$]h#]h']uh)Kh*hh]q›(h>X÷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 qœ…q}qž(hX÷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 hh˜ubhz)qŸ}q (hX``m4``h!}q¡(h%]h&]h$]h#]h']uhh˜h]q¢h>Xm4q£…q¤}q¥(hUhhŸubahh‚ubh>X for the implementation.q¦…q§}q¨(hX for the implementation.hh˜ubeubhQ)q©}qª(hXNow, as it transpires, writing the specification for the configure producing macros was tedious, so somebody wrote a tool to...q«hh,hhhhUh!}q¬(h%]h&]h$]h#]h']uh)K#h*hh]q­h>XNow, as it transpires, writing the specification for the configure producing macros was tedious, so somebody wrote a tool to...q®…q¯}q°(hh«hh©ubaubhQ)q±}q²(hX#...do you detect the pattern here ?q³hh,hhhhUh!}q´(h%]h&]h$]h#]h']uh)K&h*hh]qµh>X#...do you detect the pattern here ?q¶…q·}q¸(hh³hh±ubaubhQ)q¹}qº(hXÖ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.hh,hhhhUh!}q»(h%]h&]h$]h#]h']uh)K(h*hh]q¼(h>X“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 q½…q¾}q¿(hX“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 hh¹ubhC)qÀ}qÁ(hX*trust*h!}qÂ(h%]h&]h$]h#]h']uhh¹h]qÃh>XtrustqÄ…qÅ}qÆ(hUhhÀubahhLubh>X< that things would just work out, then I could live with it.qÇ…qÈ}qÉ(hX< that things would just work out, then I could live with it.hh¹ubeubhQ)qÊ}qË(hXÈ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.qÌhh,hhhhUh!}qÍ(h%]h&]h$]h#]h']uh)K,h*hh]qÎh>XÈ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.qÏ…qÐ}qÑ(hhÌhhÊubaubhQ)qÒ}qÓ(hX 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.qÔhh,hhhhUh!}qÕ(h%]h&]h$]h#]h']uh)K0h*hh]qÖh>X 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.q×…qØ}qÙ(hhÔhhÒubaubhQ)qÚ}qÛ(hXï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.hh,hhhhUh!}qÜ(h%]h&]h$]h#]h']uh)K5h*hh]qÝh>Xî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.qÞ…qß}qà(hXï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.hhÚubaubhQ)qá}qâ(hXVAmongst the silly activites of the autocrap generated configure script in Varnish are:qãhh,hhhhUh!}qä(h%]h&]h$]h#]h']uh)K:h*hh]qåh>XVAmongst the silly activites of the autocrap generated configure script in Varnish are:qæ…qç}qè(hhãhháubaubcdocutils.nodes bullet_list qé)qê}që(hUhh,hhhU bullet_listqìh!}qí(UbulletqîX*h#]h$]h%]h&]h']uh)K=h*hh]qï(cdocutils.nodes list_item qð)qñ}qò(hXPLooks for ANSI-C header files (show me a system later than 1995 without them ?) hhêhhhU list_itemqóh!}qô(h%]h&]h$]h#]h']uh)Nh*hh]qõhQ)qö}q÷(hXOLooks for ANSI-C header files (show me a system later than 1995 without them ?)qøhhñhhhhUh!}qù(h%]h&]h$]h#]h']uh)K=h]qúh>XOLooks for ANSI-C header files (show me a system later than 1995 without them ?)qû…qü}qý(hhøhhöubaubaubhð)qþ}qÿ(hXXExistence and support for POSIX mandated symlinks, (which are not used by Varnish btw.) hhêhhhhóh!}r(h%]h&]h$]h#]h']uh)Nh*hh]rhQ)r}r(hXWExistence and support for POSIX mandated symlinks, (which are not used by Varnish btw.)rhhþhhhhUh!}r(h%]h&]h$]h#]h']uh)K@h]rh>XWExistence and support for POSIX mandated symlinks, (which are not used by Varnish btw.)r…r}r (hjhjubaubaubhð)r }r (hX˜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 ?) hhêhhhhóh!}r (h%]h&]h$]h#]h']uh)Nh*hh]r hQ)r}r(hX—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 ?)rhj hhhhUh!}r(h%]h&]h$]h#]h']uh)KCh]rh>X—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 ?)r…r}r(hjhjubaubaubhð)r}r(hXlChecks if the ISO-C and POSIX mandated ``cos()`` function exists in ``libm`` (No, I have no idea either...) hhêhhhhóh!}r(h%]h&]h$]h#]h']uh)Nh*hh]rhQ)r}r(hXkChecks if the ISO-C and POSIX mandated ``cos()`` function exists in ``libm`` (No, I have no idea either...)hjhhhhUh!}r(h%]h&]h$]h#]h']uh)KGh]r(h>X'Checks if the ISO-C and POSIX mandated r…r}r (hX'Checks if the ISO-C and POSIX mandated hjubhz)r!}r"(hX ``cos()``h!}r#(h%]h&]h$]h#]h']uhjh]r$h>Xcos()r%…r&}r'(hUhj!ubahh‚ubh>X function exists in r(…r)}r*(hX function exists in hjubhz)r+}r,(hX``libm``h!}r-(h%]h&]h$]h#]h']uhjh]r.h>Xlibmr/…r0}r1(hUhj+ubahh‚ubh>X (No, I have no idea either...)r2…r3}r4(hX (No, I have no idea either...)hjubeubaubeubhQ)r5}r6(hX &c. &c. &c.r7hh,hhhhUh!}r8(h%]h&]h$]h#]h']uh)KJh*hh]r9h>X &c. &c. &c.r:…r;}r<(hj7hj5ubaubhQ)r=}r>(hX†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``.hh,hhhhUh!}r?(h%]h&]h$]h#]h']uh)KLh*hh]r@(h>XySome day when I have the time, I will rip out all the autocrap stuff and replace it with a 5 line shellscript that calls rA…rB}rC(hXySome day when I have the time, I will rip out all the autocrap stuff and replace it with a 5 line shellscript that calls hj=ubhz)rD}rE(hX ``uname -s``h!}rF(h%]h&]h$]h#]h']uhj=h]rGh>Xuname -srH…rI}rJ(hUhjDubahh‚ubh>X.…rK}rL(hX.hj=ubeubhQ)rM}rN(hXPoul-Henning, 2010-04-20rOhh,hhhhUh!}rP(h%]h&]h$]h#]h']uh)KOh*hh]rQh>XPoul-Henning, 2010-04-20rR…rS}rT(hjOhjMubaubeubehUU transformerrUNU footnote_refsrV}rWUrefnamesrX}rYUsymbol_footnotesrZ]r[Uautofootnote_refsr\]r]Usymbol_footnote_refsr^]r_U citationsr`]rah*hU current_linerbNUtransform_messagesrc]rdcdocutils.nodes system_message re)rf}rg(hUh!}rh(h%]UlevelKh#]h$]Usourcehh&]h']UlineKUtypeUINFOriuh]rjhQ)rk}rl(hUh!}rm(h%]h&]h$]h#]h']uhjfh]rnh>X2Hyperlink target "phk-autocrap" is not referenced.ro…rp}rq(hUhjkubahhUubahUsystem_messagerrubaUreporterrsNUid_startrtKU autofootnotesru]rvU citation_refsrw}rxUindirect_targetsry]rzUsettingsr{(cdocutils.frontend Values r|or}}r~(Ufootnote_backlinksrKUrecord_dependenciesr€NU rfc_base_urlrUhttp://tools.ietf.org/html/r‚U tracebackrƒˆUpep_referencesr„NUstrip_commentsr…NU toc_backlinksr†Uentryr‡U language_coderˆUenr‰U datestamprŠNU report_levelr‹KU _destinationrŒNU halt_levelrKU strip_classesrŽNh;NUerror_encoding_error_handlerrUbackslashreplacerUdebugr‘NUembed_stylesheetr’‰Uoutput_encoding_error_handlerr“Ustrictr”U sectnum_xformr•KUdump_transformsr–NU docinfo_xformr—KUwarning_streamr˜NUpep_file_url_templater™Upep-%04dršUexit_status_levelr›KUconfigrœNUstrict_visitorrNUcloak_email_addressesržˆUtrim_footnote_reference_spacerŸ‰Uenvr NUdump_pseudo_xmlr¡NUexpose_internalsr¢NUsectsubtitle_xformr£‰U source_linkr¤NUrfc_referencesr¥NUoutput_encodingr¦Uutf-8r§U source_urlr¨NUinput_encodingr©U utf-8-sigrªU_disable_configr«NU id_prefixr¬UU tab_widthr­KUerror_encodingr®UUTF-8r¯U_sourcer°U0/home/tfheen/varnish/doc/sphinx/phk/autocrap.rstr±Ugettext_compactr²ˆU generatorr³NUdump_internalsr´NU smart_quotesrµ‰U pep_base_urlr¶Uhttp://www.python.org/dev/peps/r·Usyntax_highlightr¸Ulongr¹Uinput_encoding_error_handlerrºj”Uauto_id_prefixr»Uidr¼Udoctitle_xformr½‰Ustrip_elements_with_classesr¾NU _config_filesr¿]Ufile_insertion_enabledrÀKU raw_enabledrÁKU dump_settingsrÂNubUsymbol_footnote_startrÃKUidsrÄ}rÅ(hh,hh,uUsubstitution_namesrÆ}rÇhh*h!}rÈ(h%]h#]h$]Usourcehh&]h']uU footnotesrÉ]rÊUrefidsrË}rÌh]rÍhasub.varnish-3.0.5/doc/sphinx/=build/doctrees/phk/sphinx.doctree0000644000175000017500000003326612247037213020651 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(X!why sphinx and restructuredtext ?qNX phk_sphinxqˆXrestructuredtextqˆXsphinxq ˆuUsubstitution_defsq }q Uparse_messagesq ]q Ucurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q(hUwhy-sphinx-and-restructuredtextqhU phk-sphinxqhUrestructuredtextqh UsphinxquUchildrenq]q(cdocutils.nodes target q)q}q(U rawsourceqX.. _phk_sphinx:UparentqhUsourceqcdocutils.nodes reprunicode qX./home/tfheen/varnish/doc/sphinx/phk/sphinx.rstq …q!}q"bUtagnameq#Utargetq$U attributesq%}q&(Uidsq']Ubackrefsq(]Udupnamesq)]Uclassesq*]Unamesq+]Urefidq,huUlineq-KUdocumentq.hh]ubcdocutils.nodes section q/)q0}q1(hUhhhh!Uexpect_referenced_by_nameq2}q3hhsh#Usectionq4h%}q5(h)]h*]h(]h']q6(hheh+]q7(hheuh-Kh.hUexpect_referenced_by_idq8}q9hhsh]q:(cdocutils.nodes title q;)q<}q=(hX#Why Sphinx_ and reStructuredText_ ?q>hh0hh!h#Utitleq?h%}q@(h)]h*]h(]h']h+]uh-Kh.hh]qA(cdocutils.nodes Text qBXWhy qC…qD}qE(hXWhy qFhhh.hh]rhBXgTake a peek at the Python docs, and try pressing the "show source" link at the bottom of the left menu:r…r}r(hjhj ubaubhg)r}r(hX!(link to random python doc page:)rhh0hh!h#hkh%}r(h)]h*]h(]h']h+]uh-KAh.hh]rhBX!(link to random python doc page:)r…r}r(hjhjubaubcdocutils.nodes block_quote r)r}r(hUhh0hh!h#U block_quoter h%}r!(h)]h*]h(]h']h+]uh-Nh.hh]r"hg)r#}r$(hX6http://docs.python.org/py3k/reference/expressions.htmlr%hjhh!h#hkh%}r&(h)]h*]h(]h']h+]uh-KCh]r'hG)r(}r)(hj%h%}r*(Urefurij%h']h(]h)]h*]h+]uhj#h]r+hBX6http://docs.python.org/py3k/reference/expressions.htmlr,…r-}r.(hUhj(ubah#hLubaubaubhg)r/}r0(hXé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.r1hh0hh!h#hkh%}r2(h)]h*]h(]h']h+]uh-KEh.hh]r3hBXé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.r4…r5}r6(hj1hj/ubaubhg)r7}r8(hX[I can live with that, I might even rewrite the VCC scripts from Tcl to Python in that case.r9hh0hh!h#hkh%}r:(h)]h*]h(]h']h+]uh-KJh.hh]r;hBX[I can live with that, I might even rewrite the VCC scripts from Tcl to Python in that case.r<…r=}r>(hj9hj7ubaubhg)r?}r@(hXPoul-Henning, 2010-04-11rAhh0hh!h#hkh%}rB(h)]h*]h(]h']h+]uh-KMh.hh]rChBXPoul-Henning, 2010-04-11rD…rE}rF(hjAhj?ubaubh)rG}rH(hX$.. _Sphinx: http://sphinx.pocoo.org/U referencedrIKhh0hh!h#h$h%}rJ(hOhPh']rKhah(]h)]h*]h+]rLh auh-KPh.hh]ubh)rM}rN(hX>.. _reStructuredText: http://docutils.sourceforge.net/rst.htmljIKhh0hh!h#h$h%}rO(hOh^h']rPhah(]h)]h*]h+]rQhauh-KQh.hh]ubeubehUU transformerrRNU footnote_refsrS}rTUrefnamesrU}rV(Xrestructuredtext]rW(hYhñeXsphinx]rX(hHhûeuUsymbol_footnotesrY]rZUautofootnote_refsr[]r\Usymbol_footnote_refsr]]r^U citationsr_]r`h.hU current_lineraNUtransform_messagesrb]rccdocutils.nodes system_message rd)re}rf(hUh%}rg(h)]UlevelKh']h(]Usourceh!h*]h+]UlineKUtypeUINFOrhuh]rihg)rj}rk(hUh%}rl(h)]h*]h(]h']h+]uhjeh]rmhBX0Hyperlink target "phk-sphinx" is not referenced.rn…ro}rp(hUhjjubah#hkubah#Usystem_messagerqubaUreporterrrNUid_startrsKU autofootnotesrt]ruU citation_refsrv}rwUindirect_targetsrx]ryUsettingsrz(cdocutils.frontend Values r{or|}r}(Ufootnote_backlinksr~KUrecord_dependenciesrNU rfc_base_urlr€Uhttp://tools.ietf.org/html/rU tracebackr‚ˆUpep_referencesrƒNUstrip_commentsr„NU toc_backlinksr…Uentryr†U language_coder‡UenrˆU datestampr‰NU report_levelrŠKU _destinationr‹NU halt_levelrŒKU strip_classesrNh?NUerror_encoding_error_handlerrŽUbackslashreplacerUdebugrNUembed_stylesheetr‘‰Uoutput_encoding_error_handlerr’Ustrictr“U sectnum_xformr”KUdump_transformsr•NU docinfo_xformr–KUwarning_streamr—NUpep_file_url_templater˜Upep-%04dr™Uexit_status_levelršKUconfigr›NUstrict_visitorrœNUcloak_email_addressesrˆUtrim_footnote_reference_spacerž‰UenvrŸNUdump_pseudo_xmlr NUexpose_internalsr¡NUsectsubtitle_xformr¢‰U source_linkr£NUrfc_referencesr¤NUoutput_encodingr¥Uutf-8r¦U source_urlr§NUinput_encodingr¨U utf-8-sigr©U_disable_configrªNU id_prefixr«UU tab_widthr¬KUerror_encodingr­UUTF-8r®U_sourcer¯U./home/tfheen/varnish/doc/sphinx/phk/sphinx.rstr°Ugettext_compactr±ˆU generatorr²NUdump_internalsr³NU smart_quotesr´‰U pep_base_urlrµUhttp://www.python.org/dev/peps/r¶Usyntax_highlightr·Ulongr¸Uinput_encoding_error_handlerr¹j“Uauto_id_prefixrºUidr»Udoctitle_xformr¼‰Ustrip_elements_with_classesr½NU _config_filesr¾]r¿Ufile_insertion_enabledrÀKU raw_enabledrÁKU dump_settingsrÂNubUsymbol_footnote_startrÃKUidsrÄ}rÅ(hjGhjMhh0hh0uUsubstitution_namesrÆ}rÇh#h.h%}rÈ(h)]h']h(]Usourceh!h*]h+]uU footnotesrÉ]rÊUrefidsrË}rÌh]rÍhasub.varnish-3.0.5/doc/sphinx/=build/doctrees/phk/varnish_does_not_hash.doctree0000644000175000017500000004600012247037213023675 00000000000000€cdocutils.nodes document q)q}q(U nametypesq}q(Xwhat varnish doesqNXvarnish does not hashqNXphk_varnish_does_not_hashqˆuUsubstitution_defsq }q Uparse_messagesq ]q (cdocutils.nodes system_message q )q}q(U rawsourceqUU attributesq}q(Udupnamesq]UlevelKUidsq]Ubackrefsq]Usourcecdocutils.nodes reprunicode qX=/home/tfheen/varnish/doc/sphinx/phk/varnish_does_not_hash.rstq…q}qbUclassesq]Unamesq]UlineK3UtypeUINFOquUparentqcdocutils.nodes definition q)q}q (hUh}q!(h]h]h]h]h]uhcdocutils.nodes definition_list_item q")q#}q$(hXChange:: foo=somedict[$somekey]hcdocutils.nodes definition_list q%)q&}q'(hUhcdocutils.nodes section q()q)}q*(hUhhUsourceq+hUexpect_referenced_by_nameq,}q-hcdocutils.nodes target q.)q/}q0(hX.. _phk_varnish_does_not_hash:hhh+hUtagnameq1Utargetq2h}q3(h]h]h]h]h]Urefidq4Uphk-varnish-does-not-hashq5uUlineq6KUdocumentq7hUchildrenq8]ubsh1Usectionq9h}q:(h]h]h]h]q;(Uvarnish-does-not-hashq}q?h5h/sh8]q@(cdocutils.nodes title qA)qB}qC(hXVarnish Does Not HashqDhh)h+hh1UtitleqEh}qF(h]h]h]h]h]uh6Kh7hh8]qGcdocutils.nodes Text qHXVarnish Does Not HashqI…qJ}qK(hhDhhBubaubcdocutils.nodes paragraph qL)qM}qN(hX‚A spate of security advisories related to hash-collisions have made a lot of people stare at Varnish and wonder if it is affected.qOhh)h+hh1U paragraphqPh}qQ(h]h]h]h]h]uh6Kh7hh8]qRhHX‚A spate of security advisories related to hash-collisions have made a lot of people stare at Varnish and wonder if it is affected.qS…qT}qU(hhOhhMubaubhL)qV}qW(hXPThe answer is no, but the explanation is probably not what most of you expected:qXhh)h+hh1hPh}qY(h]h]h]h]h]uh6K h7hh8]qZhHXPThe answer is no, but the explanation is probably not what most of you expected:q[…q\}q](hhXhhVubaubhL)q^}q_(hXsVarnish does not hash, at least not by default, and even if it does, it's still as immune to the attacks as can be.q`hh)h+hh1hPh}qa(h]h]h]h]h]uh6K h7hh8]qbhHXsVarnish does not hash, at least not by default, and even if it does, it's still as immune to the attacks as can be.qc…qd}qe(hh`hh^ubaubhL)qf}qg(hXjTo understand what is going on, I have to introduce a concept from Shannons information theory: "entropy."qhhh)h+hh1hPh}qi(h]h]h]h]h]uh6Kh7hh8]qjhHXjTo understand what is going on, I have to introduce a concept from Shannons information theory: "entropy."qk…ql}qm(hhhhhfubaubhL)qn}qo(hXxEntropy is hard to explain, and according to legend, that is exactly why Shannon recycled that term from thermodynamics.qphh)h+hh1hPh}qq(h]h]h]h]h]uh6Kh7hh8]qrhHXxEntropy is hard to explain, and according to legend, that is exactly why Shannon recycled that term from thermodynamics.qs…qt}qu(hhphhnubaubhL)qv}qw(hX\In this context, we can get away with thinking about entropy as how much our "keys" differ::hh)h+hh1hPh}qx(h]h]h]h]h]uh6Kh7hh8]qyhHX[In this context, we can get away with thinking about entropy as how much our "keys" differ:qz…q{}q|(hX[In this context, we can get away with thinking about entropy as how much our "keys" differ:hhvubaubcdocutils.nodes literal_block q})q~}q(hXLow 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.htmlhh)h+hh1U literal_blockq€h}q(U xml:spaceq‚Upreserveqƒh]h]h]h]h]uh6Kh7hh8]q„hHXLow 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.htmlq……q†}q‡(hUhh~ubaubhL)qˆ}q‰(hXrHashing consists of calculating a hash-index from the key and storing the objects in an array indexed by that key.qŠhh)h+hh1hPh}q‹(h]h]h]h]h]uh6K!h7hh8]qŒhHXrHashing consists of calculating a hash-index from the key and storing the objects in an array indexed by that key.q…qŽ}q(hhŠhhˆubaubhL)q}q‘(hXÂ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 loosing any of the entropy.q’hh)h+hh1hPh}q“(h]h]h]h]h]uh6K$h7hh8]q”hHXÂ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 loosing any of the entropy.q•…q–}q—(hh’hhubaubhL)q˜}q™(hXŒNeedless to say, the more entropy you have to begin with, the more of it you can afford to loose, and loose some you almost invariably will.qšhh)h+hh1hPh}q›(h]h]h]h]h]uh6K(h7hh8]qœhHXŒNeedless to say, the more entropy you have to begin with, the more of it you can afford to loose, and loose some you almost invariably will.q…qž}qŸ(hhšhh˜ubaubhL)q }q¡(hX€There are two families of hash-functions, the fast ones, and the good ones, and the security advisories are about the fast ones.q¢hh)h+hh1hPh}q£(h]h]h]h]h]uh6K,h7hh8]q¤hHX€There are two families of hash-functions, the fast ones, and the good ones, and the security advisories are about the fast ones.q¥…q¦}q§(hh¢hh ubaubhL)q¨}q©(hXxThe good ones are slower, but probably not so much slower that you care, and therefore, if you want to fix your web-app:qªhh)h+hh1hPh}q«(h]h]h]h]h]uh6K/h7hh8]q¬hHXxThe good ones are slower, but probably not so much slower that you care, and therefore, if you want to fix your web-app:q­…q®}q¯(hhªhh¨ubaubh&hL)q°}q±(hX and forget about the advisories.q²hh)h+hh1hPh}q³(h]h]h]h]h]uh6K7h7hh8]q´hHX and forget about the advisories.qµ…q¶}q·(hh²hh°ubaubhL)q¸}q¹(hXú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.qºhh)h+hh1hPh}q»(h]h]h]h]h]uh6K9h7hh8]q¼hHXú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.q½…q¾}q¿(hhºhh¸ubaubh()qÀ}qÁ(hUhh)h+hh1h9h}qÂ(h]h]h]h]qÃUwhat-varnish-doesqÄah]qÅhauh6K@h7hh8]qÆ(hA)qÇ}qÈ(hXWhat Varnish DoesqÉhhÀh+hh1hEh}qÊ(h]h]h]h]h]uh6K@h7hh8]qËhHXWhat Varnish DoesqÌ…qÍ}qÎ(hhÉhhÇubaubhL)qÏ}qÐ(hX”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.qÑhhÀh+hh1hPh}qÒ(h]h]h]h]h]uh6KBh7hh8]qÓhHX”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.qÔ…qÕ}qÖ(hhÑhhÏubaubhL)q×}qØ(hX$Varnish does that, but with a twist.qÙhhÀh+hh1hPh}qÚ(h]h]h]h]h]uh6KFh7hh8]qÛhHX$Varnish does that, but with a twist.qÜ…qÝ}qÞ(hhÙhh×ubaubhL)qß}qà(hXDThe "keys" in varnish can be very long, by default they consist of::qáhhÀh+hh1hPh}qâ(h]h]h]h]h]uh6KHh7hh8]qãhHXCThe "keys" in varnish can be very long, by default they consist of:qä…qå}qæ(hXCThe "keys" in varnish can be very long, by default they consist of:hhßubaubh})qç}qè(hX§sub vcl_hash { hash_data(req.url); if (req.http.host) { hash_data(req.http.host); } else { hash_data(server.ip); } return (hash); }hhÀh+hh1h€h}qé(h‚hƒh]h]h]h]h]uh6KJh7hh8]qêhHX§sub vcl_hash { hash_data(req.url); if (req.http.host) { hash_data(req.http.host); } else { hash_data(server.ip); } return (hash); }që…qì}qí(hUhhçubaubhL)qî}qï(hX 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.qðhhÀh+hh1hPh}qñ(h]h]h]h]h]uh6KTh7hh8]qòhHX 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.qó…qô}qõ(hhðhhîubaubhL)qö}q÷(hX×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.qøhhÀh+hh1hPh}qù(h]h]h]h]h]uh6KYh7hh8]qúhHX×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.qû…qü}qý(hhøhhöubaubhL)qþ}qÿ(hX¶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.rhhÀh+hh1hPh}r(h]h]h]h]h]uh6K^h7hh8]rhHX¶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.r…r}r(hjhhþubaubhL)r}r(hXè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.rhhÀh+hh1hPh}r (h]h]h]h]h]uh6Kbh7hh8]r hHXè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.r …r }r (hjhjubaubhL)r}r(hXÚ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.rhhÀh+hh1hPh}r(h]h]h]h]h]uh6Kgh7hh8]rhHXÚ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.r…r}r(hjhjubaubhL)r}r(hXÇ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.rhhÀh+hh1hPh}r(h]h]h]h]h]uh6Klh7hh8]rhHXÇ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.r…r}r(hjhjubaubhL)r}r(hX÷So what Varnish does is "key-compression": All the strings hash_data() are fed, 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.r hhÀh+hh1hPh}r!(h]h]h]h]h]uh6Kph7hh8]r"hHX÷So what Varnish does is "key-compression": All the strings hash_data() are fed, 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.r#…r$}r%(hj hjubaubhL)r&}r'(hXˆ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::hhÀh+hh1hPh}r((h]h]h]h]h]uh6Kuh7hh8]r)hHX‡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:r*…r+}r,(hX‡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:hj&ubaubh})r-}r.(hXUstruct objhead { [...] unsigned char digest[DIGEST_LEN]; };hhÀh+hh1h€h}r/(h‚hƒh]h]h]h]h]uh6Kxh7hh8]r0hHXUstruct objhead { [...] unsigned char digest[DIGEST_LEN]; };r1…r2}r3(hUhj-ubaubhL)r4}r5(hXXIn the example above, the output of SHA256 for the 1 bit difference in entropy becomes::hhÀh+hh1hPh}r6(h]h]h]h]h]uh6K}h7hh8]r7hHXWIn the example above, the output of SHA256 for the 1 bit difference in entropy becomes:r8…r9}r:(hXWIn the example above, the output of SHA256 for the 1 bit difference in entropy becomes:hj4ubaubh})r;}r<(hXé/foo/bar/barf/some/cms/content/article?article=2 -> 14f0553caa5c796650ec82256e3f111ae2f20020a4b9029f135a01610932054e /foo/bar/barf/some/cms/content/article?article=3 -> 4d45b9544077921575c3c5a2a14c779bff6c4830d1fbafe4bd7e03e5dd93ca05hhÀh+hh1h€h}r=(h‚hƒh]h]h]h]h]uh6K€h7hh8]r>hHXé/foo/bar/barf/some/cms/content/article?article=2 -> 14f0553caa5c796650ec82256e3f111ae2f20020a4b9029f135a01610932054e /foo/bar/barf/some/cms/content/article?article=3 -> 4d45b9544077921575c3c5a2a14c779bff6c4830d1fbafe4bd7e03e5dd93ca05r?…r@}rA(hUhj;ubaubhL)rB}rC(hXThat should be random enough.rDhhÀh+hh1hPh}rE(h]h]h]h]h]uh6K…h7hh8]rFhHXThat should be random enough.rG…rH}rI(hjDhjBubaubhL)rJ}rK(hXù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 bytes long files through SHA256 and sooner or later you will get collisions.rLhhÀh+hh1hPh}rM(h]h]h]h]h]uh6K‡h7hh8]rNhHXù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 bytes long files through SHA256 and sooner or later you will get collisions.rO…rP}rQ(hjLhjJubaubhL)rR}rS(hXë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.rThhÀh+hh1hPh}rU(h]h]h]h]h]uh6KŒh7hh8]rVhHXë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.rW…rX}rY(hjThjRubaubhL)rZ}r[(hXPoul-Henning, 2012-01-03r\hhÀh+hh1hPh}r](h]h]h]h]h]uh6K‘h7hh8]r^hHXPoul-Henning, 2012-01-03r_…r`}ra(hj\hjZubaubeubeubh+hh1Udefinition_listrbh}rc(h]h]h]h]h]uh6Nh7hh8]rd(h#h")re}rf(hX!To:: foo=somedict[md5($somekey)] hh&h+hh1Udefinition_list_itemrgh}rh(h]h]h]h]h]uh6K5h7hh8]ri(cdocutils.nodes term rj)rk}rl(hXTo::rmhjeh+hh1Utermrnh}ro(h]h]h]h]h]uh6K5h8]rphHXTo::rq…rr}rs(hjmhjkubaubh)rt}ru(hUh}rv(h]h]h]h]h]uhjeh8]rwhL)rx}ry(hXfoo=somedict[md5($somekey)]rzhjth+hh1hPh}r{(h]h]h]h]h]uh6K5h8]r|hHXfoo=somedict[md5($somekey)]r}…r~}r(hjzhjxubaubah1U definitionr€ubeubeubh+hh1jgh}r(h]h]h]h]h]uh6K2h8]r‚(jj)rƒ}r„(hXChange::r…hh#h+hh1jnh}r†(h]h]h]h]h]uh6K2h8]r‡hHXChange::rˆ…r‰}rŠ(hj…hjƒubaubheubh8]r‹hL)rŒ}r(hXfoo=somedict[$somekey]rŽhhh+hh1hPh}r(h]h]h]h]h]uh6K3h8]rhHXfoo=somedict[$somekey]r‘…r’}r“(hjŽhjŒubaubah1j€ubh8]r”hL)r•}r–(hUh}r—(h]h]h]h]h]uhhh8]r˜hHX`Blank line missing before literal block (after the "::")? Interpreted as a definition list item.r™…rš}r›(hUhj•ubah1hPubah1Usystem_messagerœubh )r}rž(hUh}rŸ(h]UlevelKh]h]Usourcehh]h]UlineK6Utypehuhjth8]r hL)r¡}r¢(hUh}r£(h]h]h]h]h]uhjh8]r¤hHX`Blank line missing before literal block (after the "::")? Interpreted as a definition list item.r¥…r¦}r§(hUhj¡ubah1hPubah1jœubeUcurrent_sourcer¨NU decorationr©NUautofootnote_startrªKUnameidsr«}r¬(hhÄhh Advanced topics — Varnish version 3.0.5 documentation

    Advanced topics¶

    This tutorial has covered the basics in Varnish. If you read through it all you should now have the skills to run Varnish.

    Here is a short overview of topics that we haven't covered in the tutorial.

    More VCL¶

    VCL is a bit more complex then what we've covered so far. There are a few more subroutines available and there a few actions that we haven't discussed. For a complete(ish) guide to VCL have a look at the VCL man page - ref:reference-vcl.

    Using In-line C to extend Varnish¶

    You can use in-line 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 I saw of In-line 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
    }

    Edge Side Includes¶

    Varnish can cache create web pages by putting different pages together. These fragments can have individual cache policies. If you have a web site with a list showing the 5 most popular articles on your site, this list can probably be cached as a fragment and included in all the other pages. Used properly it can dramatically increase your hit rate and reduce the load on your servers. ESI looks like this:

    <HTML>
    <BODY>
    The time is: <esi:include src="/cgi-bin/date.cgi"/>
    at this very moment.
    </BODY>
    </HTML>

    ESI is processed in vcl_fetch by setting do_esi to true.:

    sub vcl_fetch {
        if (req.url == "/test.html") {
            set beresp.do_esi = true;  /* Do ESI processing */
        }
    }

    Table Of Contents

    Previous topic

    Misbehaving servers

    Next topic

    Troubleshooting Varnish

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/tutorial/increasing_your_hitrate.html0000644000175000017500000003743212247037213024013 00000000000000 Achieving a high hitrate — Varnish version 3.0.5 documentation

    Achieving a high hitrate¶

    Now that Varnish is up and running, and 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 hit rate 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, I'll guide you through a couple of tools that you will find useful.

    Note that you need a tool to see what HTTP headers fly between you and the web server. On the Varnish server, the easiest is to use varnishlog and varnishtop but sometimes a client-side tool makes sense. Here are the ones I use.

    Tool: varnishtop¶

    You can use varnishtop to identify what URLs are hitting the backend the most. varnishtop -i txurl is an essential command. You can see some other examples of varnishtop usage in Statistics.

    Tool: varnishlog¶

    When you have identified the an URL which is frequently sent to the backend you can use varnishlog to have a look at the request. varnishlog -c -m 'RxURL:^/foo/bar will show you the requests coming from the client (-c) matching /foo/bar.

    For more information on how varnishlog works please see Logging in Varnish or man varnishlog.

    For extended diagnostics headers, see http://www.varnish-cache.org/trac/wiki/VCLExampleHitMissHeader

    Tool: lwp-request¶

    lwp-request is part of The World-Wide Web library for Perl. It's a couple of really basic programs that can execute an HTTP request and give you the result. I mostly use 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. Let me explain what it does. GET usually sends off HTTP 0.9 requests, which lack the Host header. So I 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. Live HTTP Headers can show you what headers are being sent and recieved. 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.

    Please note that when considering 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 so 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:

    Cache-Control¶

    The Cache-Control instructs caches how to handle the content. Varnish cares about the max-age parameter and uses it to calculate the TTL for an object.

    "Cache-Control: nocache" is ignored but if you need this you can easily add support for it.

    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 like this:

    varnishlog -i TxHeader -I ^Age

    Pragma¶

    An HTTP 1.0 server might send "Pragma: nocache". Varnish ignores this header. You could easily add support for this header in VCL.

    In vcl_fetch:

    if (beresp.http.Pragma ~ "nocache") {
       return(hit_for_pass);
    }

    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 than 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_fetch {
        if (req.url ~ "^/legacy_broken_cms/") {
            set beresp.ttl = 5d;
        }
    }

    The 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 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 different, 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";
    }

    Ways of increasing your hitrate even more¶

    The following chapters should give your ways of further increasing your hitrate, especially the chapter on Cookies.

    varnish-3.0.5/doc/sphinx/=build/html/tutorial/purging.html0000644000175000017500000002606612247037213020547 00000000000000 Purging and banning — Varnish version 3.0.5 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, let me explain the HTTP purges.

    HTTP Purges¶

    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 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.request == "PURGE") {
                    if (!client.ip ~ purge) {
                            error 405 "Not allowed.";
                    }
                    return (lookup);
            }
    }
    
    sub vcl_hit {
            if (req.request == "PURGE") {
                    purge;
                    error 200 "Purged.";
            }
    }
    
    sub vcl_miss {
            if (req.request == "PURGE") {
                    purge;
                    error 200 "Purged.";
            }
    }

    As you can see we have used to new VCL subroutines, vcl_hit and vcl_miss. When we call lookup Varnish will try to lookup the object in its cache. It will either hit an object or miss it and so the corresponding subroutine is called. In vcl_hit the object that is stored in cache is available and we can set the TTL. The purge in vcl_miss is necessary to purge all variants in the cases where you hit an object, but miss a particular variant.

    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.request == "BAN") {
                    # Same ACL check as above:
                    if (!client.ip ~ purge) {
                            error 405 "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.
                    error 200 "Ban added";
            }
    }

    This VCL sniplet enables Varnish to handle an 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_fetch {
      set beresp.http.x-url = req.url;
    }
    
    sub vcl_deliver {
      unset resp.http.x-url; # Optional
    }
    
    sub vcl_recv {
      if (req.request == "PURGE") {
        if (client.ip !~ purge) {
          error 401 "Not allowed";
        }
        ban("obj.http.x-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 CLI. This will produce a status of all current bans:

    0xb75096d0 1318329475.377475    10      obj.http.x-url ~ test
    0xb7509610 1318329470.785875    20G     obj.http.x-url ~ test

    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

    Vary

    Next topic

    Compression

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/tutorial/backend_servers.html0000644000175000017500000001333012247037213022222 00000000000000 Backend servers — Varnish version 3.0.5 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 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.

    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 comment in this bit of text and change the port setting from 8080 to 80, making the text look like.:

    backend default {
          .host = "127.0.0.1";
          .port = "80";
    }

    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 80 on localhost (127.0.0.1).

    Varnish can have several backends defined and can you can even join several backends together into clusters of backends for load balancing purposes.

    Now that we have the basic Varnish configuration done, let us start up Varnish on port 8080 so we can do some fundamental testing on it.

    Previous topic

    What is Varnish?

    Next topic

    Starting Varnish

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/tutorial/index.html0000644000175000017500000001727112247037213020201 00000000000000 Using Varnish — Varnish version 3.0.5 documentation

    Using Varnish¶

    This tutorial is intended for system administrators managing Varnish cache. The reader should know how to configure her web- or application server and have basic knowledge of the HTTP protocol. The reader should have Varnish up and running with the default configuration.

    The tutorial is split into short chapters, each chapter taking on a separate topic. Good luck.

    Previous topic

    Upgrading from Varnish 2.1 to 3.0

    Next topic

    What is Varnish?

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/tutorial/esi.html0000644000175000017500000001713012247037213017644 00000000000000 Edge Side Includes — Varnish version 3.0.5 documentation

    Edge Side Includes¶

    Edge Side Includes is a language to include fragments of web pages in other web pages. Think of it as HTML include statement that works over HTTP.

    On most web sites a lot of content is shared between pages. Regenerating this content for every page view is wasteful and ESI tries to address that letting you decide the cache policy for each fragment individually.

    In Varnish we've only implemented a small subset of ESI. As of 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.

    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_fetch {
        if (req.url == "/test.html") {
           set beresp.do_esi = true; /* Do ESI processing               */
           set beresp.ttl = 24 h;    /* Sets the TTL on the HTML above  */
        } elseif (req.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 end ("-->") when the page is processed, while still processing the contents. If the page is not processed, it will remain, becoming an 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" />
    -->

    Table Of Contents

    Previous topic

    Compression

    Next topic

    Platform specific notes

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/tutorial/platformnotes.html0000644000175000017500000001375112247037213021766 00000000000000 Platform specific notes — Varnish version 3.0.5 documentation

    Platform specific notes¶

    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:

    $ echo "never" > /sys/kernel/mm/redhat_transparent_hugepage/enabled

    On Debian/Ubuntu systems running 3.2 kernels the default value is "madvise" and does not need to 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 to much memory per thread, which will make varnish fail as soon as the number of threads (traffic) increases.

    Reduce the maximum stack size by running:

    ulimit -s 256

    in the Varnish startup script.

    Table Of Contents

    Previous topic

    Edge Side Includes

    Next topic

    Using Websockets

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/tutorial/vary.html0000644000175000017500000001617312247037213020053 00000000000000 Vary — Varnish version 3.0.5 documentation

    Vary¶

    The Vary header is sent by the web server to indicate what makes a HTTP object Vary. This makes a lot of sense with headers like Accept-Encoding. When a server issues a "Vary: Accept-Encoding" it tells Varnish that its needs to cache a separate version for every different Accept-Encoding that is coming from the clients. So, if a clients only accepts gzip encoding Varnish won't serve the version of the page encoded with the deflate encoding.

    The problem is that the Accept-Encoding field contains a lot of different encodings. If one browser sends:

    Accept-Encoding: gzip,deflate

    And another one sends:

    Accept-Encoding: deflate,gzip

    Varnish will keep two variants of the page requested due to the different Accept-Encoding headers. Normalizing the accept-encoding header will sure that you have as few variants as possible. The following VCL code will normalize the Accept-Encoding headers:

    if (req.http.Accept-Encoding) {
        if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg)$") {
            # No point in compressing these
            remove req.http.Accept-Encoding;
        } elsif (req.http.Accept-Encoding ~ "gzip") {
            set req.http.Accept-Encoding = "gzip";
        } elsif (req.http.Accept-Encoding ~ "deflate") {
            set req.http.Accept-Encoding = "deflate";
        } else {
            # unknown algorithm
            remove req.http.Accept-Encoding;
        }
    }

    The code sets the Accept-Encoding header from the client to either gzip, deflate with a preference for gzip.

    Vary parse errors¶

    Varnish will return a 503 internal server error page when it fails to parse the Vary server 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. 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.

    Table Of Contents

    Previous topic

    Cookies

    Next topic

    Purging and banning

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/tutorial/devicedetection.html0000644000175000017500000003603112247037213022223 00000000000000 Device detection — Varnish version 3.0.5 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 strategies on what to do with such clients: 1) Redirect them to another URL. 2) Use a different backend for the special clients. 3) Change the backend requests so the usual backend sends tailored content.

    To make the examples easier to understand, it is assumed in this text that all the req.http.X-UA-Device header is present and unique per client class that content is to be served to.

    Setting this header can be as simple as:

    sub vcl_recv {
        if (req.http.User-Agent ~ "(?i)iphone" {
            set req.http.X-UA-Device = "mobile-iphone";
        }
    }

    There are different commercial and free offerings in doing grouping and identifiying clients in further detail than this. For a basic and community based regular expression set, see https://github.com/varnish/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 what client class this is. 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 while still making sure that we only get 1 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 conterintuitive. 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_fetch {
        if (req.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 = req.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 signaling 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 bereq.http.User-Agent = req.http.X-UA-Device; } }
    sub vcl_pass { if (req.http.X-UA-Device) { set bereq.http.User-Agent = req.http.X-UA-Device; } }
    
    # standard Vary handling code from previous examples.
    sub vcl_fetch {
        if (req.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 = req.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.request == "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_fetch {
        if (req.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 = req.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 = 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") {
            error 750 "Moved Temporarily";
        }
    }
    
    sub vcl_error {
        if (obj.status == 750) {
            set obj.http.Location = "http://m.example.com" + req.url;
            set obj.status = 302;
            return(deliver);
        }
    }
    varnish-3.0.5/doc/sphinx/=build/html/tutorial/websockets.html0000644000175000017500000001125012247037213021232 00000000000000 Using Websockets — Varnish version 3.0.5 documentation

    Using Websockets¶

    Websockets is a technology for creating a bidirectional stream-based channel over HTTP.

    To run websockets through Varnish you need to pipe it, and copy the Upgrade header. Use the following VCL config to do so:

    sub vcl_pipe {
         if (req.http.upgrade) {
             set bereq.http.upgrade = req.http.upgrade;
         }
    }
    sub vcl_recv {
         if (req.http.Upgrade ~ "(?i)websocket") {
             return (pipe);
         }
    }

    Previous topic

    Platform specific notes

    Next topic

    Device detection

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/tutorial/logging.html0000644000175000017500000001607112247037213020515 00000000000000 Logging in Varnish — Varnish version 3.0.5 documentation

    Logging in Varnish¶

    One of the really nice features in Varnish is how logging works. Instead of logging to normal log file Varnish logs to a shared memory segment. When the end of the segment is reached we start over, overwriting old data. This is much, much faster then logging to a file and it doesn't require disk space.

    The flip side is that if you forget to have a program actually write the logs to disk they will disappear.

    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 as well, we'll show you these later.

    In the terminal window you started varnish now type varnishlog and press enter.

    You'll see lines like these scrolling slowly by.:

    0 CLI          - Rd ping
    0 CLI          - Wr 200 PONG 1273698726 1.0

    These is the Varnish master process checking up on the caching process to see that everything is OK.

    Now go to the browser and reload the page displaying your web app. You'll see lines like these.:

    11 SessionOpen  c 127.0.0.1 58912 0.0.0.0:8080
    11 ReqStart     c 127.0.0.1 58912 595005213
    11 RxRequest    c GET
    11 RxURL        c /
    11 RxProtocol   c HTTP/1.1
    11 RxHeader     c Host: localhost:8080
    11 RxHeader     c Connection: keep-alive

    The first column is an arbitrary number, it defines the request. Lines with the same number are part of the same HTTP 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. Tags starting with Rx indicate Varnish is recieving data and Tx indicates sending data.

    The third column tell us whether this is is data coming or going to the client (c) or to/from the backend (b). The forth column is the data being logged.

    Now, you can filter quite a bit with varnishlog. The basic option you want to know are:

    -b Only show log lines from traffic going between Varnish and the backend servers. This will be useful when we want to optimize cache hit rates.
    -c Same as -b but for client side traffic.
    -m tag:regex
    Only list transactions where the tag matches a regular expression. If it matches you will get the whole transaction.

    Now that Varnish seem to work OK it's time to put Varnish on port 80 while we tune it.

    Previous topic

    Starting Varnish

    Next topic

    Sizing your cache

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/tutorial/putting_varnish_on_port_80.html0000644000175000017500000001242112247037213024355 00000000000000 Put Varnish on port 80 — Varnish version 3.0.5 documentation

    Put Varnish on port 80¶

    Until now we've been running with Varnish on a high port, for testing purposes. You should test your application and if it works OK we can switch, so Varnish will be running on port 80 and your web server on a high port.

    First we kill off varnishd:

    # pkill varnishd
    

    and stop your web server. Edit the configuration for your web server and make it bind to port 8080 instead of 80. Now open the Varnish default.vcl and change the port of the default backend to 8080.

    Start up your web server and then start varnish:

    # varnishd -f /usr/local/etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1:2000
    

    Note that we've removed the -a option. Now Varnish, as its default setting dictates, will bind to the http port (80). Now everyone accessing your site will be accessing through Varnish.

    Previous topic

    Sizing your cache

    Next topic

    Varnish Configuration Language - VCL

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/tutorial/compression.html0000644000175000017500000001766412247037213021441 00000000000000 Compression — Varnish version 3.0.5 documentation

    Compression¶

    New in Varnish 3.0 was native support for compression, using gzip encoding. Before 3.0, Varnish would never compress objects.

    In Varnish 3.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 for Varnish is to check if the client supports our compression scheme (gzip) and if it does it will override the Accept-Encoding header and set it to "gzip".

    When Varnish then issues a backend request the Accept-Encoding will then only consist of "gzip". If the server responds with gzip'ed content it will be stored in memory in its compressed form. If the backend sends content in clear text it will be stored like that.

    You can make Varnish compress content before storing it in cache in vcl_fetch by setting do_gzip to true, like this:

     sub vcl_fetch {
          if (beresp.http.content-type ~ "text") {
                  set beresp.do_gzip = true;
          }
    }

    Please make sure that you don't try to compress content that is incompressable, like jpgs, gifs and mp3. You'll only waste CPU cycles. You can also uncompress objects before storing it in memory by setting do_gunzip to true but I have no idea why anybody would want to do that.

    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.

    GZIP and ESI¶

    If you are using Edge Side Includes 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.

    Clients that don't support gzip¶

    If the client does not support gzip the Accept-Encoding header is left alone and we'll end up serving whatever we get from the backend server. Remember that the Backend might tell Varnish to Vary on the Accept-Encoding.

    If the client does not support gzip but we've already got a compressed version of the page in memory Varnish will automatically decompress the page while delivering it.

    A random outburst¶

    Poul has written How GZIP, and GZIP+ESI works in Varnish which talks abit more about how the implementation works.

    Table Of Contents

    Previous topic

    Purging and banning

    Next topic

    Edge Side Includes

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/tutorial/vcl.html0000644000175000017500000003135112247037213017651 00000000000000 Varnish Configuration Language - VCL — Varnish version 3.0.5 documentation

    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. Varnish uses a domain specific language called Varnish Configuration Language, or VCL for short. Varnish translates this configuration into binary code which is then executed when requests arrive.

    The VCL files are divided 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.

    Varnish will execute these subroutines of code at different stages of its work. Because it is code it is execute line by line precedence isn't a problem. At some point you call an action in this subroutine and then the execution of the subroutine stops.

    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 default.vcl.

    99% of all the changes you'll need to do will be done in two of these subroutines. vcl_recv and vcl_fetch.

    vcl_recv¶

    vcl_recv (yes, we're skimpy with characters, it's Unix) is called at the beginning of a request, after the complete request has been received and parsed. Its purpose is to decide whether or not to serve the request, how to do it, and, if applicable, which backend to use.

    In vcl_recv you can also alter the request. Typically you can alter the cookies and add and remove request headers.

    Note that in vcl_recv only the request object, req is available.

    vcl_fetch¶

    vcl_fetch is called after a document has been successfully retrieved from the backend. Normal tasks her are to alter the response headers, trigger ESI processing, try alternate backend servers in case the request failed.

    In vcl_fetch you still have the request object, req, available. There is also a backend response, beresp. beresp will contain the HTTP headers from the backend.

    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
    hit_for_pass
    Similar to pass, but accessible from vcl_fetch. Unlike pass, hit_for_pass will create a hitforpass object in the cache. This has the side-effect of caching the decision not to cache. This is to allow would-be uncachable requests to be passed to the backend at the same time. The same logic is not necessary in vcl_recv because this happens before any potential queueing for an object takes place.
    lookup
    When you return lookup from vcl_recv you tell Varnish to deliver content from cache even if the request othervise indicates that the request should be passed. You can't return lookup from vcl_fetch.
    pipe
    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. Beware that with HTTP 1.1 a client can send several requests on the same connection and so you should instruct Varnish to add a "Connection: close" header before actually returning pipe.
    deliver
    Deliver the cached object to the client. Usually returned from vcl_fetch.

    Requests, responses and objects¶

    In VCL, there are three important data structures. The request, coming from the client, the response coming from the backend server and the object, stored in cache.

    In VCL you should know the following structures.

    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.
    beresp
    The backend respons object. It contains the headers of the object comming from the backend. Most of the work you do in vcl_fetch you do on the beresp object.
    obj
    The cached object. Mostly a read only object that resides in memory. obj.ttl is writable, the rest is read only.

    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

    Example 1 - manipulating headers¶

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

    Example 2 - manipulating beresp¶

    Here we override the TTL of a object comming from the backend if it matches certain criteria:

    sub vcl_fetch {
       if (req.url ~ "\.(png|gif|jpg)$") {
         unset beresp.http.set-cookie;
         set beresp.ttl = 1h;
      }
    }

    Example 3 - 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.request == "PURGE") {
        if (client.ip ~ local) {
           return(lookup);
        }
      }
    }
    
    sub vcl_hit {
       if (req.request == "PURGE") {
         set obj.ttl = 0s;
         error 200 "Purged.";
        }
    }
    
    sub vcl_miss {
      if (req.request == "PURGE") {
        error 404 "Not in cache.";
      }
    }
    varnish-3.0.5/doc/sphinx/=build/html/tutorial/advanced_backend_servers.html0000644000175000017500000002241312247037213024051 00000000000000 Advanced Backend configuration — Varnish version 3.0.5 documentation

    Advanced Backend configuration¶

    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 a 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 where to send the difference URL. Lets look at vcl_recv.:

    sub vcl_recv {
        if (req.url ~ "^/java/") {
            set req.backend = java;
        } else {
            set req.backend = 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.User-agent ~ /mobile/) .... should do the trick.

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

    backend server1 {
        .host = "192.168.0.10";
    }
    backend server2{
        .host = "192.168.0.10";
    }

    Now we create the director.:

    director example_director round-robin {
    {
            .backend = server1;
    }
    # server2
    {
            .backend = server2;
    }
    # foo
    }

    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.

    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 lets define the backends.:

    backend server1 {
      .host = "server1.example.com";
      .probe = {
             .url = "/";
             .interval = 5s;
             .timeout = 1 s;
             .window = 5;
             .threshold = 3;
        }
      }
    backend server2 {
       .host = "server2.example.com";
       .probe = {
             .url = "/";
             .interval = 5s;
             .timeout = 1 s;
             .window = 5;
             .threshold = 3;
       }
     }

    Whats new here is the probe. Varnish will check the health of each backend with a probe. The options are

    url
    What URL should varnish request.
    interval
    How often should we poll
    timeout
    What is the timeout of the probe
    window
    Varnish will maintain a sliding window of the results. Here the window has five checks.
    threshold
    How many of the .window last polls must be good for the backend to be declared healthy.
    initial
    How many of the of the probes a good when Varnish starts - defaults to the same amount as the threshold.

    Now we define the director.:

    director example_director round-robin {
          {
                  .backend = server1;
          }
          # server2
          {
                  .backend = server2;
          }
    
          }

    You use this director just as you would use any other director or 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 probes active 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.

    Table Of Contents

    Previous topic

    Device detection

    Next topic

    Misbehaving servers

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/tutorial/troubleshooting.html0000644000175000017500000002247412247037213022322 00000000000000 Troubleshooting Varnish — Varnish version 3.0.5 documentation

    Troubleshooting Varnish¶

    Sometimes Varnish misbehaves. In order for you to understand whats going on there are a couple of places you can check. varnishlog, /var/log/syslog, /var/log/messages are all places where varnish might leave clues of whats going on.

    When Varnish won't start¶

    Sometimes Varnish wont start. There is a plethora of 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 option. It will give you some more information on what is going on. Let us see how Varnish will react to something else 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. 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¶

    When varnish goes bust the child processes crashes. Usually the mother process will manage this by restarting the child process again. Any errors will be logged in syslog. It might look like this:

    Mar  8 13:23:38 smoke varnishd[15670]: Child (15671) not responding to CLI, killing it.
    Mar  8 13:23:43 smoke varnishd[15670]: last message repeated 2 times
    Mar  8 13:23:43 smoke varnishd[15670]: Child (15671) died signal=3
    Mar  8 13:23:43 smoke varnishd[15670]: Child cleanup complete
    Mar  8 13:23:43 smoke varnishd[15670]: child (15697) Started

    Specifically if you see the "Error in munmap" error on Linux you might want to increase the amount of maps available. Linux is limited to a maximum of 64k maps. Setting vm.max_map_count in sysctl.conf will enable you to increase this limit. You can inspect the number of maps your program is consuming by counting the lines in /proc/$PID/maps

    This is a rather odd thing to document here - but hopefully Google will serve you this page if you ever encounter this error.

    Varnish gives me Guru meditation¶

    First find the relevant log entries in varnishlog. That will probably give you a clue. Since varnishlog logs so much 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 -c -m TxStatus:503

    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 option:

    $ varnishlog -d -c -m TxStatus:503

    Please see the varnishlog man page for elaborations on further filtering capabilities and explanation of the various options.

    Varnish doesn't cache¶

    See Achieving a high hitrate.

    Table Of Contents

    Previous topic

    Advanced topics

    Next topic

    The Varnish Reference Manual

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/tutorial/cookies.html0000644000175000017500000001765612247037213020535 00000000000000 Cookies — Varnish version 3.0.5 documentation

    Cookies¶

    Varnish will, in the default configuration, not cache a 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 application 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 don't I suggest you either pick up a book on the subject, read through the pcrepattern man page or read through one of many online guides.

    Let me show you what Varnish Software uses. We use 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 we will discard these unnecessary cookies in VCL.

    In the following VCL we discard all cookies that start with a 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*", "");

    Let me show you an example where we remove everything except the cookies named COOKIE1 and COOKIE2 and you can marvel at 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 == "") {
            remove req.http.Cookie;
        }
    }

    The example is taken from the Varnish Wiki, where you can find other scary examples of what can be done in VCL.

    Cookies coming from the backend¶

    If your backend server sets a cookie using the Set-Cookie header Varnish will not cache the page. A hit-for-pass object (see tutorial_vcl_fetch_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.

    Table Of Contents

    Previous topic

    Achieving a high hitrate

    Next topic

    Vary

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/tutorial/sizing_your_cache.html0000644000175000017500000001276512247037213022601 00000000000000 Sizing your cache — Varnish version 3.0.5 documentation

    Sizing your cache¶

    Picking how much memory you should give Varnish 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 1k per object. So, if you have lots of small objects in your cache the overhead might be significant.

    Previous topic

    Logging in Varnish

    Next topic

    Put Varnish on port 80

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/tutorial/introduction.html0000644000175000017500000001420412247037213021604 00000000000000 What is Varnish? — Varnish version 3.0.5 documentation

    What is Varnish?¶

    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.

    Performance¶

    Varnish performs really, really well. It is usually bound by the speed of the network, effectivly turning performance into a non-issue. We've seen Varnish delivering 20 Gbps on regular off-the-shelf hardware.

    Flexibility¶

    One of the key features of Varnish Cache, in addition to it's performance, is the flexibility of it's 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. You can read more about this in our tutorial.

    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 and OS X.

    Table Of Contents

    Previous topic

    Using Varnish

    Next topic

    Backend servers

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/tutorial/statistics.html0000644000175000017500000001706012247037213021260 00000000000000 Statistics — Varnish version 3.0.5 documentation

    Statistics¶

    Now that your varnish is up and running let's have a look at how it is doing. There are several tools that can help.

    varnishtop¶

    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 rxurl will show you what URLs are being asked for by the client. varnishtop -i txurl will show you what your backend is being asked the most. varnishtop -i RxHeader -I Accept-Encoding will show the most popular Accept-Encoding header the client are sending you.

    varnishhist¶

    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 ("#").

    varnishsizes¶

    Varnishsizes does the same as varnishhist, except it shows the size of the objects and not the time take to complete the request. This gives you a good overview of how big the objects you are serving are.

    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

    Varnish Configuration Language - VCL

    Next topic

    Achieving a high hitrate

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/tutorial/handling_misbehaving_servers.html0000644000175000017500000002207612247037213025002 00000000000000 Misbehaving servers — Varnish version 3.0.5 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 back end. 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 30 minutes beyond their TTL use the following VCL:

    sub vcl_fetch {
      set beresp.grace = 30m;
    }

    Varnish still won't serve the stale objects. In order to enable Varnish to actually serve the stale object we must enable this on the request. Lets us say that we accept serving 15s old object.:

    sub vcl_recv {
      set req.grace = 15s;
    }

    You might wonder why we should keep the objects in the cache for 30 minutes if we are unable to serve them? Well, if you have enabled Health checks you can check if the backend is sick and if it is we can serve the stale content for a bit longer.:

    if (! req.backend.healthy) {
       set req.grace = 5m;
    } else {
       set req.grace = 15s;
    }
    So, to sum up, grace mode solves two problems:
    • it serves stale content to avoid request pile-up.
    • it serves stale content if the backend is not healthy.

    Saint mode¶

    Sometimes servers get flaky. They start throwing out random errors. You can instruct Varnish to try to handle this in a more-than-graceful way - enter Saint mode. Saint mode enables you to discard a certain page from one backend server and either try another server or serve stale content from cache. Lets have a look at how this can be enabled in VCL:

    sub vcl_fetch {
      if (beresp.status == 500) {
        set beresp.saintmode = 10s;
        return(restart);
      }
      set beresp.grace = 5m;
    }

    When we set beresp.saintmode to 10 seconds Varnish will not ask that server for URL for 10 seconds. A blacklist, more or less. Also a restart is performed so if you have other backends capable of serving that content Varnish will try those. When you are out of backends Varnish will serve the content from its stale cache.

    This can really be a life saver.

    Known limitations on grace- and saint mode¶

    If your request fails while it is being fetched you're thrown into vcl_error. vcl_error has access to a rather limited set of data so you can't enable saint mode or grace mode here. This will be addressed in a future release but a work-around available.

    • Declare a backend that is always sick.
    • Set a magic marker in vcl_error
    • Restart the transaction
    • Note the magic marker in vcl_recv and set the backend to the one mentioned
    • Varnish will now serve stale data is any is available

    God mode¶

    Not implemented yet. :-)

    Table Of Contents

    Previous topic

    Advanced Backend configuration

    Next topic

    Advanced topics

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/tutorial/starting_varnish.html0000644000175000017500000001651712247037213022461 00000000000000 Starting Varnish — Varnish version 3.0.5 documentation

    Starting Varnish¶

    I assume varnishd is in your path. You might want to run pkill varnishd to make sure varnishd isn't running. Become root and type:

    # varnishd -f /usr/local/etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1:2000 -a 0.0.0.0:8080

    I added a few options, lets go through them:

    -f /usr/local/etc/varnish/default.vcl
    The -f options specifies what configuration varnishd should use.
    -s malloc,1G
    The -s options chooses the storage type Varnish should use for storing its content. I used the type malloc, which just uses memory for storage. There are other backends as well, described in :ref:tutorial-storage. 1G specifies how much memory should be allocated - one gigabyte.
    -T 127.0.0.1:2000
    Varnish has a built-in text-based administration interface. Activating the interface makes Varnish manageble without stopping it. You can specify what interface the management interface should listen to. Make sure you don't expose the management interface to the world as you can easily gain root access to a system via the Varnish management interface. I recommend tieing it to localhost. If you have users on your system that you don't fully trust, use firewall rules to restrict access to the interface to root only.
    -a 0.0.0.0:8080
    I specify that I want Varnish to listen on port 8080 for incomming HTTP requests. For a production environment you would probably make Varnish listen on port 80, which is the default.

    Now you have Varnish running. Let us make sure that it works properly. Use your browser to go to http://192.168.2.2:8080/ (obviously, you should replace the IP address with one on your own system) - you should now see your web application running there.

    Whether or not the application actually goes faster when run through Varnish depends on a few factors. If you application uses cookies for every session (a lot of PHP and Java applications seem to send a session cookie if it is needed or not) or if it uses authentication chances are Varnish won't do much caching. Ignore that for the moment, we come back to that in Achieving a high hitrate.

    Lets make sure that Varnish really does do something to your web site. To do that we'll take a look at the logs.

    Previous topic

    Backend servers

    Next topic

    Logging in Varnish

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/searchindex.js0000644000175000017500000016321412247037213017173 00000000000000Search.setIndex({objects:{},terms:{entropi:43,waslock:31,saver:9,secondli:9,prefix:[40,47,20,31],sleep:[31,46],vcl_acl:41,oldest:17,effienc:15,whose:[40,15],kqueue:[46,1],"const":[47,11],spew:1,sorri:48,concret:31,swap:46,under:[0,47,34,2,3,36,5,7,39,8,50,41,40,46,60,61,15],sha256:[43,15],worth:[11,1],merchant:40,everi:[0,17,19,43,35,40,26,1,12,44,61],risk:[40,43,46],ugli:31,vastli:5,"void":[0,47,31,11],ptxmcgnnsdxsvdmv:15,affect:[5,54,42,43,40,46],vast:47,school:[25,30,2],tabyt:46,upload:15,string_list:47,session_max:46,quilt:6,xsltproc:10,geekiest:48,direct:[51,23,40,57,15,46],enjoi:[19,56],consequ:40,second:[0,47,34,18,36,51,1,7,25,46,39,58,9,42,6,40,27,59,60,15],vanrishadm:15,libxslt:10,even:[32,47,48,49,2,40,5,58,55,23,29,25,42,26,43,12,59,31,61,46],thunder:9,madvis:54,lookback:19,calcul:[43,30,31,61,15],strictli:8,"new":[27,32,17,5,21,25,42,26,6,40,13,57,46,31,15],net:40,ever:[48,30,14,6],told:11,elimin:[43,46],manipul:[23,40,20,29],nanni:29,noreturn:31,never:[47,29,1,54,58,13,59,31,61,46],accus:48,here:[32,47,49,58,5,1,37,38,23,9,11,40,57,46,14,61,15],herd:9,met:40,debugg:46,path:[35,59,8,46],interpret:[5,46],acceptor:46,dry:6,anymor:27,vclexamplehitmisshead:61,precis:[15,6],loop:[40,31],smoke:14,permit:[40,32,46],vcl_backend_respons:51,c89a:15,portabl:[58,31,11],carl:48,storage_malloc:14,trobl:0,brought:31,unix:[47,23,58,28,31,15],printf:31,"0x80000000":46,txt:25,bugfix:1,unit:[0,40,47,46],highli:59,describ:[35,47,46,39,15],would:[5,11,1,13,23,17,19,35,25,26,27,30,31,43,42,58,57,46,47,59,51,40,48,61],found:[47,53,25,40,59,61,46],ddthh:7,lwp:61,choosen:15,saw:[30,31,38],call:[5,43,9,1,17,21,23,25,27,46,31,32,37,42,58,57,29,47,56,49,55,40,59],telegraph:32,recommend:[0,17,35,54,10,48,61,46],type:[0,47,49,18,19,5,7,37,51,35,24,10,1,40,13,44,46,14,15],tell:[48,18,19,5,43,58,23,55,10,1,12,13,57,59,31,32],vmod_foo:47,autogen:10,relax:[47,30],relat:[43,15],notic:[40,47,14,6],hurt:[46,11],warn:31,warm:50,rip:58,hole:[2,32],hold:[9,21,31,32],must:[47,3,19,25,38,54,9,6,40,27,28,46,57,61,15],worst:[4,58],join:[0,55,32,1],setup:61,work:[6,4,5,1,9,10,11,13,23,17,18,19,20,35,25,28,29,31,32,37,42,58,44,46,47,48,49,52,56,59,61],coalesc:[9,57],erl:[34,3,7,36,41,40,60,46],sbin:10,root:[35,28],overrid:[49,17,23,40,13,61,46],give:[32,47,48,18,29,31,53,42,26,1,40,57,59,14,61,46],txreq:8,indic:[16,47,18,5,46,23,40,42,12,59,51,61,15],want:[0,45,5,10,11,13,14,15,23,18,19,35,31,32,42,43,57,29,47,56,49,51,40,48,61],vmod_std:[0,24,47,40],viceminist:30,attract:25,txrespons:41,end:[0,1,18,11,23,9,6,40,13,44,46,43,15],quot:[40,32,15],polic:6,stone:31,i686:14,how:[45,3,5,6,9,1,13,44,23,17,18,19,21,14,35,26,29,31,43,33,58,57,46,47,56,49,51,53,40,59,61],hot:26,confin:19,answer:[19,59,32,2,43],widespread:[25,31],config:[40,57,10,22,46],connect_timeout:[40,27,51,46],"128k":46,updat:[50,34,19,7,39,8,53,10,36,27,46,60,15],dialect:58,mess:38,chines:30,after:[48,49,34,3,51,36,8,60,23,41,42,40,46,31,32],diagram:2,badli:12,wrong:[49,21,14,10,1,31],unwis:46,cli_req:2,law:30,parallel:[54,8],averag:[36,7,6],rhel6:54,attempt:[40,5,58,50,46],third:[18,25,47,15],cnt_session:46,exclud:[41,36,60,34,3],insuffer:58,perform:[45,17,4,54,9,11,57,59,46],maintain:[57,47],environ:[35,11],max_restart:[40,46],enter:[18,40,9,17,15],exclus:7,ethernet:[48,58],order:[49,17,5,43,58,9,10,42,1,40,28,29,14,61,46],origin:[49,7,36,8,55,61],feedback:[37,46],objhead:[43,41,46],over:[50,3,18,19,7,39,22,40,25,1,36,44,31,46],failur:[8,46],becaus:[48,1,19,6,58,23,25,42,11,59,31,43,46],jpeg:[5,29],flexibl:45,vari:[33,49,17,5,40,12,13,61],digest:[46,43,15],streamlin:32,cli:[2,17,18,19,39,41,46,14,15],fit:[0,40,59,31,46],cld:2,fix:[6,10,61,43,1],better:[1,11,59,30,31,46],persist:[5,46],easier:[59,49,61,6],them:[2,3,5,1,58,9,10,11,57,15,19,35,26,27,30,31,34,37,41,42,43,44,46,47,56,49,40,59,60],gnu99:46,woken:2,thei:[2,11,58,9,6,12,15,17,18,19,26,27,29,30,31,32,34,36,37,41,42,43,46,47,48,56,40,59,60,61],proce:[40,10,29],priv_cal:47,safe:[31,61,42],"break":[40,56,11],band:58,bang:11,promis:[31,43],thaumathurg:47,interrupt:[40,15],yourself:2,rumour:1,choic:11,"0xb7509610":17,arrow:2,each:[33,34,4,19,51,43,7,46,60,40,42,1,36,44,59,57,61,15],debug:[50,14,41,1,46,31,61,15],went:[31,1],side:[33,47,18,20,38,23,13,44,59,61],mean:[47,56,17,19,29,43,25,10,42,1,40,13,57,46,31,15],doddl:6,pdflatex:25,reqstart:[18,41],exactli:[59,15,31,43,1],spider:29,taught:31,resurect:1,network:[49,23,54,40,45,15,46],goe:[1,21,35,11,57,14],god:9,content:[0,45,2,3,5,9,12,13,57,15,16,17,23,46,31,35,39,42,43,44,29,47,49,51,55,40,61],rewrit:[25,46],reader:[33,42],got:[13,31],forth:[23,18,19],outburst:[13,33,56,31,16],cli_auth:15,barrier:[56,2],written:[0,45,3,6,7,8,1,13,15,18,30,31,34,36,39,41,46,50,40,48,60,61],gzipbodi:8,nightmar:59,situat:46,free:[47,49,31,46],standard:[0,49,24,48,31,46],md5:43,precompil:47,haywir:1,openssl:[59,15],filter:[17,18,36,53,15,14,32],soekri:6,ish:[19,46,38,6],iso:[58,31,11],isn:[23,35,46,61,15],iphon:49,regress:[10,8,11],onto:21,scanf:31,user:[33,49,2,3,6,36,53,35,40,61,11,12,57,32,43,46],rang:46,perfectli:[31,61],httpgarbag:41,independ:25,wast:[13,44,59,31,46],rank:[24,53,36,6],restrict:[35,25,15],hook:40,instruct:[5,23,9,10,12,44,14,61,29],alreadi:[32,48,17,5,51,46,6,13,59,14,15],messag:[18,51,42,1,40,14,46],massiv:31,fantast:31,primari:[47,46],xid:[4,40,51],rewritten:[5,36],top:[2,34,53,55,1,40,60,29],speci:46,sometim:[61,9,14,26,6],master:[18,29,46,14,1],too:[32,17,43,10,6,27,59,31,46],similarli:27,lognam:3,critter:15,john:[2,6],listen:[35,46,14,15],murder:6,consol:14,namespac:61,tool:[50,2,20,53,24,25,26,58,56,31,61],clueful:61,wisdom:[30,31],somewhat:[9,47,61,11],conserv:[20,46],technic:[2,11],tex:25,silli:[20,58,31,43],target:47,keyword:[23,27,40,31,61],provid:[47,49,2,5,55,42,1,40,46],tree:[47,59,43,8,46],zero:[5,39,42,48,15,46],project:[25,30,11],matter:[25,58,10,31,43],bca3633d52607f38a107cb5297fd66e5:43,silly:31,frankli:25,"5mm":6,minut:[0,47,9,10,1,40,44,31],expected_respons:40,mini:58,fashion:57,websocket:[33,22],abov:[47,17,5,8,40,10,43,12,44,46,15],modern:[28,45],mind:[47,32],automake1:10,spent:[42,6],raw:[18,40,6],pessimist:11,seed:40,manner:[40,46],seen:[45,36,37,31,25,42,43,49,30,14],seem:[18,35,25,57],incompat:[31,58],seek:46,minu:59,recreat:46,latter:47,objrequest:41,sound:1,transmit:46,thoroughli:40,vrt_magic_string_end:47,expens:[47,26,46],simplifi:[40,27],crippl:31,plenti:[12,46],though:[6,15,1],"0x4196af":1,lastus:40,object:[2,4,5,9,12,13,15,17,20,23,24,26,46,31,43,44,29,49,51,53,40,60,61],legibl:40,supress:48,regular:[47,45,34,3,18,20,36,23,24,25,41,42,11,40,49,60,15],letter:31,bsd:58,objstatu:41,tradit:46,"0x00000001":46,don:[0,35,47,48,49,33,20,23,10,43,40,13,32,30,31,61,46],"0x00000004":46,vcl_fetch:[49,17,5,21,8,23,9,38,27,40,13,44,61,29],doc:25,"0x00000008":46,flow:32,spend:[13,32,1],declar:[47,19,24,9,40,57],fishi:0,wildcard:19,gzip_stack_buff:[27,46],left:[2,34,7,53,25,40,13,60],scream:0,came:[30,58],thread_pool_min:46,othervis:23,pragma:61,pope:48,opposit:43,probe:[40,19,57,24],"_noreturn":31,syntax:[19,5,39,24,10,40,27,46,15],pipe_timeout:46,advisori:43,directli:[40,20,51,43],radio:48,pkg:10,admin_network:40,radic:25,protocol:[33,3,51,46,40,48,31,29],priv:47,involv:49,absolut:[47,37,61,46],submit:40,menu:25,explain:[47,17,5,21,61,58,43,32],configur:[35,45,33,40,19,20,21,55,46,23,24,52,10,42,58,29,57,59,61,15],apach:[24,3],bust:14,busi:[40,51,17,6],rick:61,"0x42bce1":1,thread_pool_purge_delai:46,steel:31,txurl:[41,61,53],nasti:[47,1],watch:[61,26,6],report:[21,1,5,6,7,8,11,48],txresp:8,transpir:[31,58],bar:[47,8,43,40,31,61],ietf:61,shape:[31,6],patch:[11,6],reload:[18,46],bad:[17,1,6,46,31,32],"sm\u00f8rgrav":[34,3,7,36,41,40,60,46],ban:[33,49,17,21,24,40,27,15,61,46],metadata:[61,17],respond:[13,14],gzip_tmp_spac:[27,46],pummel:19,hasn:46,roadmap:44,nul:[40,47],num:41,mandatori:[50,11],result:[47,34,36,5,58,7,37,39,40,41,42,11,29,57,46,60,61,15],respons:[47,45,2,3,29,23,40,49,46,51,61,15],fail:[0,49,40,25,8,23,54,9,10,42,12,46],hash:[34,17,21,53,24,43,40,27,56,60,46],so_sndtimeo:46,best:[45,19,8,25,10,59,31,46],subject:[40,20,29,51,32],awar:[17,46,61,26,1],said:[28,6],hopefulli:[5,14,6],databas:47,field_list:7,arcana:43,figur:[30,58,10,49,1],"0x00004000":46,awai:[3,41,42,43,59,46],irc:[32,21,14,1],approach:[19,37],accord:[40,29,43,31,6],men:31,extend:[6,61,38,3],preprocessor:31,extent:40,statsess:41,toler:[56,11],setsockopt:46,protect:25,sydnei:31,howev:[40,20,43],against:[2,17,23,40,15,46],do_stream:[40,51],uncertainti:11,varnishstat:[34,3,36,7,8,53,24,41,26,1,29,60,46],fileformat:25,con:15,compromis:2,host_head:40,"16k":46,foobar:[5,47],"16g":26,exemplari:40,shortcut:[19,46],diff:25,guid:[16,20,61,38],assum:[49,2,17,5,35,58,59,46],nake:37,reciev:[18,61],liabil:40,tinu:15,divers:58,three:[47,2,17,4,23,1,40,44],been:[32,2,51,37,23,52,40,27,15,30,31,61,46],accumul:[46,2,17],trigger:[23,1],dlopen:46,interest:[20,1,23,25,10,11,61,32],subscrib:[25,2,32],futur:[51,9,11,40,32,46],vcl_deliv:[40,47,49,51,17],http_req:2,life:[11,9,6,1],sircul:15,spit:43,dismiss:19,worker:[47,17,29,1,42,6,46,14,15],telnet:[25,48,15],argument:[47,49,3,58,39,10,42,1,40,27,31,15],vcc_err_unref:[27,46],implict:46,craft:49,cli_buff:[46,15],child:[2,29,1,59,15,14,46],spin:1,subroutin:[23,24,40,38,17],ident:[19,51,1,7,43,40,57,46],aix:[58,11],prefer_ipv6:46,servic:[0,48,2,51,1,40,46,15],zlib:59,commerci:[21,49,32],fetch_maxchunks:[27,46],neat:[31,42],alloc_seq:42,occat:32,printabl:27,tabl:[16,46],sting:47,conf:14,tediou:58,"0x43ef68":1,thread_pool_stack:46,sever:[0,20,55,53,23,9,6,40,57,15],grown:31,http_max_hdr:[27,46],suggest:[16,20,32,6],make:[6,2,5,1,9,10,11,12,13,15,16,20,35,25,26,27,29,30,31,32,37,42,43,46,47,49,52,53,54,55,40,59,61],format:[48,3,4,5,7,51,24,25,40,29,46,31,15],spectacular:32,complex:[59,38,32],split:[33,46,1],vmod_dir:[27,46],complet:[20,38,53,23,40,59,15,14,46],raid:30,hang:[32,1],hand:[6,37,58,40,31,29],fairli:28,afraid:11,portal:26,tune:[18,5,56,53],kid:59,kept:[17,8,26,40,61,46],scenario:19,thu:[17,15],itself:[0,49,50,34,3,36,7,39,8,41,40,46,60,61,15],inherit:2,client:[3,5,7,8,9,1,12,13,17,18,20,23,24,46,33,34,36,41,29,49,51,53,40,60,61],cooloff:46,thi:[0,45,2,3,5,1,7,8,9,10,11,12,13,14,15,17,18,19,20,21,23,58,25,27,29,31,32,33,34,36,39,38,40,41,42,43,44,46,47,48,49,50,51,53,54,55,57,59,60,61],mother:14,gzip:[33,4,5,8,24,40,6,12,13,56,51,46],programm:[25,31],everyth:[47,49,18,5,21,14,53,10,11,59,20],unchang:5,identifi:[40,19,31,61],just:[2,11,6,12,14,23,19,20,35,27,46,30,31,43,32,42,58,57,29,47,49,53,40,48,61],bandwidth:5,via:[35,32,61,17],victim:6,unbuff:41,yet:[47,9,59,31,1],languag:[33,47,45,37,8,23,24,58,40,44,29,31,46],previous:27,"0x00000010":46,easi:[61,31,2,1],elm:31,royal:25,must_reload:46,"0x00010000":46,els:[21,49,5,1,8,40,9,11,12,57,59,14,43],save:[40,5,51],explanatori:31,transit:46,gave:58,applic:[35,45,33,20,52,23,40,9,12,13,57,61],log_hashstr:[27,46],ktrace:1,background:17,elabor:14,dreamt:59,lck:7,measur:[36,46],daemon:[24,46,41,3],rxrequest:[18,41],specif:[33,47,3,19,58,8,31,23,54,11,40,29,14,61,15],arbitrari:[18,40,57],manual:[0,16,47,50,34,3,36,21,7,39,8,24,41,1,40,46,60,15],graviti:31,remind:32,plattform:28,hung:1,unnecessari:[5,20],el5:10,www:[40,44,10,61,15],right:[47,1,6,7,58,25,11,40,43,46],old:[34,17,18,19,3,36,31,9,41,14,61,60],deal:[19,46,9,40,59,32],hit_for_pass:[23,27,21,40,61],interv:[40,57,47,46],crown:58,somehow:19,dead:2,intern:[12,40,49,46],varnishd:[0,3,7,8,52,10,1,13,14,15,19,35,24,27,46,34,36,39,41,42,29,50,51,53,40,60],indirect:40,successfulli:[23,40,31],total:[27,25,46,2,6],cooper:[34,3,7,36,8,41,40,46],vcl_hash:[40,49,43],bottom:25,establish:39,fpic:46,haxlw:1,multipli:37,healthcheck:40,fol:46,condit:[40,5,15,46,1],foo:[0,47,39,8,14,43,40,57,31,61,15],localhost:[35,17,18,39,23,55,40,15,46],core:[0,59,46,1],plu:[59,46],sensibl:[5,6,58,11,13,31,32],uncompress:[13,5,46],burn:59,st_dev:42,unreason:19,repositori:[10,8],post:[40,32],chapter:[33,61,46],obj:[49,17,51,21,23,40,27,15],smalloc:14,unfortun:[20,10,31],personel:2,commit:19,produc:[47,17,5,25,58,40,46],match:[34,17,18,19,3,36,60,23,41,43,40,46,32,61,15],net5501:6,"float":47,contriv:47,bound:[13,46,45,14,11],verbiag:31,down:[23,40,57,15,14,61,46],resili:57,nuke_limit:46,wrap:[25,31],opportun:30,storag:[47,5,53,35,24,42,26,43,40,13,46,51,15],often:[47,2,1,43,40,57,46],somedict:43,git:[10,6],crowd:1,wai:[32,47,48,1,2,17,49,19,6,39,38,9,42,61,11,40,58,59,31,43,46],boutiqu:47,transform:[49,6],happi:[13,6],avail:[3,7,8,9,10,11,14,15,17,23,34,36,38,41,42,44,46,47,49,50,51,40,60],gif:[23,12,13],reli:[40,61,11],editor:[25,55,6],overhead:[40,26,46],clockskew:46,lowest:37,head:[40,51,61,46],amateur:31,form:[40,13,48,50,1],offer:[32,49,31,46],forc:[17,19,5,40,51,61,46],hitrat:[35,33,14,61],vcl_all:51,percentag:46,heap:17,renam:[27,21],"true":[27,17,5,37,8,10,38,1,40,13,44,51],mymod:47,reset:5,rxlosthead:41,full:[47,59,40,44,48,46],mebibyt:46,vcl_init:40,maximum:[19,5,31,54,40,15,14,46],until:[47,17,19,11,37,52,43,40,48,31,46],strace:[14,1],ncurs:10,fundament:[19,55],autoconf:10,emit:[4,40,46,15],nnn:15,classif:49,esi_syntax:46,openbsd:[28,45,11],semicolon:40,classic:46,diagnost:[61,46],workerthread:46,exist:[49,3,51,37,46,42,58,40,59,15],trip:1,shit:6,assembl:31,when:[2,3,5,7,8,9,1,12,13,14,15,23,17,18,19,20,35,27,29,31,34,36,40,41,42,58,44,46,47,48,49,51,53,55,57,59,60,61],actor:2,fs2:40,role:[40,61,2],test:[50,17,4,58,5,6,55,8,24,52,10,38,11,40,44,29,28,15],tie:35,presum:31,unlimit:46,epel6:10,http_header:27,intend:[40,33,1],"128kb":46,why:[47,48,2,56,5,25,31,9,43,13,59,30,14,32],asterisk:15,fell:[31,2],intent:11,consid:[0,47,3,26,40,61,15],src:[44,38,8],outdat:17,younger:40,receiv:[3,5,23,40,41,29,46,51,15],longer:[17,39,9,27,15,31,46],furthermor:43,anywher:59,exce:12,ignor:[34,3,5,36,60,35,41,40,27,46,51,61,15],distro:11,time:[6,3,4,5,1,7,8,10,11,14,15,17,18,19,23,24,58,28,29,30,31,32,36,37,38,42,43,44,46,47,48,50,51,53,40,59,61],push:[46,42,43,15],serious:[38,11],backward:31,concept:[55,43,42,6],cli_timeout:46,snif:58,whoever:31,skip:[40,5,41,10],global:[40,47,46],focus:32,invent:31,shellscript:58,signific:[26,15],netbsd:[28,45,11],millisecond:46,varnish:[0,6,2,3,5,1,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36,39,38,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61],middl:6,depend:[45,21,35,25,10,1,40,49,29,61,46],graph:53,readabl:[25,47,51,11],"_that_":2,rel:[47,37,42,46],default_ttl:[40,46],certainli:[47,11,31,1],vec:5,addon:61,sourc:[32,47,58,29,21,46,55,8,53,25,10,11,40,59,31,15],string:[0,47,48,49,3,5,21,37,51,43,40,27,46,31,15],"3am":2,spate:43,revalid:61,varnishncsa:[34,3,36,7,8,24,41,42,29,60,46],lru:[26,46],word:[40,25,21,31,15],brows:31,cool:[42,2],"0x00000020":46,valuabl:1,administr:[35,33,30,2],level:[47,5,1,25,11,40,51,46],did:[56,2,5,11,58,40,27,48,31],khtml:49,iter:[40,8],item:[40,27,46,15],ccf_panic:1,cooki:[0,35,33,20,43,23,1,40,44,61,15],round:[40,24,57,46],prevent:[40,19,31,17],brave:10,slower:43,peek:25,trend:6,sign:[2,46],cost:[48,30],gzipe:5,unprotect:2,port:[33,48,49,50,18,19,39,35,52,10,40,57,46,55,14,15],comparis:15,appear:[40,46,15],cecili:[39,50],filler:31,repli:[40,51,30,39,46],"64bit":54,current:[0,17,51,3,41,1,40,59,31,46],wors:31,rephras:1,gener:[0,32,1,2,58,6,7,37,38,31,40,26,11,12,13,46,14,43,15],satisfi:[46,10,11],slow:[0,46],modif:40,address:[35,48,49,50,19,51,36,39,23,9,40,44,46,14,15],along:[0,47,17,6,12,61,46],wait:[2,34,51,7,39,9,1,40,60,46],box:[49,1],buck:11,insan:59,errorhandl:1,txrequest:41,queue:[23,9,46],behav:[29,58],dusti:19,weird:[40,37,11],commonli:[36,53],ourselv:11,love:[47,31,11],humour:61,extra:49,activ:[18,19,5,1,35,26,11,40,44,46,57,15],modul:[0,24,47,2,46],prefer:[3,19,40,43,12,46],marker:[9,47],instal:[16,45,21,55,10,28],smallish:43,mobil:[57,49],regex:[34,17,18,3,36,41,40,60],memori:[0,2,3,4,13,14,23,18,35,24,26,34,36,39,41,42,43,46,47,51,53,54,40,60],subvert:2,bewar:23,franca:25,perl:[40,61],everybodi:[32,1],live:[17,51,11,25,58,40,46,61,32],handler:40,"417a":48,kristian:[40,60,8],tape:48,angri:31,checkout:10,reorder:49,twitterif:17,afford:43,peopl:[1,17,19,6,61,11,27,48,31,43,32],clue:[14,32],suckag:[48,56],drown:32,prototyp:[0,47],examin:[40,5,42,1],effort:[59,31,11],easiest:61,religi:48,graphic:25,prepar:40,uniqu:[40,51,49,31,1],cat:15,descriptor:[47,46,1],hardest:47,whatev:[47,17,42,1,13,61],purpos:[17,52,37,23,55,40,61,46],preclud:25,heart:10,collaps:0,sourcefil:15,stream:[5,49,22],predict:43,slightli:5,"1980i":29,backslash:[40,15],agent:[33,49,3,36,53,12,57,61],topic:[33,48,38,32],heard:11,abort:59,"14b":1,hash_always_miss:[40,51,17],recycl:43,simul:[29,8,1],occur:[27,36,53],alwai:[47,2,3,5,11,51,8,9,1,40,46,31,43,15],multipl:[34,3,19,24,41,42,40,60,46],oslo:6,charset:40,ping:[18,46,15],write:[47,45,2,3,18,19,17,46,8,25,41,42,11,40,58,59,30,31,15],purg:[33,49,17,21,23,40,27,61,46],actual:[35,21,32,2,17,18,29,1,39,58,23,9,26,6,40,46,31,61,15],fourth:25,xhtml:40,parameter:39,map:[49,57,30,14],product:[35,9,25,46],ban_lurker_sleep:[27,46,17],max:[4,14,61,46],clone:10,timedout:31,spot:[25,31,2,32],usabl:[19,31,1],intrus:[32,11],mac:[48,11],mad:58,mai:[32,47,48,49,3,29,1,37,10,56,11,40,59,31,43,46],client_drop:7,suck:25,data:[61,47,2,24,4,1,37,31,23,18,9,42,26,6,40,57,59,14,43,46],grow:59,man:[20,38,27,40,13,14,61,15],ssm:[8,46],stress:31,autotool:10,practic:[5,25,2,31],"0x00001000":46,disabigu:19,stdin:[39,46],favorit:55,inform:[56,19,1,36,53,10,43,40,57,32,14,61,46],"switch":[19,52,23,25,40,46],wrt54g:11,combin:[24,41,3],block:[4,40,7,14],anoth:[47,48,49,2,17,19,5,58,23,40,9,43,12,29,31,46],talk:[47,19,51,25,40,13,48,15],shield:9,virtualis:54,vtailq_insert_befor:31,divid:[23,40,37],ttl:[0,17,4,51,8,23,24,9,41,40,27,44,61,46],clock_skew:46,still:[0,49,17,1,58,23,9,61,6,44,14,43],pointer:[19,47,31,24],dynam:[40,42],futil:1,vtc:[10,8],group:[49,3,36,41,40,57,48,31,46],thank:[45,11],polici:[45,19,38,40,44,32],norwai:25,unambiti:31,instantli:[19,47],platform:[33,45,54,25,11,56,14],window:[18,40,57,46],curli:40,mail:[21,32],main:[40,32,7,1],do_gzip:[40,13,5,51],non:[47,45,58,39,25,11,40,27,46,15],synopsi:[0,50,34,3,36,7,39,8,24,41,60,46],set_health:15,smarter:[25,49],objprotocol:41,sooner:43,safari:49,half:[25,46],now:[5,6,9,10,11,44,23,18,19,21,14,35,25,27,31,43,37,38,58,57,47,48,51,52,53,55,40,59,61],discuss:38,nor:[34,36,60,41,40,31,46],wont:14,wagon:58,term:[29,43,61,11],name:[47,34,3,19,20,21,7,39,8,60,23,40,41,43,36,27,46,51,15],realist:43,opera:31,perspect:49,didn:[5,48,31],revert:40,crypto:59,separ:[33,47,2,7,40,12,59,46],pcrepattern:20,careless:48,between_bytes_timeout:[40,51,46],polit:2,compil:[47,2,21,10,58,40,27,29,31,46],domain:[23,40,2],replai:[24,50],idioci:31,replac:[21,35,58,40,27,48,46],individu:[44,47,38,15],yeah:48,vcl_trace:[46,41,1],contributor:[40,45,11],redistribut:40,significantli:[59,58],year:[25,31,6],happen:[2,17,5,1,38,23,25,42,6,32,14,46],subnet:40,shown:47,space:[18,46,48,26,15],repetoir:37,storage_fil:46,priviledg:2,rational:61,internet:[48,2],ironi:[6,1],correct:31,earlier:41,monster:31,migrat:19,xhtml1:40,million:6,libpcre3:10,theori:[40,5,43],ebcdic:29,org:[8,53,25,10,6,40,32,61,46],"byte":[3,4,5,46,60,23,40,43,29,59,51,15],rfc1884:48,vcc_if:47,care:[47,56,11,10,43,57,48,61,29],reusabl:40,befor:[32,47,48,49,17,40,5,58,51,23,54,10,42,1,29,13,28,46,31,15],waiter:46,"10mb":15,synchron:46,do_esi:[5,21,38,8,40,27,44,51],thing:[47,2,19,5,1,58,14,31,26,6,13,57,59,20,46],place:[47,17,1,23,9,43,48,14,32],router:[23,40],principl:30,think:[48,49,2,17,19,29,1,58,25,56,6,57,44,59,30,31,43,46],frequent:[36,61],first:[3,4,5,6,9,1,14,15,17,18,25,26,30,31,32,36,38,41,43,57,46,47,48,51,52,55,40,59,61],oper:[56,2,21,37,58,39,23,40,10,42,1,12,27,46,15],redhat:[54,21,10],carri:[61,59,26,2],onc:[16,19,36,10,1,40,27],arrai:43,wedg:1,reopen:[41,3],fetcher:46,"long":[0,32,17,19,43,8,42,11,40,46,31,61,15],open:[32,47,19,1,55,52,10,42,11,46,14,15],predefin:49,size:[33,49,17,3,31,54,24,53,60,26,6,40,46,14,43,15],given:[3,19,37,8,39,46,15],sheet:59,teenag:6,mailman:32,autocrap:[56,58],paramt:46,cassett:48,demonstr:40,white:40,conveni:[47,32],get_lock_befor:31,amonst:46,especi:61,copi:[49,5,58,22,40,9,41,43,12,32,46],circumst:2,specifi:[47,50,34,3,36,51,7,39,8,60,35,41,26,40,46,31,15],blacklist:9,effectivli:45,"short":[23,33,14,38,46],enclos:[40,46,15],ipng:48,mostli:[23,40,32,61,46],quad:46,grunt:30,than:[2,3,5,6,9,10,1,13,15,17,19,21,25,31,32,37,39,41,58,46,59,49,40,48,61],png:[23,12,5,17],serv:[0,45,17,29,49,53,23,40,9,26,12,13,57,32,14,15],wide:61,sess_workspac:46,temporarili:49,posix:[31,58],balanc:[51,55,43,40,59,29],were:[47,50,34,36,39,60,41,58,56,30,31],posit:31,surrog:61,browser:[18,5,35,25,12,29],pre:46,fork:2,sai:[2,5,1,23,9,11,57,48,31,43],gottcha:37,nicer:31,ani:[45,2,3,5,1,9,11,12,14,15,17,19,23,27,46,31,32,36,43,57,29,47,49,51,53,40],danger:31,ant:49,devicedetect:49,"20g":17,deliv:[27,45,17,4,5,6,49,23,11,40,13,29,51,46],nazi:19,engin:[40,59,49],squar:[46,6],destroi:[31,46],note:[0,33,5,52,38,23,54,9,10,40,13,57,46,30,61,15],schmocument:25,"_end":1,take:[0,35,11,33,1,47,46,53,23,25,10,42,6,40,27,59,31,61,15],advis:40,noth:[19,47,32,46],channel:[21,22,2,32],begin:[58,23,43,40,57,31,46],sure:[47,49,2,54,40,19,5,1,35,29,42,11,12,13,57,32,61,15],importantli:43,trace:[40,15,46,1],normal:[49,34,3,18,5,36,37,23,40,41,6,12,60,61],track:[37,20,14,32],reqend:41,knew:[31,58],compress:[33,4,5,43,6,12,13,51,46],clearer:27,varnishadm:[24,46,39,15],varnishs:[24,60,53],micro:58,america:32,homepag:6,gunzip:[4,5,8,46],latex:25,synonym:40,pcre_match_limit_recurs:46,later:[47,50,18,58,36,10,43,40,46,31,32],sale:32,"0x4193f6":1,varnishtest:[24,8,29],runtim:[27,47,21,46],bumbl:6,patchlevel:12,shop:32,backendreus:41,show:[49,34,18,58,20,1,39,8,53,40,25,41,38,6,29,46,60,61,15],cheap:26,merit:42,n900:11,concurr:40,permiss:[14,15],hack:10,threshold:[40,57,46],corner:[60,34,2,53],tend:1,fifth:25,help:[0,32,2,17,21,37,8,39,53,42,1,46,14,15],xml:[40,44,29,7,46],onli:[2,3,4,5,6,8,1,12,13,14,15,23,17,18,19,35,25,26,27,29,31,32,34,36,39,41,42,58,44,46,47,48,49,50,51,40,59,60,61],explicitli:[40,46],ratio:[46,17],fenc:59,transact:[34,4,8,18,9,41,1,40,14,29],proportion:40,get_lock_tim:31,carrag:15,wood:6,analyz:20,enthusiasm:11,analyt:20,analys:30,overwritten:[41,60,34,3],variou:[50,2,5,40,15,30,14,61,46],get:[6,2,3,5,1,7,58,9,10,11,13,14,15,17,18,19,20,21,23,29,31,32,34,36,41,42,43,57,45,46,47,48,49,51,55,40,59,60,61],stomp:42,auto_restart:46,repo:10,ssl:[59,56],tailor:[49,37],ssh:[48,39,2,42],master_pid:42,requir:[17,18,43,40,46,15,32],truli:19,seldom:17,dramat:38,sidewai:30,stupid:[19,2],draft:31,where:[45,3,11,1,14,15,17,18,19,20,21,23,25,27,30,31,34,36,41,42,58,57,46,47,49,55,40,59,60],summari:[39,6],wiki:[20,32,25,61,15],kernel:[54,59,42,46,1],aquaeduct:31,shm_reclen:46,seal:46,wonder:[9,43,30,6],detect:[33,58,49,42,46],behind:[32,49,61,11],between:[0,47,34,2,18,19,5,7,39,51,60,40,44,29,31,61,46],"import":[0,47,56,2,19,1,37,23,6,40,27,59,31,61],across:[40,27],example_director:57,parent:46,screen:49,style:[29,15],cycl:[13,59],jobb:61,come:[35,47,18,20,1,31,23,40,61,6,12,57,48,14,43],"0x00000040":46,quiet:[32,8,11],contract:40,retir:19,audienc:0,tutori:[35,16,45,38,33],"80013339a":1,mani:[4,20,43,46,39,8,42,11,40,51,57,59,31,15],clf:3,evict:[26,17],among:40,acceler:[16,45,24,55,40,15,61,46],overview:[38,53],period:[7,51,36,42,40,46],exploit:2,featur:[45,18,19,9,6,31],colon:48,toupper:[0,24,47],typic:[45,5,23,40,10,43,29,46,32],karstensen:7,poll:[40,19,57,31,53],damag:[40,48],libvarnish:15,hexdump:15,coupl:[37,49,14,61,32],harmless:48,stretch:37,fritzvold:[39,50],mark:[0,34,17,51,53,6,40,57,46,60,15],varnish_nam:[34,3,7,36,41,60],listen_address:46,addit:[40,19,45,31],hitpass:41,avian:25,repons:[29,46,15],identifii:49,"80013822c":1,thousand:[9,1],drawer:48,workspac:[47,46,1],those:[47,45,19,20,9,11,59,31,32],"4d45b9544077921575c3c5a2a14c779bff6c4830d1fbafe4bd7e03e5dd93ca05":43,myself:[40,2],hdr:8,ungzip:5,tinderbox:11,expban:41,trick:[49,2,57,48,31,32],admin:[20,56,2,15],invok:[17,15],outcom:40,cannot:[47,2,5,25,43,59,31],invoc:58,margin:[59,2],advantag:46,stdout:[7,39,46],canon:59,worri:[48,10,6],cluster:[40,55],pthread:[31,46],ascii:[48,2,29],fame:43,develop:[34,3,36,7,8,60,41,6,40,32,31,46],author:[0,34,2,3,36,7,39,8,50,41,40,46,60,61,15],same:[0,2,3,5,7,8,9,11,12,15,17,18,19,23,34,36,39,41,42,43,57,46,49,50,53,40,48,60,61],check:[32,47,2,17,18,33,37,9,10,42,58,40,13,57,46,14,61,15],binari:[23,40,25,10],epoch:[40,47,51],html:[49,5,6,38,25,43,40,44,29],pad:1,sentenc:32,pai:[27,32,6],document:[0,3,7,8,10,11,14,15,16,21,23,25,34,36,39,41,46,47,50,53,40,60],medit:[40,14],vmod_tolow:47,week:[0,6],finish:[46,39,6],webserv:[48,29,61,6],rxresp:8,assist:30,driver:2,ness:5,decompress:13,director:[40,24,57,51,33],capabl:[25,5,9,14],improv:31,immedi:[46,32,15],defi:31,vtailq_next:31,appropri:[40,44,61],patchwork:6,macro:[31,8,58],page:[0,3,7,8,9,12,13,14,15,16,17,18,20,25,26,31,32,34,36,39,38,41,44,46,49,50,40,60,61],without:[56,3,17,5,1,51,39,58,35,19,10,11,40,32,30,31,43,15],alexa:6,model:2,roughli:1,affair:30,execut:[23,19,46,61,1],resp:[47,49,17,51,8,40],rest:[23,10],bitmap:[31,46],kill:[52,14,2,1],aspect:[40,59,31],monei:43,stevedor:6,listelm:31,speed:[46,45,1],http_resp_hdr_len:[27,46],ixslvvxrgkjptxmcgnnsdxsvdmvfympg:15,gibibyt:46,europ:32,struct:[47,43],mmap:46,korken:61,except:[17,20,53,23,40,48,46],param:[47,15,39,46,1],identif:[40,51,43],pile:[46,9,6,40,59,32],session_ling:46,real:[0,47,1,37,11,29,31,32],around:[1,6,9,11,48,30,43,46],libm:58,read:[0,16,45,34,2,3,5,36,39,38,53,23,60,25,41,10,42,1,40,20,15],arriv:[23,15,43,3],esi_level:[40,5,51],traffic:[1,50,2,54,18,20,21,24,6,40,57,29,46],mon:47,loos:43,world:[35,59,31,61,32],unsign:43,dare:58,tolow:[0,24,47],whitespac:46,vcl_dir:[27,46],pole:32,integ:[0,24,47,43,15],server:[45,2,8,9,6,12,13,15,16,18,20,23,25,29,32,33,34,36,38,41,43,57,46,50,51,52,55,40,60,61],benefit:[30,11],shmfile:14,either:[47,17,19,5,58,25,31,23,40,9,39,1,12,28,20,61,46],output:[47,49,3,4,19,5,43,7,25,41,1,44,46,15],manag:[33,47,2,17,29,39,35,24,10,1,40,57,46,14,15],yyyi:7,"0x8006b4307":1,thermodynam:43,handshak:59,authent:[35,24,40,39,15],respect:[27,5,42,15],inlin:[40,27,47,46,15],basic:[33,49,18,19,38,23,55,11,40,31,61],"3f8":1,shmlog:[42,46],easili:[35,61],definit:[40,19,8],token:15,legal:11,moon:30,exit:[2,34,3,36,7,39,24,41,40,60,46],expiry_sleep:[27,46],complic:[5,20],overli:20,ntpd:31,refer:[16,17,4,3,8,24,25,38,40,27,46,15],needlessli:46,immun:43,timeout:[57,40,39,31,46],power:[48,17],garbag:31,inspect:[47,17,40,48,14,15],"0x8006b8d84":1,sess:[47,7],broken:[40,15],fulli:[35,43],regexp:[47,15],getnameinfo:48,"throw":[19,9,59,43,17],comparison:[23,40,46,37,15],deflat:[4,12,5],central:[25,2],"0x8006b8b76":1,acl:[23,24,40,17],objlosthead:41,stand:[25,59],act:[34,20,36,41,11,40,60],luck:33,processor:[44,58],xnn:15,routin:1,pipe_if_loc:40,effici:[13,5,42,19],surviv:46,your:[45,11,58,9,10,1,12,13,14,15,16,17,18,19,20,21,23,25,26,27,29,30,31,32,33,35,38,43,57,46,47,49,52,53,54,55,40,61],stare:43,"14f0553caa5c796650ec82256e3f111ae2f20020a4b9029f135a01610932054":43,log:[0,2,3,4,6,7,8,1,12,14,23,18,21,35,24,25,27,29,32,33,34,36,38,41,42,46,50,53,40,60,61],her:[23,33],area:26,hex:15,overwrit:[18,41,42,3],start:[2,3,6,7,8,9,10,1,14,15,16,18,20,35,29,33,34,36,40,41,42,44,46,52,54,55,57,59,60],compliant:11,mindless:[25,2],interfac:[47,17,39,35,24,58,15,46],low:[27,43,2,46],lot:[35,17,5,1,37,31,23,40,53,10,61,26,11,12,44,48,57,20,43,46],ipv6:[40,19,48,56,46],hen:[2,3,6,7,8,59,11,16,19,25,30,31,43,34,36,37,41,58,46,56,40,48],machin:[19,48,14],unam:58,hard:[11,47,43,58,14,46],relic:58,verbatim:3,enough:[47,19,1,43,31,46],sighup:[41,3],amongst:[40,31,58],client_conn:7,opensolari:11,cryptograph:43,http_range_support:46,conclus:19,faster:[16,18,35,42,46,32],notat:[19,46],rush:46,fraud:6,possibl:[1,2,40,19,5,6,58,29,54,42,11,12,49,46,30,32,43,15],"default":[3,5,7,52,10,13,14,23,20,21,35,27,33,34,36,43,57,46,47,49,51,54,55,40,60,61],bucket:46,unusu:37,monopoli:2,deadlock:[40,51],expect:[11,8,25,42,43,40,61],gone:[27,17,21,15],ohh:31,unreferenc:46,creat:[38,42,49,2,5,7,8,53,23,40,22,29,57,46,20,15],certain:[17,23,9,40,15,61,46],decreas:46,file:[0,6,2,3,5,1,8,11,15,18,58,23,24,25,29,31,32,34,36,39,41,42,43,44,46,47,49,50,55,40,59,60],legacy_broken_cm:61,proport:11,workdai:25,again:[2,19,46,40,32,14,29],collid:[31,42],googl:[20,14,61,6],binocular:30,prepend:15,field:[48,3,4,36,7,42,12,46,31,15],cleanup:14,compet:30,txlosthead:41,writabl:[23,40,51],you:[0,6,2,5,1,58,9,10,11,12,13,14,15,16,17,18,19,20,22,23,25,26,27,28,29,30,31,32,35,37,38,39,40,42,43,44,45,46,47,48,49,51,52,53,54,55,56,57,59,61],architectur:[45,31],sequenc:[15,3],symbol:7,listen_depth:46,ansi:58,reproduc:[40,50,1],pool:[19,46,27],reduc:[27,54,49,38,46],assert:[31,1],neuter:25,directori:[23,46],descript:[0,47,50,34,3,36,7,39,8,24,41,40,46,60,15],slt_error:12,tricki:[42,26,1],lockless:[43,46],potenti:[49,51,23,9,1,40],escap:[27,15,21,3],cpu:[13,59,31,46,17],unset:[49,17,5,23,40,20,61],represent:[19,47,56,60],all:[6,2,5,1,8,9,11,13,14,15,17,18,19,20,23,58,26,27,29,31,32,34,36,38,40,41,42,43,44,46,47,56,49,57,48,60,61],forget:[47,18,19,11,10,43,29,32],lack:[61,11],standardis:31,abit:13,month:6,mp3:[12,13],abil:[19,9],follow:[2,3,7,8,9,10,12,14,15,17,20,22,23,27,28,32,34,36,41,46,49,50,40,60,61],disk:[18,54,46],mathisen:[8,46],default_keep:[27,46],articl:[49,38,43],init:47,program:[47,2,18,1,37,8,31,24,25,53,42,11,29,14,61,46],scratch:1,neglig:40,introduc:[40,57,48,42,43],"case":[0,3,4,5,43,11,12,15,17,23,25,27,31,34,36,41,42,58,47,49,40,60],liter:25,fals:[40,13,51,37],secret_fil:39,faq:59,buer:[0,50,7,39,41,40,15,60,46],util:[0,50,34,3,7,36,39,53,41,60],candid:[46,11],mechan:[31,17],fall:40,veri:[0,47,2,19,1,37,38,25,61,11,40,44,32,31,43,46],ticket:[21,32,1],unalt:40,list:[3,7,10,12,14,15,17,18,19,21,23,25,46,31,32,36,38,41,42,29,53,40,59,60],random:[0,16,33,43,25,24,9,6,40,13,57,56,32],adjust:[40,27],stderr:46,small:[49,11,26,43,40,44,46,29],enterpris:54,queue_max:[27,46],tea:10,tee:1,past:[40,32,58,6],syslog:[0,38,24,1,14,46],rate:[12,18,61,38,46],design:[40,2,43],pass:[47,3,5,21,39,51,23,11,40,27,29,20,61,46],further:[49,23,40,46,14,61,32],ter:15,what:[45,5,6,10,1,12,14,17,18,19,20,35,30,31,43,33,37,38,42,58,57,29,11,47,48,49,53,56,40,59,61],sub:[38,47,49,17,5,43,8,23,40,9,22,27,57,13,44,20,61],clock:[31,46],section:[0,50,34,3,36,7,39,8,55,41,42,40,46,60,15],sandbeck:[8,46],abl:[2,1,39,25,11,59,31,43],brief:15,overload:40,delet:[21,53,23,42,40,27,15,46],version:[0,45,3,5,7,8,10,12,13,15,25,28,46,34,36,39,41,58,29,49,50,51,40,48,60,61],"public":[40,61],movement:2,cookie1:20,tutorial_vcl_fetch_act:20,cookie2:20,themselv:[43,58,15],variat:12,goodbi:59,sessionclos:41,"455c":15,behaviour:[29,13,33,21,27],glossari:[16,29],http_resp_siz:[27,46],solari:[28,58,11],excess:46,recompress:13,method:[40,51,17,10,3],modifi:[5,49,47],legend:43,valu:[0,47,34,3,4,51,21,7,53,54,42,58,40,27,46,60,15],search:[16,32],ixslvvxrgkj:15,newlin:[40,15],sensit:[47,10,1],amount:[5,26,40,57,14,46],saintmod:[40,9,46],pick:[17,20,26,11,40,56,32],action:[23,40,47,38],narrow:[37,15],lurker:[27,46,17],shorthand:46,vcl_return:41,filenam:[0,25,46,15],href:44,famili:[40,24,32,43],sanction:48,suddenli:[19,9,11],acceptor_sleep_decai:46,select:[40,31,46],aggress:17,hexadecim:15,two:[47,48,19,5,1,8,23,40,9,10,61,6,12,57,29,51,43,15],formul:32,taken:[20,23,10,42,15,46],minor:11,more:[45,2,5,43,8,9,10,1,13,14,15,20,21,25,27,31,32,37,38,42,58,57,46,40,48,61],flaw:2,desir:[40,49],openvz:54,hundr:32,mozilla:[49,61],flag:[0,40,47,7,46],stick:48,broke:31,particular:[17,19,5,10,40,51,15],known:[45,3,54,9,48,30,31],compani:[58,31,32],doom:31,cach:[0,45,2,3,4,5,1,7,8,9,10,6,12,13,14,15,16,17,18,19,20,23,24,26,27,29,33,35,38,40,44,46,47,49,50,51,57,61],dictat:52,none:[25,31],endpoint:46,vmod:[47,21,24,6,40,27,46],hour:0,hous:31,dev:[10,14,32],histori:[0,50,34,3,36,7,39,8,24,41,40,46,60,15],remain:[40,44,51],rfc5952:48,nine:59,caveat:1,learn:32,abandon:[40,25,56,11],userbas:11,typograph:25,prompt:2,challeng:[47,15],share:[0,42,47,56,34,2,3,4,19,36,39,31,18,41,60,24,40,44,53,14,46],cacheabl:[40,27,21],accept:[5,7,8,53,40,9,12,13,29,51,46],vtqe_prev:31,minimum:[40,46],pong:18,varnishsoftwar:61,huge:[9,59,31],ntlm:40,cours:[2,6],ixsl:15,freshli:[47,17],secur:[43,56,32,2,46],rather:[3,58,25,37,9,41,1,59,14,15],stig:[8,46],comfort:10,nostdreturn:31,snippet:[40,20,49],rxstatu:41,heck:[31,6],reject:40,simpl:[47,49,17,20,40,1,57,44,46,31,15],unabl:[40,9],regener:44,absentmindedli:30,resourc:46,referenc:40,variant:[12,17],duplic:[40,17,46,15],buffer:[48,46],ping_interv:46,idle_send_timeout:46,"0x8006b51c1":1,resons:46,github:49,postfix:17,confus:[1,37,6,27,48,31],diag_bitmap:46,proto:[40,51],caus:[1,54,43,40,30,46],thread_pool_max:[27,46],xxx:[47,1],dream:59,feed:[43,11],sysctl:14,rotat:[41,3],mission:16,held:46,paper:6,through:[16,42,17,5,46,22,31,35,52,38,32,43,40,59,20,61,15],suffer:12,paramet:[27,49,2,17,5,21,39,24,10,40,1,29,13,46,51,61,15],logic:[23,40,46],typedef:47,render:44,exact:46,wrk:7,late:6,resort:40,rapidli:31,bypass:20,might:[17,25,31,35,9,10,26,43,40,13,57,30,14,61],alter:[23,45],"0x00020000":46,wouldn:31,foon:15,good:[33,47,20,46,53,54,43,40,57,59,31,32],"return":[0,47,48,49,17,29,21,51,39,22,23,40,9,43,12,27,46,31,61,15],authorized_keys2:2,timestamp:[17,7,15],uhm:23,libwww:61,detour:46,somebodi:[30,31,58],barbarian:30,bigger:46,eventu:[40,48],objurl:41,troubleshoot:[33,14],txheader:[41,61],userid:15,datastructur:31,refresh:[61,17],fcj8cnd5188:61,achiev:[35,33,14,61],ceas:20,dialin:[23,40],backtrac:1,truncat:46,n_lru_nuk:26,send_timeout:[27,46],needless:[43,2,46],bereq:[47,49,5,22,40,51],set_ip_to:[0,24,47],monoton:31,idea:[32,47,5,58,6,13,59,30,31,46],procedur:[25,47],realli:[56,45,2,17,18,5,37,35,9,1,12,13,57,32,61,15],connect:[2,18,19,51,7,39,23,55,42,40,46,15],inflict:58,stabl:42,beyond:[40,9],event:[40,46],linpro:[40,8,32],encod:[5,8,53,40,27,12,13,29,51,46],vmod_toupp:47,varnishhist:[34,3,36,7,8,53,24,41,29,60,46],publish:48,research:31,footnot:11,health:[33,19,9,40,57,56,15],print:[36,19,7,61,46],occurr:[40,46],digest_len:43,foreground:[46,15],proxi:[59,45],advanc:[33,57,38],differ:[49,42,19,5,58,8,23,40,38,43,12,27,57,59,31,61,46],reason:[32,2,51,31,25,10,11,40,59,30,14,15],base:[49,2,17,22,60,35,40,25,10,12,44,29,57,46],applewebkit:49,put:[33,47,48,18,58,29,6,52,38,25,11,40,59,31,43,46],backendopen:41,basi:[25,57,11],thrown:9,driven:8,thread:[17,19,8,53,54,9,42,1,40,27,32,31,46],launch:[15,14,1],drupal:[20,61],exponenti:46,circuit:23,corkscrew:59,lifetim:7,assign:[23,40,47,46],logfil:42,frome:51,sess_timeout:46,managebl:35,dont:32,obviou:19,upper:[0,31,46],cache_cli:1,famou:[37,6],misc:32,number:[0,3,5,7,8,10,1,14,15,18,19,31,34,36,37,41,43,46,47,59,51,54,40,48,60],pkgconfig:10,done:[17,20,21,23,55,10,1,27,59,46],unhealthi:[40,57],blank:46,htc:49,miss:[49,34,17,5,3,53,60,1,40,51,29],can_gzip:[40,51],guess:[57,31],php:[35,57],vararg:47,construct:[40,44,46],"0x8006b3ef2":1,paint:6,station:48,fympg:15,statement:[47,38,23,1,40,44],ton:58,scheme:[13,19],store:[35,47,17,4,5,23,26,43,40,13,29,51,46],shmlogsiz:46,saint:[40,19,9,46,24],relationship:2,blindli:37,park:[19,46],part:[47,17,18,20,58,61,15],pars:[0,33,50,5,23,40,12,15,51,46],tebibyt:46,"0x429f8b":1,std:[0,47,3,21,40,27,46],kind:[47,6,49,42,1],grew:11,grep:61,prebuilt:10,whenev:[4,47,11],remot:3,remov:[0,49,17,5,23,40,52,12,27,44,46,20,15],dtd:40,bugfre:2,stall:42,str:40,consumpt:46,stale:[40,9,57,15],randomli:[59,15],stataddr:[41,36],comput:[6,2,11,25,58,31],default_grac:46,packag:[55,21,10,11],expir:[4,40,46,37,17],propos:30,dedic:6,"null":[47,14],option:[3,7,8,52,14,15,17,18,35,24,34,36,39,41,57,46,47,50,53,40,60,61],imagin:[19,58],built:[35,17,23,43,40,30],lib:[46,15],ee30d0770eb460634e9d5dcfb562a2c5:43,self:[46,58,15],troublesom:48,efh:1,also:[0,45,3,5,1,7,8,9,11,13,15,17,19,20,23,24,26,30,32,34,36,37,39,41,42,58,57,46,48,50,51,40,59,60,61],build:[47,49,21,8,10,30],cc_command:46,brace:40,pipelin:6,distribut:[34,53,10,40,57,31,60],exec:46,previou:[40,49,46],reach:[23,18,40,17],react:14,most:[5,6,10,1,15,17,19,23,25,27,43,32,36,37,38,58,44,46,53,40,48,61],plai:[57,34],must_restart:46,plan:[59,30,46,6],gzip_level:[27,46],metacharact:48,amaz:[31,58],fileread:[0,24],clear:[2,25,13,59,31,32],cover:[29,38,11],clean:[40,47,10],hugepag:54,subgroup:40,ridicul:31,carefulli:30,"131g":15,session:[0,47,35,40,59,15,14,46],particularli:[28,31,43],thread_pool_fail_delai:46,finn:61,fine:20,find:[47,2,19,5,58,8,14,55,10,42,43,40,20,61,46],impact:[46,17],ambit:31,firewal:35,http_gzip_support:[5,27,13,56,51,46],copyright:[0,50,34,3,36,7,39,8,24,41,40,46,60,15],writer:42,solut:[19,58,17],grace:[4,51,24,9,40,46],queu:46,templat:[12,17],factor:[35,45],lennon:6,hit:[34,3,18,17,5,1,51,38,53,19,9,41,60,40,6,12,29,20,61,46],backendxid:41,express:[47,56,49,34,17,18,20,3,36,37,23,24,25,41,40,46,60,15],sfile:1,nativ:[13,29],liabl:40,him:30,restart:[2,5,51,9,1,40,27,14,46],silo:46,synthet:[40,17],diffabl:25,synthes:3,rfc:[4,48,61],statist:[33,2,19,7,53,24,42,36,29,31,61,46],rxprotocol:[18,41],nowher:[10,31],seamlessli:19,wrote:58,certif:59,set:[0,2,3,4,5,8,9,1,12,13,14,15,17,20,22,23,26,27,31,37,38,40,58,44,46,47,49,51,52,55,57,61],max_map_count:14,dump:[53,59,15,46,1],sep:47,jade:48,startup:[34,3,36,54,41,60],see:[0,2,3,5,7,8,10,1,13,14,15,23,17,18,20,35,24,27,31,32,34,36,39,40,41,44,46,47,48,49,50,57,59,60,61],wg14:31,barf:[8,43],reserv:[40,31],horizont:[60,34,53],inconveni:43,someth:[0,47,21,1,20,6,38,35,25,10,11,27,30,14,15],reus:46,mutex:[31,42,46],append_ua:49,experi:[5,45,25,46],vmod_priv:47,altern:[23,10],appreci:6,numer:[48,31,58],javascript:20,incident:40,succeed:[40,39],litter:31,arrang:47,solv:[9,11,47,1],popul:23,disclaim:40,lass:7,last:[47,34,4,51,7,53,60,40,57,14,46],delimit:40,shortliv:[27,46],start_child:1,alon:[13,25,59],anon:2,kamp:[34,3,7,36,8,41,40,46],context:[19,51,1,37,25,43,40],pdf:[25,31],whole:[18,40,51,10,14],becam:[48,58],load:[55,47,2,19,29,51,38,9,43,40,57,15,31,46],simpli:[47,41,40,59,32,29],point:[47,17,19,5,46,23,40,12,57,59,31,61,15],tgz:12,makefil:[47,58],ubuntu:[54,21,10],leon:61,header:[0,3,4,5,1,12,13,15,20,22,23,27,46,42,58,29,47,49,51,53,40,61],provok:8,hash_data:[40,27,21,49,43],linux:[49,11,54,58,45,28,14],mistak:31,backend:[2,3,5,7,8,9,13,15,23,17,18,19,20,35,24,26,29,33,34,36,41,42,57,46,49,50,51,52,53,55,40,56,60,61],hairi:[19,5],becom:[49,43,58,35,25,11,27,44,31],java:[35,57],"_atom":31,devic:[33,57,29,49,46],first_byte_timeout:[40,51,46],empti:[19,7,3],secret:[59,39,46,1,48,15],pcre_match_limit:46,nonexist:47,strategi:49,ram:46,imag:[23,40,5,26],shuffl:23,great:[23,25],understand:[49,2,20,31,43,14,61,29],demand:[5,46],repetit:1,look:[2,5,11,9,1,14,15,23,18,35,30,31,43,39,38,58,57,46,47,51,53,55,40,48,61],solid:46,straight:32,budget:30,durat:[0,47,51,37,8,24,40,31,46],formatt:3,"while":[27,49,3,18,1,9,41,10,42,26,6,40,13,44,31,32],smart:[13,5,32,43],behavior:8,doubli:46,vmod_:47,robin:[40,24,57],lingo:47,pack:31,earli:46,malloc:[35,52,14,26,46],hcritbit:[14,1],readi:19,vacat:[21,1],workspace_cli:46,jpg:[23,12,40,13],rxreq:8,cento:[21,10],demot:11,"00z":31,time_firstbyt:3,shirt:31,belong:17,shorter:46,octal:15,higher:[40,46],optim:[18,59,46,17],banter:32,"1000x":45,alert:11,healthi:[40,9,57],moment:[47,38,35,1,44,57,32],temporari:46,varnishreplai:[24,50],provabl:31,stack:[54,46,31,15],recent:[37,15],lower:[0,40,31,15],task:[2,37,23,55,26,43,15],equival:40,older:[17,31,15],entri:[40,34,3,18,36,7,53,24,41,60,42,12,46,14,15],parenthes:40,person:[10,43],cheer:31,www3:40,www2:40,www1:40,tast:[10,11],anybodi:[13,25],darn:48,explan:[47,2,1,43,15,14,32],altmodish:11,obscur:[58,1],press:[18,25],log_local_address:46,pan_ic:1,regardless:[40,51],question:[40,19,37,32],northern:30,poller:19,sessionopen:[18,41,46],mandat:58,"455ce847f0073c7ab3b1465f74507b75d3dc064c1e7de3b71e00de9092fdc89a":15,tablet:49,cup:10,libncurs:10,restructuredtext:[25,56],vcl_pipe:[40,51,22],notifi:17,tweak:[5,46,56,1],input:[4,19,37,43,40,15,46],unlik:[23,40],subsequ:[23,40],app:[18,43],useless:[31,46],bin:[44,38,8],transpar:54,big:[47,19,53,25,26,6,59,31,46],do_gunzip:[40,13,5,51],simple_list:46,insert:[40,5],resid:[23,46],bit:[47,48,49,17,4,19,5,1,55,38,54,18,9,10,61,6,28,59,43,46],docutil:[25,10],signal:[49,14,1],resolv:40,elaps:[40,51],collect:[0,2,24,25,1,48,31],api:[48,31,11],popular:[31,38,53],vcl_error:[40,9,49,51],encount:[47,5,14],scare:59,gnnsdxsvdmvfympg:15,creation:[5,46],some:[2,1,8,9,10,11,12,14,15,17,20,23,26,27,30,31,43,32,39,58,57,46,47,49,55,40,59,61],back:[35,2,19,23,9,58,40,46,32,15],txprotocol:41,"0x00002000":46,"30m":9,sight:59,sizeof:11,"_bool":31,scale:[19,53,60,34,46],chunksiz:46,per:[0,47,49,50,7,39,60,54,9,41,26,43,40,27,46,32,15],cli_resp:2,substitut:[40,19,44],retri:[40,51],larg:[27,46],slash:[49,46],init_funct:47,proc:14,cgi:[40,44,49,38],run:[6,2,4,5,1,7,8,52,10,11,12,45,14,15,16,22,35,24,29,32,33,39,38,42,58,57,46,47,48,53,54,40,59,61],properli:[35,38,2],step:[10,31],logrecord:46,squeez:[43,1],prerequisit:[28,21],meantim:58,from:[0,45,3,4,5,6,7,58,9,10,1,12,13,14,15,17,18,19,20,21,23,25,26,27,28,29,30,31,32,34,36,37,41,42,43,57,46,47,48,49,50,51,55,40,59,60,61],major:[46,2,6],subtract:37,constraint:26,materi:[40,31],prove:[31,15],strcmp:1,idl:46,incompress:13,"32bit":46,"80013801e":1,fetch_chunks:46,uncach:[23,51],frob:[5,56],pkill:[35,52],plethora:14,within:[40,46,38,15],grydeland:0,pastebin:32,frf91:49,ensur:5,disturbingli:6,announc:32,pcre:[40,10],occupi:46,inclus:46,institut:11,spam:32,errno:1,megabyt:[46,15],fast:[45,19,1,43,40,46],systemcal:31,doubt:[32,1],includ:[3,5,8,10,13,15,17,19,29,31,33,34,36,38,41,44,46,49,40,59,60,61],forward:[40,46,32,3],paren:40,"0x00000002":46,doctyp:40,reorgan:11,bore:31,log_alert:0,criteria:23,server1:57,server2:57,link:[25,42,26,40,44,46,31,32],translat:[23,40,48,15],newer:17,atom:37,line:[32,47,3,18,58,7,46,23,24,41,38,1,59,14,15],mitig:61,redpil:40,concaten:[40,27,47,21],utf:40,consist:[40,13,43,42,15],munin:53,pkg_add:10,sum:9,similar:[47,17,5,23,6,40,20],curv:31,derang:58,constant:37,curs:7,palisad:30,parser:[5,46],lyx:25,doesn:[0,18,20,46,31,25,58,13,59,14,61,15],repres:[19,8],"char":[47,43,1],incomplet:23,webcach:61,home:[59,37,61],doe:[2,5,11,9,1,13,14,15,17,21,35,25,27,29,31,32,42,43,46,47,59,49,51,53,54,56,40,48,61],gecko:49,bracket:46,"200c":48,annoi:[31,32],titl:[40,61],invalid:[40,17,15],codec:49,responsetim:29,nice:[0,18,53,6],gigabyt:35,critbit:46,cs101:42,libtool:10,enhanc:32,ago:[19,14,6],algorithm:[12,24,43,40,46],segfault:38,verden:[34,3,7,36,41,40,46],orbit:30,depth:46,dot:[40,46],acceptor_sleep_max:46,broad:0,far:[48,11,38,43,59,31],fresh:[40,17],marvel:20,scroll:18,code:[2,5,1,8,10,11,12,15,23,25,31,32,38,58,46,47,59,49,51,53,40,48],edg:[33,38,13,44,30,61,46],leak:[59,2],queri:[49,3],gang:[34,3,7,36,41,40,32,46],privat:[24,47],procur:40,ulimit:54,friendli:[30,61,17],send:[0,35,49,50,18,5,11,8,53,23,40,9,1,12,13,57,29,20,61,46],granular:46,vcl_conf:47,gzip_memlevel:[27,46],"256k":46,aris:40,sent:[49,3,5,39,12,61,46],settl:37,nett:61,fly:[46,61,15],unzip:[40,51],rollback:40,whichev:15,reinterpret:25,implicitli:40,relev:[31,15,10,14,1],tri:[2,58,13,44,46,32],log_us:0,magic:[47,5,9,13,15,46],notabl:5,"try":[2,5,1,9,10,11,13,14,15,17,19,23,25,46,30,31,43,32,42,58,29,47,40,56],forsiden:61,freed:42,rawprob:40,pleas:[0,32,5,38,10,1,40,13,57,46,14,61,15],impli:[40,36],smaller:6,natur:[31,15],"0x0":0,jump:58,parkinsson:30,video:49,detrim:46,download:10,odd:[14,61],append:[3,41,42,40,27,15],compat:[40,41],index:[16,43],compar:[40,43,31,15],"64k":[14,46],multimedia:61,access:[35,2,17,20,25,52,23,9,42,40,28,46,51,61,15],experiment:46,munmap:14,can:[0,6,2,5,1,7,8,9,10,11,13,14,15,23,17,18,19,20,35,58,25,26,27,28,29,30,31,32,36,37,38,39,40,41,42,43,44,45,46,47,49,51,52,53,55,57,59,61],bitor:46,http_req_siz:[27,46],bodi:[38,8,40,44,46,29],srvr:59,max_esi_includ:27,filedescriptor:[2,15],http_resp:2,max_esi_depth:[27,46],myhost:15,vertic:[60,34,53],sinc:[47,19,5,7,51,14,31,43,40,27,30,20,61,46],convert:[0,39],mailinglist:32,pretti:[21,49,32,43],respon:23,conceiv:[11,1],larger:[40,5,59,1],technolog:22,host:[0,48,49,34,3,18,36,5,17,7,60,55,41,61,6,40,57,46,51,43,15],conterintuit:49,chang:[61,21,49,2,19,51,1,55,23,54,52,10,42,6,40,27,57,46,32,43,15],honor:[40,51],chanc:[35,47,5,42],firefox:61,claim:31,appli:[5,46,30,47,15],approxim:[40,51,46],apt:10,"boolean":[40,51,37],deputi:30,beresp:[0,49,17,5,21,8,23,9,38,27,40,13,44,51,61],timesync:31,fed:43,feel:[43,31,2,6],crap:58,dgst:15,commun:[49,2,34,36,60,41,11,31],doubl:[40,47,46,26,15],upgrad:[19,21,27,22,11],next:[47,19,37,10,11,40,48,31],websit:29,few:[38,35,26,1,12,32],latenc:49,usr:[52,35,55,10,14,46],stage:[23,5],somekei:43,sort:[2,17,18,36,37,6,30,29],redhat_transparent_hugepag:54,about:[45,5,6,10,1,13,56,19,21,25,26,46,30,31,43,32,42,58,57,29,11,47,48,53,59,61],lookup:[47,17,5,23,43,40,27,51,61],trail:49,"transient":[24,46],insensit:40,log_info:[38,46],rare:1,iii:58,had:[45,19,10,42,1,27,30,31],account:[0,2],retriev:[23,40,51,15],perceiv:31,rxheader:[18,41,36,53],cumbersom:61,poul:[2,3,6,7,8,11,13,16,56,19,25,30,31,43,34,36,37,41,58,46,59,40,48],obvious:[35,48,37,11],vcl_recv:[47,49,17,19,5,51,22,23,9,40,27,57,20],endian:31,bidirect:22,fetch:[17,4,5,23,40,9,29,27,46,51,15],aliv:[18,29,15],control:[48,49,2,17,4,5,39,23,24,25,40,46,61,15],max_connect:40,process:[2,3,5,7,8,1,13,14,15,17,18,23,29,30,32,34,36,39,38,41,42,44,46,47,51,53,40,59,60],lock:[7,31,42,46],sudo:10,sniplet:17,high:[33,49,43,9,52,31,35,54,25,1,46,14,61,15],tag:[34,3,18,36,24,41,44,60],tab:15,tarbal:10,onlin:20,crimin:[2,29],overflow_max:27,delai:[7,60,34,46],insuffi:46,gcc:46,guru:[40,14],soon:54,tamper:13,vcl_miss:[49,17,5,23,40,27],instead:[47,34,3,18,36,5,7,60,52,41,10,42,43,27,46,31,15],panic:[40,46,1],circular:46,everywher:47,attend:6,stop:[35,23,52,57,15,46],attent:27,discard:[47,17,19,20,9,40,57,15,61,46],tier:11,redund:40,hasher:46,"10m":8,physic:19,villag:30,alloc:[47,54,35,24,42,46],drop:[32,7,46],essenti:61,seriou:0,sit:[23,16,31],robot:29,element:[47,31,46],issu:[45,17,1,39,31,25,11,12,13,32,14,61,15],rfc3986:48,furious:1,fallback:[0,24,40],least:[34,42,43,12,60,46],lingua:25,move:[27,29,21,49,46],tcl:25,comma:[7,46],"0xb75096d0":17,bunch:61,perfect:43,chosen:[48,30],youtub:61,willing:5,infrastructur:40,decai:46,anyon:11,therefor:[2,19,20,1,6,31,43,32],clientaddr:41,dag:[34,3,7,36,41,40,60,46],crash:[21,38,54,1,40,14,15],greater:15,python:[25,10,47],nokia:11,dai:[0,2,17,6,58,61,32],auth:[15,3],devel:10,mention:[49,5,9,28,48,30],facilit:31,kiss:59,front:[16,45,17,41,26,40,46],thread_pool_timeout:46,libvarnishapi:19,somewher:55,trac:61,anyth:[47,49,5,1,37,25,11,31,46],edit:[40,25,47,52,46],orderto:46,nocach:61,slide:57,mode:[50,5,51,8,24,9,42,40,46,14,15],thread_pool_workspac:[27,47,46],disregard:[40,20,51],subset:44,cry:31,activit:58,intellig:32,"_catch_bug":1,consum:14,mar:14,"static":11,our:[16,45,43,37,49,23,55,10,11,13,57,32,14,46],shannon:43,out:[6,2,5,1,8,9,10,11,15,17,19,20,23,30,31,43,32,42,58,57,46,49,40,61],variabl:[0,3,5,37,51,24,25,40,44,31,15],antiqu:31,vcc:[24,25,47,2],overridden:[40,8],influenc:46,defend:2,req:[0,47,49,38,17,5,21,51,8,23,40,9,22,43,12,27,44,57,20,61,15],vcl:[0,45,2,3,4,5,1,8,9,10,6,12,14,15,23,17,19,20,21,22,35,24,27,29,32,33,37,38,39,40,44,46,47,49,52,55,57,56,61],stdnoreturn:31,suitabl:[47,36,53],disappear:18,hardwar:[54,59,45,58],typcal:50,ref:[35,38],ban_dup:[27,46],red:[21,10],common:[23,43],insid:[42,61,46],workflow:40,kilobyt:[43,46],purge_url:27,hash_ignore_busi:[40,51],york:6,advisor:30,releas:[0,47,9,10,6,32,46],txstatu:[41,14],critbit_cooloff:46,directornam:40,err_ttl:27,http_req_hdr_len:[27,46],unwant:20,could:[58,14,6,44,30,31,61,15],latest:[40,10,31],ask:[2,5,53,9,1,30,31,32],keep:[49,2,17,4,19,29,1,37,51,18,9,41,10,11,12,57,46,30,32,61,15],scari:20,length:[47,4,41,43,15,46],outsid:[49,38,26],pcre_exec:46,retain:40,timezon:32,thread_stats_r:46,softwar:[0,50,34,3,36,20,11,7,39,8,60,41,10,6,40,46,32,61,15],suffix:[40,46],qualiti:11,echo:[54,44,39],date:[0,50,34,3,4,19,7,39,8,40,41,38,36,44,46,60,15],meta_funct:47,art:[16,31,2,29],facil:31,underscor:[20,31],utc:[47,31],prioriti:0,strict:40,unknown:[12,40],licens:[0,50,34,3,36,7,39,8,41,40,44,46,60,15],kibibyt:46,system:[35,2,33,21,58,23,54,25,10,42,1,12,28,46],wrapper:31,attach:[40,46,11],attack:[2,43],"lyngst\u00f8l":[40,60,8],multiprogram:31,termin:[47,18,40,59,15,46],licenc:[0,50,34,3,36,7,39,8,41,46,60,15],accessori:11,"final":[19,10,8,2,17],hat:[21,10],shell:[48,46],rxurl:[18,41,36,61,53],shelf:45,joani:61,shall:[40,31],ogg:[12,15],nobodi:[9,2],haven:38,cli_common:15,hitmiss:3,gethdr_:47,bloat:31,bother:[47,30],"65k":12,structur:[47,1,23,25,43,31,46],charact:[34,53,23,40,43,12,27,60,15],sens:[20,37,26,11,12,13,31,61],bind:[52,14],dubiou:46,other:[6,2,3,5,1,9,10,11,14,23,17,18,19,20,21,35,25,26,28,31,36,38,40,42,43,44,46,56,51,53,57,59,61],deliveri:[45,5,42,13,59,46],counter:[19,53,42,26,40,46,29],hitforpass:23,msec:46,clearli:6,correspond:[40,51,17],have:[6,2,5,1,7,58,9,10,11,12,13,14,15,16,17,18,19,20,23,25,26,27,28,30,31,32,33,35,37,38,40,43,44,46,47,48,49,51,53,55,57,59,61],close:[2,19,23,11,40,46,14,15],need:[5,58,10,1,12,57,15,23,17,19,20,22,35,25,27,32,42,43,44,46,47,48,49,51,54,55,40,59,61],blix:0,turn:[47,45,50,17,23,40,59],border:30,devicetyp:49,jemalloc:59,soak:46,min:46,"0x00080000":46,expos:35,"0x00":40,mix:31,builtin:[40,46],preced:[23,40,37],which:[6,2,3,5,1,8,10,11,13,15,23,19,35,25,58,29,30,31,34,36,39,41,43,57,46,47,51,53,54,40,59,60,61],fulltim:61,ncsa:[24,29,3],singl:[2,17,7,8,40,10,1,12,57,31],uppercas:31,lastst:15,unless:[32,34,3,5,46,60,25,41,59,20,61,15],freebsd:[21,45,1,7,8,41,10,11,40,28,59,32],quantifi:0,who:[23,19,32,6],oracl:11,discov:42,fragment:[44,38,46],rush_expon:46,bz2:12,histogram:[24,53,60,34,29],segment:[18,14],"class":[25,49,42],url:[0,3,5,8,9,12,57,15,17,20,23,27,36,38,43,44,46,47,49,51,53,40,48,61],request:[0,45,3,5,8,9,12,13,15,23,17,18,35,24,27,46,34,36,41,57,29,49,51,53,40,60,61],pipe:[34,3,5,22,53,23,60,40,27,29,51,46],determin:[40,5,47,61],"0x0a":15,fact:[31,2,58],malamud:48,priv_vcl:47,text:[47,49,7,35,55,40,13,44,15,31,46],verbos:8,bring:30,utter:31,fear:31,skimpi:23,trivial:42,anywai:[19,48],redirect:[49,61],"0x7fea4fcb0580":15,ear:32,locat:[4,40,49,39],tire:1,should:[0,45,2,5,9,10,1,23,19,20,35,26,27,31,33,39,38,43,57,46,47,48,51,52,40,59,61],won:[35,17,31,23,40,9,12,14],ixslvvxrgkjptxmc:15,elseif:[44,49],local:[35,47,55,23,52,10,40,14,46],hope:[56,2,6,11,59,30],expkil:41,meant:31,decid:[45,2,23,40,44,48,61],familiar:20,bear:[47,31],regularli:53,mgr:2,increas:[17,38,14,54,26,40,27,57,31,61,46],httperror:41,enabl:[45,17,5,51,54,9,40,27,57,14,46],"0x00040000":46,stuff:[2,10,42,26,58,61],vcl_someth:38,gbp:45,contain:[0,47,17,5,46,23,40,12,44,59,31,15],grab:32,st_inod:42,shm:46,view:[44,42,29],conform:5,btw:58,legaci:61,modulo:46,vcl_pass:[40,27,5,49],shortcom:31,knowledg:33,packet:31,displai:[34,3,18,36,7,53,24,41,46,60,15],triplet:19,thread_pool_add_threshold:46,statu:[49,17,19,51,3,39,24,9,40,56,61,15],error:[33,49,3,19,17,23,40,9,41,42,1,12,27,14,46],pattern:[19,58,32],cache_vbe_conn:27,b00000:10,state:[19,16,47,46,15],crude:2,neither:[34,36,39,60,41,31,46],email:[32,1],exppick:41,entic:5,kei:[45,3,9,43,40,46],vrt:47,reinforc:31,saintmode_threshold:[40,46],job:[47,19,8,43,61,32],entir:[40,46,31,1],crc32:46,succesful:46,monitor:53,doxygen:25,instant:[19,6],plugin:[31,61,53],career:30,mpg:15,ramp:46,equal:[40,37],etc:[0,55,47,21,2,56,5,1,52,58,31,35,25,10,11,29,14,43,46],instanc:[2,3,4,5,7,11,15,19,24,31,34,36,37,39,41,42,46,47,51,40,48,60],lru_interv:46,freeli:40,strftime:3,comment:[49,23,55,40,44,59],anti:46,wall:[30,31],last_us:51,rfc2616:40,vcl_fini:40,walk:[19,17],distinguish:58,ssl_clear:59,laugh:31,cli_run:1,loadabl:46,rpm:10,quit:[0,17,18,20,43,37,31,25,11,57,32,14,61,15],slowli:18,tread:46,tort:40,addition:39,compos:32,compon:[47,2,46],json:7,vcl_log:3,varnishtop:[34,3,36,7,8,53,24,41,29,60,61,46],varnishlog:[50,34,3,18,36,7,8,60,24,41,1,29,14,61,46],both:[47,34,19,36,37,60,25,41,10,42,11,40,31,61,46],bulk:59,togeth:[47,34,3,38,55,41,40,13,57,60,15],"8001337af":1,present:[49,34,3,4,36,20,7,53,41,40,44,60,29],multi:47,plain:[4,1],hyperlink:25,defin:[47,17,18,19,8,55,41,40,57,15,31,61,46],wild:49,observ:46,layer:58,langaug:31,almost:[46,10,31,43,1],squid:[40,17],horribl:[19,10],site:[16,20,38,35,52,26,1,40,44,57,61],substanti:36,fiddl:[19,6],incom:[35,40,57,45],scienc:31,gzip_window:[27,46],let:[35,17,5,25,14,23,31,9,53,40,1,57,44,59,55,20,61],welcom:[16,37,46,32,19],parti:6,cross:32,clase:1,member:47,handl:[45,3,29,17,23,9,1,40,49,57,59,31,61,46],matcher:15,vmod_priv_free_f:47,constel:37,android:49,incl:4,difficult:20,phk:[7,8,41,40,15,32],spell:40,http:[0,45,3,5,52,10,1,12,13,14,15,23,17,18,20,22,35,24,25,27,29,33,37,43,44,46,47,49,50,51,53,40,48,61],hostnam:[0,40,51,61],py3k:25,upon:40,effect:[23,17,46,15],handi:47,beast:1,tbz:12,initi:[40,57,41,47,46],dealloc:[24,42],littl:[31,26,1],expand:46,off:[45,5,23,52,42,6,27,32,61,46],com:[49,17,23,40,44,15,57,61,32],well:[35,45,2,18,25,23,9,13,28,48,31,61],regsubal:[40,20],thought:[2,25,6,56,31,32],exampl:[0,47,49,17,4,20,36,39,8,23,24,41,10,40,43,57,44,59,31,61,15],command:[17,39,24,41,1,46,14,61,15],choos:[35,30,57,10,40],undefin:40,usual:[0,47,48,45,17,23,10,1,49,32,14,61,15],sporad:54,newest:15,therebi:17,ban_url:[40,27],less:[40,9,46,32,6],obtain:39,tcp:[50,46],procesess:42,skill:38,web:[16,45,2,33,18,20,35,52,38,23,40,9,61,1,12,13,44,57,43],amd64:1,bodylen:8,appearantli:31,sky:9,script:[47,49,2,54,8,24,25,10,58,44,29,15],add:[49,17,58,37,8,23,42,43,40,57,14,61],valid:[17,15],collis:43,kick:49,boom:1,unprivileg:46,rememb:[47,19,5,1,13,48,46],piec:[47,55,43],five:[57,46,6],know:[33,47,48,49,56,18,5,6,23,10,42,11,59,61,15],burden:11,thoughtlessli:46,password:1,recurs:46,loss:40,unplan:46,pure:[42,2],like:[6,2,5,1,9,10,11,12,13,14,15,17,18,19,20,29,30,31,37,38,42,43,44,46,47,49,55,40,48,61],success:[46,6],c1x:31,necessari:[23,40,17,46,15],martin:0,workthread:41,decis:[23,40,30],candi:29,restructur:39,revers:[45,46],shutdown:46,captur:1,twitter:6,suppli:[40,49,46],logarithm:[60,34,53],"export":47,shabbi:6,flush:[5,46],guarante:[47,59,31,42,43],peter:30,vsm:2,librari:[47,59,31,61],tmp:[59,46,8,1],trust:[35,5,25,2,58],competitor:58,lead:[31,46],truss:[14,1],avoid:[47,49,17,19,5,25,9,43,40,32,51,46],leav:[43,14,8,31],ipv4:[19,48,50,46],happend:30,speak:45,kiddi:29,esi:[27,33,4,5,21,8,23,38,6,40,13,44,56,51,46],has_j:20,"enum":47,usag:[61,17],symlink:58,vhost:[0,39],headerninja:61,although:40,offset:43,handedli:31,expiri:46,continu:[34,36,7,8,53,60,40,15,31,46],negat:[23,40,15],flaki:9,misbehav:[57,33,9,14,61],child_main:1,socket:[59,51,39,11,40,48,14,46],linger:46,column:[18,7],vcl_hit:[23,27,51,40,17],objrespons:41,purge_dup:27,carrier:25,thread_pool_add_delai:[27,46],segovia:31,emperor:30,disabl:[17,51,54,40,13,46],backendclos:41,thread_pool:46,own:[47,5,37,35,10,43,40,59,31,46],vcl_call:41,lenght:15,automat:[1,9,43,40,13,46],due:[12,40,26,46],warranti:[40,47],automak:10,guard:2,merk:61,rxrespons:41,pitfal:[12,33],pointless:32,automag:29,w3c:40,nuke:46,val:8,pictur:47,transfer:[40,51],support:[33,47,21,45,50,17,5,3,58,54,11,40,13,59,32,61,46],regsub:[40,20,49,47],"12k":46,bump:11,much:[32,21,2,18,19,6,31,35,54,10,42,26,11,13,61,59,14,43,46],"var":[41,14,39],groff:10,"function":[0,47,21,37,58,24,6,40,27,46,31,43,15],north:6,advers:46,weight:40,shm_workspac:46,gain:35,everyon:[23,40,52],overflow:46,highest:37,bug:[21,1,5,6,11,32],count:[34,17,51,53,40,14,15],made:[40,43,31,46],wise:[25,59],krypto:59,whether:[35,3,18,23,40,44,61],shrunk:58,unload:57,writeabl:51,flip:18,troubl:[21,2,32],record:[3,4,36,53,24,41,1,60,46],below:[5,10,47,46],limit:[29,37,31,40,9,26,11,12,27,46,14,15],monument:30,otherwis:[40,49,39,1],problem:[47,1,25,58,31,23,9,11,12,57,32,14,43,46],ikllqv:8,epel:10,sockaddr:48,evalu:17,"int":[0,47,31,51,37],dure:[40,5,59,51,29],pid:[46,14,41,3],twist:43,implement:[47,56,19,5,9,58,40,13,44,59,31,46],ing:[49,34],girl:6,probabl:[0,32,47,43,38,31,35,55,10,6,59,30,14,61,46],syslog_cli_traff:46,contest:46,allow:[2,3,5,17,23,41,1,40,44,46],boot:31,detail:[0,48,49,50,34,3,36,7,39,8,24,41,40,13,46,60,15],virtual:[40,15],book:[20,30,31,6],bool:[47,37,51,46],special:[47,49,5,20,25,40,31,29],sick:9,deliber:40,stat:[19,7,42,46],repeat:[7,14,46],openoffic:25,confignam:15,consequenti:40,debian:[54,21,10,46],stai:[17,15],acceptor_sleep_incr:46,sphinx:[25,56,10],rule:[35,61,31,2,37],profit:40,elsif:[12,40],invari:43},objtypes:{},titles:["vmod_std","Reporting bugs","Security barriers in Varnish","varnishncsa","Shared Memory Logging","How GZIP, and GZIP+ESI works in Varnish","Thoughts on the eve of Varnish 3.0","varnishstat","varnishtest","Misbehaving servers","Installing Varnish","Picking platforms","Vary","Compression","Troubleshooting Varnish","varnish","Welcome to Varnish's documentation!","Purging and banning","Logging in Varnish","What do you mean by 'backend' ?","Cookies","Varnish Installation","Using Websockets","Varnish Configuration Language - VCL","The Varnish Reference Manual","Why Sphinx and reStructuredText ?","Sizing your cache","Upgrading from Varnish 2.1 to 3.0","Prerequisites","Varnish Glossary","What were they thinking ?","The Tools We Work With","Getting hold of us","Using Varnish","varnishhist","Starting Varnish","varnishtop","VCL Expressions","Advanced topics","varnishadm","VCL","varnishlog","Shared Memory Logging and Statistics","Varnish Does Not Hash","Edge Side Includes","What is Varnish?","varnishd","VMOD - Varnish Modules","IPv6 Suckage","Device detection","varnishreplay","bereq","Put Varnish on port 80","Statistics","Platform specific notes","Backend servers","Poul-Hennings random outbursts","Advanced Backend configuration","Did you call them autocrap tools ?","Why no SSL ?","varnishsizes","Achieving a high hitrate"],objnames:{},filenames:["reference/vmod_std","installation/bugs","phk/barriers","reference/varnishncsa","reference/vsl","phk/gzip","phk/three-zero","reference/varnishstat","reference/varnishtest","tutorial/handling_misbehaving_servers","installation/install","phk/platforms","tutorial/vary","tutorial/compression","tutorial/troubleshooting","reference/varnish-cli","index","tutorial/purging","tutorial/logging","phk/backends","tutorial/cookies","installation/index","tutorial/websockets","tutorial/vcl","reference/index","phk/sphinx","tutorial/sizing_your_cache","installation/upgrade","installation/prerequisites","glossary/index","phk/thoughts","phk/thetoolsweworkwith","installation/help","tutorial/index","reference/varnishhist","tutorial/starting_varnish","reference/varnishtop","phk/vcl_expr","tutorial/advanced_topics","reference/varnishadm","reference/vcl","reference/varnishlog","reference/shmem","phk/varnish_does_not_hash","tutorial/esi","tutorial/introduction","reference/varnishd","reference/vmod","phk/ipv6suckage","tutorial/devicedetection","reference/varnishreplay","reference/vcl_var","tutorial/putting_varnish_on_port_80","tutorial/statistics","tutorial/platformnotes","tutorial/backend_servers","phk/index","tutorial/advanced_backend_servers","phk/autocrap","phk/ssl","reference/varnishsizes","tutorial/increasing_your_hitrate"]})varnish-3.0.5/doc/sphinx/=build/html/installation/0000755000175000017500000000000012247037213017112 500000000000000varnish-3.0.5/doc/sphinx/=build/html/installation/index.html0000644000175000017500000002336112247037213021034 00000000000000 Varnish Installation — Varnish version 3.0.5 documentation varnish-3.0.5/doc/sphinx/=build/html/installation/install.html0000644000175000017500000003000412247037213021363 00000000000000 Installing Varnish — Varnish version 3.0.5 documentation

    Installing Varnish¶

    With open source software, you can choose to install binary packages or compile stuff from source-code. To install a package or compile from source is a matter of personal taste. If you don't know which method too choose read the whole document and choose the method you are most comfortable with.

    Source or packages?¶

    Installing Varnish on most relevant operating systems can usually be done with with the systems package manager, typical examples being:

    FreeBSD¶

    From source:
    cd /usr/ports/varnish && make install clean
    Binary package:
    pkg_add -r varnish

    CentOS/RedHat¶

    We try to keep the latest version available as prebuilt RPMs (el5) on repo.varnish-cache.org <http://repo.varnish-cache.org/>. See the RedHat installation instructions <http://www.varnish-cache.org/installation/redhat> for more information.

    Varnish is included in the EPEL repository. Unfortunately we had a syntax change in Varnish 2.0.6->2.1.X. This means that we can not update Varnish in EPEL 5 so the latest version there is Varnish 2.0.6.

    EPEL6 should have Varnish 2.1 available once it releases.

    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 installation instructions for Debian <http://www.varnish-cache.org/installation/debian> or Ubuntu <http://www.varnish-cache.org/installation/ubuntu>.

    Other systems¶

    You are probably best of compiling your own code. See Compiling Varnish from source.

    If that worked for you, you can skip the rest of this document for now, and and start reading the much more interesting Using Varnish instead.

    Compiling Varnish from source¶

    If there are no binary packages available for your system, or if you want to compile Varnish from source for other reasons, follow these steps:

    We recommend downloading a release tarball, which you can find on repo.varnish-cache.org <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

    Please note that a git checkout will need some more build-dependencies than listed below, in particular the Python Docutils and Sphinx.

    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:

    • autotools-dev
    • automake1.9
    • libtool
    • autoconf
    • libncurses-dev
    • xsltproc
    • groff-base
    • libpcre3-dev
    • pkg-config

    Build dependencies on Red Hat / CentOS¶

    To build Varnish on a Red Hat or CentOS system you need the following packages installed:

    • automake
    • autoconf
    • libtool
    • ncurses-devel
    • libxslt
    • groff
    • pcre-devel
    • pkgconfig

    Configuring and compiling¶

    Next, configuration: 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 are run time parameters.

    Before you install, you may want to run the regression tests, make a cup of tea while it runs, it takes some minutes:

    make check

    Don't worry of a single or two tests fail, some of the tests are a bit too timing sensitive (Please tell us which so we can fix it) but if a lot of them fails, and in particular if the b00000.vtc test fails, something is horribly wrong, and you will get nowhere without figuring out what.

    Installing¶

    And finally, the true test of a brave heart:

    make install

    Varnish will now be installed in /usr/local. The varnishd binary is in /usr/local/sbin/varnishd and its default configuration will be /usr/local/etc/varnish/default.vcl.

    You can now proceed to the Using Varnish.

    varnish-3.0.5/doc/sphinx/=build/html/installation/bugs.html0000644000175000017500000002753412247037213020673 00000000000000 Reporting bugs — Varnish version 3.0.5 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.

    Roughly we have three clases of bugs with Varnish, and the information we need to debug them depends on the kind of bug.

    Varnish crashes¶

    Plain and simple: boom

    Varnish is split over two processes, the manager and the child. The child does all the work, and the manager hangs around to resurect it, if it crashes.

    Therefore, the first thing to do if you see a varnish crash, is to examine your syslogs, to see if it has happened before. (One site is rumoured to have had varnish restarting every 10 minutes and still provide better service than their CMS system.)

    When it crashes, if at all possible, Varnish will spew out a crash dump that looks something like:

    Child (32619) died signal=6 (core dumped)
    Child (32619) Panic message: Assert error in ccf_panic(), cache_cli.c line 153:
      Condition(!strcmp("", "You asked for it")) not true.
    errno = 9 (Bad file descriptor)
    thread = (cache-main)
    ident = FreeBSD,9.0-CURRENT,amd64,-sfile,-hcritbit,kqueue
    Backtrace:
      0x42bce1: pan_ic+171
      0x4196af: ccf_panic+4f
      0x8006b3ef2: _end+80013339a
      0x8006b4307: _end+8001337af
      0x8006b8b76: _end+80013801e
      0x8006b8d84: _end+80013822c
      0x8006b51c1: _end+800134669
      0x4193f6: CLI_Run+86
      0x429f8b: child_main+14b
      0x43ef68: start_child+3f8
    [...]

    If you can get that information to us, we are usually able to see exactly where things went haywire, and that speeds up bugfixing a lot.

    There will be a lot more information than this, and before sending it all to us, you should obscure any sensitive/secret data/cookies/passwords/ip# etc. Please make sure to keep context when you do so, ie: do not change all the IP# to "X.X.X.X", but change each IP# to something unique, otherwise we are likely to be more confused than informed.

    The most important line is the "Panic Message", which comes in two general forms:

    "Missing errorhandling code in ..."

    This is a place where we can conceive ending up, and have not (yet) written the padded-box error handling code for.

    The most likely cause here, is that you need a larger workspace for HTTP headers and Cookies. (XXX: which params to tweak)

    Please try that before reporting a bug.

    "Assert error in ..."
    This is something bad that should never happen, and a bug report is almost certainly in order. As always, if in doubt ask us on IRC before opening the ticket.

    In your syslog it may all be joined into one single line, but if you can reproduce the crash, do so while running varnishd manually:

    varnishd -d <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 can you squeeze out of your operating system before you kill the Varnish process.

    One of the most valuable bits of information, is if all Varnish' threads are waiting for something or if one of them is spinning furiously on some futile condition.

    Commands like top -H or ps -Haxlw or ps -efH should be able to figure that out.

    If one or more threads are spinning, use strace or ktrace or truss (or whatever else your OS provides) to get a trace of which system calls the varnish process issues. Be aware that this may generate a lot of very repetitive data, usually one second worth is more than enough.

    Also, run varnishlog for a second, and collect the output for us, and if varnishstat shows any activity, capture that also.

    When you have done this, kill the Varnish child process, and let the master process restart it. Remember to tell us if that does or does not work. If it does not, kill all Varnish processes, and start from scratch. If that does not work either, tell us, that means that we have wedged your kernel.

    Varnish does something wrong¶

    These are the easy bugs: usually all we need from you is the relevant transactions recorded with varnishlog and your explanation of what is wrong about what Varnish does.

    Be aware, that often Varnish does exactly what you asked it to, rather than what you intended it to do, so it sounds like a bug that would have tripped up everybody else, take a moment to read though your VCL and see if it really does what you think.

    You can also try setting the vcl_trace parameter, that will generate log records with like and char number for each statement executed in your VCL program.

    Table Of Contents

    Previous topic

    Getting hold of us

    Next topic

    Upgrading from Varnish 2.1 to 3.0

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/installation/prerequisites.html0000644000175000017500000001135512247037213022631 00000000000000 Prerequisites — Varnish version 3.0.5 documentation

    Prerequisites¶

    In order for you to install Varnish you must have the following:

    • A fairly modern and 64 bit version of either - Linux - FreeBSD - Solaris
    • root access to said system

    Varnish can be installed on other UNIX systems as well, but it is not tested particularly well on these plattforms. Varnish is, from time to time, said to work on:

    • 32 bit versions of the before-mentioned systems.
    • OS X
    • NetBSD
    • OpenBSD

    Previous topic

    Varnish Installation

    Next topic

    Installing Varnish

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/installation/help.html0000644000175000017500000002241612247037213020655 00000000000000 Getting hold of us — Varnish version 3.0.5 documentation

    Getting hold of us¶

    Getting hold of the gang behind Varnish is pretty straight forward, we try to help as much as time permits and have tried to streamline this process as much as possible.

    But before you grab hold of us, spend a moment composing your thoughts and formulate your question, there is nothing as pointless as simply telling us "Varnish does not work for me" with no further information to give any clue to why.

    And before you even do that, do a couple of searches to see if your question is already answered, if it has been, you will get your answer much faster that way.

    IRC Channel¶

    The most immediate way to get hold of us, is to join our IRC channel:

    #varnish on server irc.linpro.no

    The main timezone of the channel is Europe+America.

    If you can explain your problem in a few clear sentences, without too much copy&paste, IRC is a good way to try to get help. If you do need to paste log files, VCL and so on, please use a pastebin.

    If the channel is all quiet, try again some time later, we do have lives, families and jobs to deal with also.

    You are more than welcome to just hang out, and while we don't mind the occational intrusion of the real world into the flow, keep it mostly on topic, and dont paste random links unless they are really spectacular and intelligent.

    Mailing Lists¶

    Getting on or off our mailinglist happens through MailMan.

    If you are going to use Varnish, subscribing to our varnish-announce mailing list is probably a very good idea. The typical pattern is that people spend some time getting Varnish running, and then more or less forget about it. Therefore the announce list is a good way to be reminded about new releases, bad bugs or security holes.

    The varnish-misc mailing list is for general banter, questions, suggestions, ideas and so on. If you are new to Varnish it may pay off to subscribe to -misc, simply to have an ear to the telegraph-pole and learn some smart tricks. This is a good place to ask for help with more complex issues, that require quoting of files and 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.

    Trouble Tickets¶

    Please do not open a trouble ticket, unless you have spotted an actual bug in Varnish. Ask on IRC first if you are in doubt.

    The reason for this policy, is to avoid the bugs being drowned in a pile of sensible suggestions for future enhancements and call for help from people who forget to check back if they get it and so on.

    We track suggestions and ideas in our "Shopping-List" wiki page, and user support via email and IRC.

    Commercial Support¶

    The following companies offer commercial Varnish support, and are listed here for your convenience. If you want your company listed here, drop an email to phk@FreeBSD.org.

    Table Of Contents

    Previous topic

    Installing Varnish

    Next topic

    Reporting bugs

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/installation/upgrade.html0000644000175000017500000004553312247037213021361 00000000000000 Upgrading from Varnish 2.1 to 3.0 — Varnish version 3.0.5 documentation

    Upgrading from Varnish 2.1 to 3.0¶

    This is a compilation of items you need to pay attention to when upgrading from Varnish 2.1 to 3.0

    Changes to VCL¶

    In most cases you need to update your VCL since there has been some changes to the syntax.

    string concatenation operator¶

    String concatenation did not have an operator previously, but this has now been changed to +.

    no more %-escapes in strings¶

    To simplify strings, the %-encoding has been removed. If you need non-printable characters, you need to use inline C.

    log moved to the std vmod¶

    log has moved to the std vmod:

    log "log something";

    becomes:

    import std;
    std.log("log something");
    

    You only need to import std once.

    purges are now called bans¶

    purge() and purge_url() are now respectively ban() and ban_url(), so you should replace all occurences:

    purge("req.url = " req.url);

    becomes:

    ban("req.url = " + req.url);
    

    purge does not take any arguments anymore, but can be used in vcl_hit or vcl_miss to purge the item from the cache, where you would reduce ttl to 0 in Varnish 2.1:

    sub vcl_hit {
      if (req.request == "PURGE") {
        set obj.ttl = 0s;
        error 200 "Purged.";
      }
    }

    becomes:

    sub vcl_hit {
      if (req.request == "PURGE") {
        purge;
        error 200 "Purged.";
      }
    }

    beresp.cacheable and obj.cacheable are gone¶

    beresp.cacheable is gone, and can be replaced with beresp.ttl > 0s. Similarly obj.cacheable can be replaced with obj.ttl > 0s.

    returns are now done with the return() function¶

    pass, pipe, lookup, deliver, fetch, hash, pipe and restart are no longer keywords, but arguments to return(), so:

    sub vcl_pass {
      pass;
    }

    becomes:

    sub vcl_pass {
      return(pass);
    }

    req.hash is replaced with hash_data()¶

    You no longer append to the hash with +=, so:

    set req.hash += req.url;

    becomes:

    hash_data(req.url);
    

    esi is replaced with beresp.do_esi¶

    You no longer enable ESI with esi, so:

    esi;
    

    in vcl_fetch becomes:

    set beresp.do_esi = true;

    pass in vcl_fetch renamed to hit_for_pass¶

    The difference in behaviour of pass in vcl_recv and vcl_fetch confused people, so to make it clearer that they are different, you must now do return(hit_for_pass) when doing a pass in vcl_fetch.

    Changes to runtime parameters¶

    Deleted parameters¶

    cache_vbe_conns and err_ttl has been removed.

    New parameters¶

    The following parameters have been added, see man varnishd for reference:

    • default_keep
    • expiry_sleep
    • fetch_maxchunksize
    • gzip_level
    • gzip_memlevel
    • gzip_stack_buffer
    • gzip_tmp_space
    • gzip_window
    • http_gzip_support
    • http_req_hdr_len
    • http_req_size
    • http_resp_hdr_len
    • http_resp_size
    • shortlived
    • thread_pool_workspace
    • vcc_err_unref
    • vcl_dir
    • vmod_dir

    Changed default values¶

    The following parameters have new defaults:

    • ban_lurker_sleep changed from 0 to 0.01 seconds, enabling the ban lurker by default.
    • connect_timeout changed from 0.4 to 0.7 seconds.
    • log_hashstring changed from off to on.
    • send_timeout changed from 600 to 60 seconds.
    • thread_pool_add_delay changed from 20 to 2 ms.

    Changed parameter names¶

    The following parameters have new names:

    • http_headers has been renamed to http_max_hdr.
    • max_esi_includes has been renamed to max_esi_depth.
    • overflow_max has been renamed to queue_max.
    • purge_dups has been renamed to ban_dups.

    Changes to behaviour¶

    Varnish will return an error when headers are too large instead of just ignoring them. If the limits are too low, Varnish will return HTTP 413. You can change the limits by increasing http_req_hdr_len and http_req_size.

    thread_pool_max is now per thread pool, while it was a total across all pools in 2.1. If you had this set in 2.1, you should adjust it for 3.0.

    varnish-3.0.5/doc/sphinx/=build/html/index.html0000644000175000017500000001233412247037213016331 00000000000000 Welcome to Varnish's documentation! — Varnish version 3.0.5 documentation

    Welcome to Varnish's documentation!¶

    Varnish is a state of the art web accelerator. Its mission is to sit in front of a web server and cache content. It makes your web site go faster.

    We suggest you start by reading the installation guide Varnish Installation. Once you have Varnish up and running go through our tutorial - Using Varnish.

    Contents:

    Indices and tables¶

    $Id$

    Table Of Contents

    Next topic

    Varnish Installation

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/search.html0000644000175000017500000000610612247037213016467 00000000000000 Search — Varnish version 3.0.5 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-3.0.5/doc/sphinx/=build/html/reference/0000755000175000017500000000000012247037213016347 500000000000000varnish-3.0.5/doc/sphinx/=build/html/reference/varnishtest.html0000644000175000017500000002600612247037213021533 00000000000000 varnishtest — Varnish version 3.0.5 documentation

    varnishtest¶

    Test program for Varnish¶

    Author:Stig Sandbeck Mathisen
    Author:Kristian Lyngstøl
    Date:2011-11-15
    Version:1.1
    Manual section:1

    SYNOPSIS¶

    varnishtest [-iklLqv] [-n iter] [-D name=val] [-j jobs] [-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:

    -D name=val Define macro for use in scripts

    -i Find varnishd in build tree
    -j jobs Run this many tests in parallel
    -k Continue on test failure
    -l Leave /tmp/vtc.* if test fails
    -L Always leave /tmp/vtc.*
    -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
    -h Show help

    file File to use as a script

    Macro definitions that can be overridden.

    varnishd Path to varnishd to use [varnishd]

    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_fetch {
                    set beresp.do_esi = true;
                    if (req.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
    • varnishhist(1)
    • varnishlog(1)
    • varnishncsa(1)
    • varnishstat(1)
    • varnishtop(1)
    • vcl(7)

    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-3.0.5/doc/sphinx/=build/html/reference/vcl_var.html0000644000175000017500000004136412247037213020621 00000000000000 bereq — Varnish version 3.0.5 documentation

    bereq¶

    bereq.backend

    Type: BACKEND

    Readable from: vcl_pipe, backend

    Writeable frome: vcl_pipe, backend

    bereq.between_bytes_timeout

    Type: DURATION

    Readable from: vcl_pipe, backend

    Writeable frome: vcl_pipe, 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

    Writeable frome: vcl_pipe, backend

    The time in seconds to wait for a backend connection.

    bereq.first_byte_timeout

    Type: DURATION

    Readable from: vcl_pipe, backend

    Writeable frome: vcl_pipe, 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

    Writeable frome: vcl_pipe, backend

    The corresponding HTTP header.

    bereq.method

    Type: STRING

    Readable from: vcl_pipe, backend

    Writeable frome: vcl_pipe, backend

    The request type (e.g. "GET", "HEAD").

    bereq.proto

    Type: STRING

    Readable from: vcl_pipe, backend

    Writeable frome: vcl_pipe, backend

    The HTTP protocol version used to talk to the server.

    bereq.retries

    Type: INT

    Readable from: backend

    bereq.uncacheable

    Type: BOOL

    Readable from: backend

    Writeable frome: backend

    bereq.url

    Type: STRING

    Readable from: vcl_pipe, backend

    Writeable frome: vcl_pipe, backend

    The requested URL.

    beresp¶

    beresp.backend.ip

    Type: IP

    Readable from: vcl_backend_response

    IP of the backend this response was fetched from.

    beresp.backend.name

    Type: STRING

    Readable from: vcl_backend_response

    Name of the backend this response was fetched from.

    beresp.do_esi

    Type: BOOL

    Readable from: vcl_backend_response

    Writeable frome: vcl_backend_response

    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

    Writeable frome: vcl_backend_response

    Boolean. Unzip the object before storing it in the cache. Defaults to false.

    beresp.do_gzip

    Type: BOOL

    Readable from: vcl_backend_response

    Writeable frome: vcl_backend_response

    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

    Writeable frome: vcl_backend_response

    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. As of Varnish Cache 3.0 the object will marked as busy as it is delivered so only client can access the object.

    beresp.grace

    Type: DURATION

    Readable from: vcl_backend_response

    Writeable frome: vcl_backend_response

    Set to a period to enable grace.

    beresp.http.

    Type: HEADER

    Readable from: vcl_backend_response

    Writeable frome: vcl_backend_response

    The corresponding HTTP header.

    beresp.keep

    Type: DURATION

    Readable from: vcl_backend_response

    Writeable frome: vcl_backend_response

    beresp.proto

    Type: STRING

    Readable from: vcl_backend_response

    Writeable frome: vcl_backend_response

    The HTTP protocol version used the backend replied with.

    beresp.reason

    Type: STRING

    Readable from: vcl_backend_response

    Writeable frome: vcl_backend_response

    The HTTP status message returned by the server.

    beresp.status

    Type: INT

    Readable from: vcl_backend_response

    Writeable frome: vcl_backend_response

    The HTTP status code returned by the server.

    beresp.storage

    Type: STRING

    Readable from: vcl_backend_response

    Writeable frome: vcl_backend_response

    Set to force Varnish to save this object to a particular storage backend.

    beresp.ttl

    Type: DURATION

    Readable from: vcl_backend_response

    Writeable frome: vcl_backend_response

    The object's remaining time to live, in seconds. beresp.ttl is writable.

    beresp.uncacheable

    Type: BOOL

    Readable from: vcl_backend_response

    Writeable frome: vcl_backend_response

    client¶

    client.identity

    Type: STRING

    Readable from: client, backend

    Writeable frome: client, backend

    Identification of the client, used to load balance in the client director.

    client.ip

    Type: IP

    Readable from: client, backend

    The client's IP address.

    now¶

    now

    Type: TIME

    Readable from: vcl_all

    The current time, in seconds since the epoch. When used in string context it returns a formatted string.

    obj¶

    obj.grace

    Type: DURATION

    Readable from: vcl_hit, vcl_error

    Writeable frome: vcl_hit, vcl_error

    The object's grace period in seconds. obj.grace is writable.

    obj.hits

    Type: INT

    Readable from: vcl_hit, vcl_deliver

    Writeable frome: vcl_hit, vcl_deliver

    The approximate number of times the object has been delivered. A value of 0 indicates a cache miss. This variable is also available in vcl_deliver.

    obj.http.

    Type: HEADER

    Readable from: vcl_hit, vcl_error

    Writeable frome: vcl_error

    The corresponding HTTP header.

    obj.keep

    Type: DURATION

    Readable from: vcl_hit, vcl_error

    Writeable frome: vcl_hit, vcl_error

    obj.last_use

    Type: TIME

    Readable from: vcl_hit, vcl_deliver

    Writeable frome: vcl_hit, vcl_deliver

    The approximate time elapsed since the object was last requests, in seconds. This variable is also available in vcl_deliver.

    obj.proto

    Type: STRING

    Readable from: vcl_hit, vcl_error

    Writeable frome: vcl_hit, vcl_error

    The HTTP protocol version used when the object was retrieved.

    obj.reason

    Type: STRING

    Readable from: vcl_error

    Writeable frome: vcl_error

    The HTTP status message returned by the server.

    obj.status

    Type: INT

    Readable from: vcl_error

    Writeable frome: vcl_error

    The HTTP status code returned by the server.

    obj.ttl

    Type: DURATION

    Readable from: vcl_hit, vcl_error

    Writeable frome: vcl_hit, vcl_error

    The object's remaining time to live, in seconds. obj.ttl is writable.

    obj.uncacheable

    Type: BOOL

    Readable from: vcl_hit, vcl_deliver, vcl_error

    req¶

    req.backend

    Type: BACKEND

    Readable from: client

    Writeable frome: client

    The backend to use to service the request.

    req.can_gzip

    Type: BOOL

    Readable from: client

    Does the client accept the gzip transfer encoding.

    req.esi

    Type: BOOL

    Readable from: vcl_recv, vcl_backend_response, vcl_deliver, vcl_error

    Writeable frome: vcl_recv, vcl_backend_response, vcl_deliver, vcl_error

    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

    Writeable frome: 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

    Writeable frome: 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

    Writeable frome: client

    The corresponding HTTP header.

    req.method

    Type: STRING

    Readable from: client

    Writeable frome: client

    The request type (e.g. "GET", "HEAD").

    req.proto

    Type: STRING

    Readable from: client

    Writeable frome: 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

    Writeable frome: client

    req.url

    Type: STRING

    Readable from: client

    Writeable frome: client

    The requested URL.

    req.xid

    Type: STRING

    Readable from: client

    Unique ID of this request.

    resp¶

    resp.http.

    Type: HEADER

    Readable from: vcl_deliver

    Writeable frome: vcl_deliver

    The corresponding HTTP header.

    resp.proto

    Type: STRING

    Readable from: vcl_deliver

    Writeable frome: vcl_deliver

    The HTTP protocol version to use for the response.

    resp.reason

    Type: STRING

    Readable from: vcl_deliver

    Writeable frome: vcl_deliver

    The HTTP status message that will be returned.

    resp.status

    Type: INT

    Readable from: vcl_deliver

    Writeable frome: vcl_deliver

    The HTTP status code that will be returned.

    server¶

    server.hostname

    Type: STRING

    Readable from: client

    The host name of the server.

    server.identity

    Type: STRING

    Readable from: client

    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.

    Table Of Contents

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/reference/vmod.html0000644000175000017500000003610212247037213020124 00000000000000 VMOD - Varnish Modules — Varnish version 3.0.5 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(7).

    This part of the manual is about how you go about writing your own VMOD, how the language interface between C and VCC works etc. This explanation will use the "std" VMOD as example, having a varnish source tree handy may be a good idea.

    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 "vmod.py" turns into thaumathurgically challenged C data structures that does all the hard work.

    The std VMODs vmod.vcc file looks somewhat like this:

    Module std
    Init init_function
    Function STRING toupper(PRIV_CALL, STRING_LIST)
    Function STRING tolower(PRIV_VCL, STRING_LIST)
    Function VOID set_ip_tos(INT)

    The first line gives the name of the module, nothing special there.

    The second line specifies an optional "Init" function, which will be called whenever a VCL program which imports this VMOD is loaded. This gives a chance to initialize the module before any of the functions it implements are called.

    The next three lines specify two functions in the VMOD, along with the types of the arguments, and that is probably where the hardest bit of writing a VMOD is to be found, so we will talk about that at length in a moment.

    Notice that the third function returns VOID, that makes it a "procedure" in VCL lingo, meaning that it cannot be used in expressions, right side of assignments and such places. Instead it can be used as a primary action, something functions which return a value can not:

    sub vcl_recv {
            std.set_ip_tos(32);
    }

    Running vmod.py on the vmod.vcc file, produces an "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 sess;
    struct VCL_conf;
    const char * vmod_toupper(struct sess *, struct vmod_priv *, const char *, ...);
    const char * vmod_tolower(struct sess *, struct vmod_priv *, const char *, ...);
    int meta_function(void **, const struct VCL_conf *);

    Those are your C prototypes. Notice the vmod_ prefix on the function names and the C-types as return types and arguments.

    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, from simple to nasty.

    INT

    C-type: int

    An integer as we know and love them.

    REAL

    C-type: double

    A floating point value

    DURATION

    C-type: double

    Units: seconds

    A time interval, as in "25 minutes".

    TIME

    C-type: double

    Units: seconds since UNIX epoch

    An absolute time, as in "Mon Sep 13 19:06:01 UTC 2010".

    STRING

    C-type: const char *

    A NUL-terminated text-string.

    Can be NULL to indicate that the nonexistent string, for instance:

    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 session or worker 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 do that, by not editing separate pieces of a sting together to one string, until we need to.

    Consider this contrived example:

    set bereq.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 thread_pool_workspace param is big enough.

    PRIV_VCL
    See below
    PRIV_CALL
    See below
    VOID

    C-type: void

    Can only be used for return-value, which makes the function a VCL procedure.

    HEADER

    C-type: enum gethdr_e, const char *

    XXX: explain me

    IP, BOOL
    XXX: these types are not released for use in vmods yet.

    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 two levels of private pointers, "per call" and "per VCL"

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

    "per vcl" private pointers are useful for such global state that applies to all calls in this VCL, for instance flags that determine if regular expressions are case-sensitive in this vmod or similar.

    The way it works in the vmod code, is that a struct vmod_priv * is passed to the functions where argument type PRIV_VCL or PRIV_CALL is specified.

    This structure contains two members:

    typedef void vmod_priv_free_f(void *);
    struct vmod_priv {
            void                    *priv;
            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 "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 only argument. The "per vcl" pointers is guaranteed to be the last one inspected.

    Table Of Contents

    Previous topic

    Shared Memory Logging and Statistics

    Next topic

    vmod_std

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/reference/index.html0000644000175000017500000005023412247037213020270 00000000000000 The Varnish Reference Manual — Varnish version 3.0.5 documentation

    The Varnish Reference Manual¶

    Previous topic

    Troubleshooting Varnish

    Next topic

    VCL

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/reference/varnishhist.html0000644000175000017500000002424412247037213021525 00000000000000 varnishhist — Varnish version 3.0.5 documentation

    varnishhist¶

    Varnish request histogram¶

    Author:Dag-Erling Smørgrav
    Date:2010-05-31
    Version:1.0
    Manual section:1

    SYNOPSIS¶

    varnishhist [-b] [-C] [-c] [-d] [-I regex] [-i tag] [-m tag:regex ...] [-n varnish_name] [-r file] [-V] [-w delay] [-X regex] [-x tag]

    DESCRIPTION¶

    The varnishhist utility reads varnishd(1) shared memory logs and presents a continuously updated histogram show†ing the distribution of the last N requests by their processing. The value of N and the vertical scale are dis†played in the top left corner. The horizontal scale is logarithmic. Hits are marked with a pipe character ("|"), and misses are marked with a hash character ("#").

    The following options are available:

    -b Include log entries which result from communication with a backend server. If neither -b nor -c is specified, varnishhist acts as if they both were.
    -C Ignore case when matching regular expressions.
    -c Include log entries which result from communication with a client. If neither -b nor -c is specified, varnishhist acts as if they both were.
    -d Process old log entries on startup. Normally, varnishhist will only process entries which are written to the log after it starts.
    -I regex Include log entries which match the specified regular expression. If neither -I nor -i is specified, all log entries are included.
    -i tag Include log entries with the specified tag. If neither -I nor -i is specified, all log entries are included.
    -m tag:regex only count transactions where tag matches regex. Multiple
    -m options are AND-ed together.
    -n Specifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used.
    -r file Read log entries from file instead of shared memory.
    -V Display the version number and exit.
    -w delay Wait at least delay seconds between each update. The default is 1. file instead of displaying them. The file will be overwritten unless the -a option was specified.
    -X regex Exclude log entries which match the specified regular expression.
    -x tag Exclude log entries with the specified tag.

    SEE ALSO¶

    • varnishd(1)
    • varnishlog(1)
    • varnishncsa(1)
    • varnishstat(1)
    • 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.

    Table Of Contents

    Previous topic

    varnishd

    Next topic

    varnishlog

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/reference/shmem.html0000644000175000017500000001662312247037213020276 00000000000000 Shared Memory Logging and Statistics — Varnish version 3.0.5 documentation

    Shared Memory Logging and Statistics¶

    Varnish uses shared memory for logging and statistics, because it is faster and much more efficient. But it is also tricky in ways a regular logfile is not.

    When you open a file in "append" mode, the operating system guarantees that whatever you write will not overwrite existing data in the file. The neat result of this is that multiple procesess or threads writing 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 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, 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.

    When Varnishd starts, if it finds an existing shared memory file, and it can safely read the master_pid field, it will check if that process is running, and if so, fail with an error message, indicating that -n arguments collide.

    In all other cases, it will delete and create a new shmlog file, in order to provide running readers a cooling off period, where they can discover that there is a new shmlog file, by doing a stat(2) call and checking the st_dev & st_inode fields.

    Allocations¶

    Sections inside the shared memory file are allocated dynamically, for instance when a new backend is added.

    While changes happen to the linked list of allocations, the "alloc_seq" header field is zero, and after the change, it gets a value different from what it had before.

    Deallocations¶

    When a section is freed, its class will change to "Cool" for at least 10 seconds, giving programs using it time to detect the change in alloc_seq header field and/or the change of class.

    Table Of Contents

    Previous topic

    varnishtop

    Next topic

    VMOD - Varnish Modules

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/reference/vsl.html0000644000175000017500000001527512247037213017773 00000000000000 Shared Memory Logging — Varnish version 3.0.5 documentation

    Shared Memory Logging¶

    TTL records¶

    A TTL record is emitted whenever the ttl, grace or keep values for an object is set.

    The format is:

    %u %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"
    +------------------------------ object XID

    The last three fields are only present in "RFC" headers.

    Examples:

    1001 RFC 19 -1 -1 1312966109 4 0 0 23
    1001 VCL 10 -1 -1 1312966109 4
    1001 VCL 7 -1 -1 1312966111 6
    1001 VCL 7 120 -1 1312966111 6
    1001 VCL 7 120 3600 1312966111 6
    1001 VCL 12 120 3600 1312966113 8

    Gzip records¶

    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

    Table Of Contents

    Previous topic

    vmod_std

    Next topic

    Poul-Hennings random outbursts

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/reference/vcl.html0000644000175000017500000014017412247037213017750 00000000000000 VCL — Varnish version 3.0.5 documentation

    VCL¶

    Varnish Configuration Language¶

    Author:Dag-Erling Smørgrav
    Author:Poul-Henning Kamp
    Author:Kristian Lyngstøl
    Author:Per Buer
    Date:2010-06-02
    Version:1.0
    Manual section:7

    DESCRIPTION¶

    The VCL language is a small domain-specific language designed to be used to define 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 dynamically linked into the server process.

    SYNTAX¶

    The VCL syntax is very simple, and deliberately similar to C and 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.

    In addition to the C-like assignment (=), comparison (==, !=) and boolean (!, && and ||) operators, VCL supports both regular expression and ACL matching using the ~ and the !~ operators.

    Basic strings are enclosed in " ... ", and may not contain newlines.

    Long strings are enclosed in {" ... "}. They may contain any character including ", newline and other control characters except for the NUL (0x00) character.

    Unlike C and Perl, the backslash () character has no special meaning in strings in VCL, so it can be freely used in regular expressions without doubling.

    Strings are concatenated using the '+' operator.

    Assignments are introduced with the set keyword. There are no user-defined variables; values can only be assigned to variables attached to backend, request or document objects. Most of these are typed, and the values assigned to them must have a compatible unit suffix.

    You can use the set keyword to arbitrary HTTP headers. You can remove headers with the remove or unset keywords, which are synonym.

    You can use the rollback keyword to revert any changes to req at any time.

    The synthetic keyword is used to produce a synthetic response body in vcl_error. It takes a single string as argument.

    You can force a crash of the client process with the panic keyword. panic takes a string as argument.

    The return(action) keyword terminates the subroutine. action can be, depending on context one of

    • deliver
    • error
    • fetch
    • hash
    • hit_for_pass
    • lookup
    • ok
    • pass
    • pipe
    • restart

    Please see the list of subroutines to see what return actions are available where.

    VCL has if tests, but no loops.

    The contents of another VCL file may be inserted at any point in the code by using the include keyword followed by the name of the other file as a quoted string.

    Backend declarations¶

    A backend declaration creates and initializes a named backend object:

    backend www {
      .host = "www.example.com";
      .port = "http";
    }

    The backend object can later be used to select a backend at request time:

    if (req.http.host ~ "(?i)^(www.)?example.com$") {
      set req.backend = www;
    }

    To avoid overloading backend servers, .max_connections can be set to limit the maximum number of concurrent backend connections.

    The timeout parameters can be overridden in the backend declaration. The timeout parameters are .connect_timeout for the time to wait for a backend connection, .first_byte_timeout for the time to wait for the first byte from the backend and .between_bytes_timeout for time to wait between each received byte.

    These can be set in the declaration like this:

    backend www {
      .host = "www.example.com";
      .port = "http";
      .connect_timeout = 1s;
      .first_byte_timeout = 5s;
      .between_bytes_timeout = 2s;
    }

    To mark a backend as unhealthy after number of items have been added to its saintmode list .saintmode_threshold can be set to the maximum list size. Setting a value of 0 disables saint mode checking entirely for that backend. The value in the backend declaration overrides the parameter.

    Directors¶

    A director is a logical group of backend servers clustered together for redundancy. The basic role of the director is to let Varnish choose a backend server amongst several so if one is down another can be used.

    There are several types of directors. The different director types use different algorithms to choose which backend to use.

    Configuring a director may look like this:

    director b2 random {
      .retries = 5;
      {
        // We can refer to named backends
        .backend = b1;
        .weight  = 7;
      }
      {
        // Or define them inline
        .backend  = {
          .host = "fs2";
        }
      .weight         = 3;
      }
    }
    The family of random directors¶

    There are three directors that share the same logic, called the random director, client director and hash director. They each distribute traffic among the backends assigned to it using a random distribution seeded with either the client identity, a random number or the cache hash (typically url). Beyond the initial seed, they act the same.

    Each backend requires a .weight option which sets the amount of traffic each backend will get compared to the others. Equal weight means equal traffic. A backend with lower weight than an other will get proportionally less traffic.

    The director has an optional .retries option which defaults to the number of backends the director has. The director will attempt .retries times to find a healthy backend if the first attempt fails. Each attempt re-uses the previous seed in an iterative manner. For the random director this detail is of no importance as it will give different results each time. For the hash and client director, this means the same URL or the same client will fail to the same server consistently.

    The random director¶

    This uses a random number to seed the backend selection.

    The client director¶

    The client director picks a backend based on the clients identity. You can set the VCL variable client.identity to identify the client by picking up the value of a session cookie or similar.

    The hash director¶

    The hash director will pick a backend based on the URL hash value.

    This is useful is you are using Varnish to load balance in front of other Varnish caches or other web accelerators as objects won't be duplicated across caches.

    It will use the value of req.hash, just as the normal cache lookup methods.

    The round-robin director¶

    The round-robin director does not take any options.

    It will use the first backend for the first request, the second backend for the second request and so on, and start from the top again when it gets to the end.

    If a backend is unhealthy or Varnish fails to connect, it will be skipped. The round-robin director will try all the backends once before giving up.

    The DNS director¶

    The DNS director can use backends in two different ways. Either like the random or round-robin director or using .list:

    director directorname dns {
            .list = {
                    .host_header = "www.example.com";
                    .port = "80";
                    .connect_timeout = 0.4s;
                    "192.168.15.0"/24;
                    "192.168.16.128"/25;
            }
            .ttl = 5m;
            .suffix = "internal.example.net";
    }

    This will specify 384 backends, all using port 80 and a connection timeout of 0.4s. Options must come before the list of IPs in the .list statement. The .list-method does not support IPv6. It is not a white-list, it is an actual list of backends that will be created internally in Varnish - the larger subnet the more overhead.

    The .ttl defines the cache duration of the DNS lookups.

    The above example will append "internal.example.net" to the incoming Host header supplied by the client, before looking it up. All settings are optional.

    Health checks are not thoroughly supported.

    DNS round robin balancing is supported. If a hostname resolves to multiple backends, the director will divide the traffic between all of them in a round-robin manner.

    The fallback director¶

    The fallback director will pick the first backend that is healthy. It considers them in the order in which they are listed in its definition.

    The fallback director does not take any options.

    An example of a fallback director:

    director b3 fallback {
      { .backend = www1; }
      { .backend = www2; } // will only be used if www1 is unhealthy.
      { .backend = www3; } // will only be used if both www1 and www2
                           // are unhealthy.
    }

    Backend probes¶

    Backends can be probed to see whether they should be considered healthy or not. The return status can also be checked by using req.backend.healthy.

    Probes take the following parameters:

    .url
    Specify a URL to request from the backend. 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.
    .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.
    .initial
    How many of the probes are considered good when Varnish starts. Defaults to the same amount as the threshold.
    .expected_response
    The expected backend HTTP response code. Defaults to 200.
    .interval
    Defines how often the probe should check the backend. Default is every 5 seconds.
    .timeout
    How fast each probe times out. Default is 2 seconds.

    A backend with a probe can be defined like this, together with the backend or director:

    backend www {
      .host = "www.example.com";
      .port = "http";
      .probe = {
        .url = "/test.jpg";
        .timeout = 0.3 s;
        .window = 8;
        .threshold = 3;
        .initial = 3;
      }
    }

    Or it can be defined separately and then referenced:

    probe healthcheck {
       .url = "/status.cgi";
       .interval = 60s;
       .timeout = 0.3 s;
       .window = 8;
       .threshold = 3;
       .initial = 3;
       .expected_response = 200;
    }
    
    backend www {
      .host = "www.example.com";
      .port = "http";
      .probe = healthcheck;
    }

    If you have many backends this can simplify the config a lot.

    It is also possible to specify the raw HTTP request:

    probe rawprobe {
        # NB: \r\n automatically inserted after each string!
        .request =
          "GET / HTTP/1.1"
          "Host: www.foo.bar"
          "Connection: close";
    }

    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);
    }

    Regular Expressions¶

    Varnish uses PCRE - Perl-compatible regular expressions. For a complete description of PCRE please see the pcre(3) man page.

    To send flags to the PCRE engine, such as to turn on case insensitivity 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$") {
            ...
    }

    Functions¶

    The following built-in functions are available:

    hash_data(str)
    Adds a string to the hash input. In default.vcl hash_data() is called on the host and URL of the request.
    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 regsuball() but this replaces all occurrences.
    ban(ban expression)
    Bans all objects in cache that match the expression.
    ban_url(regex)
    Bans all objects in cache whose URLs match regex.
    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;

    There are a number of special subroutines which hook into the Varnish workflow. These subroutines may inspect and manipulate HTTP headers and various other aspects of each request, and to a certain extent decide how the request should be handled. Each subroutine terminates by calling one of a small number of keywords which indicates the desired outcome.

    vcl_init

    Called when VCL is loaded, before any requests pass through it. Typically used to initialize VMODs.

    return() values:

    ok
    Normal return, VCL continues loading.
    vcl_recv

    Called at the beginning of a request, after the complete request has been received and parsed. Its purpose is to decide whether or not to serve the request, how to do it, and, if applicable, which backend to use.

    The vcl_recv subroutine may terminate with calling return() on one of the following keywords:

    error code [reason]
    Return the specified error code to the client and abandon the request.
    pass
    Switch to pass mode. Control will eventually pass to vcl_pass.
    pipe
    Switch to pipe mode. Control will eventually pass to vcl_pipe.
    lookup
    Look up the requested object in the cache. Control will eventually pass to vcl_hit or vcl_miss, depending on whether the object is in the cache. The bereq.request value will be set to GET regardless of the value of req.request.
    vcl_pipe

    Called upon entering pipe mode. In this mode, the request is passed on to the backend, and any further data from either client or backend is passed on unaltered until either end closes the connection.

    The vcl_pipe subroutine may terminate with calling return() with one of the following keywords:

    error code [reason]
    Return the specified error code to the client and abandon the request.
    pipe
    Proceed with pipe mode.
    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:

    error code [reason]
    Return the specified error code to the client and abandon the request.
    pass
    Proceed with pass mode.
    restart
    Restart the transaction. Increases the restart counter. If the number of restarts is higher than max_restarts varnish emits a guru meditation error.
    vcl_hash

    You may call hash_data() on the data you would like to add to the hash.

    The vcl_hash subroutine may terminate with calling return() with one of the following keywords:

    hash
    Proceed.
    vcl_hit

    Called after a cache lookup if the requested document was found in the cache.

    The vcl_hit subroutine may terminate with calling return() with one of the following keywords:

    deliver
    Deliver the cached object to the client. Control will eventually pass to vcl_deliver.
    error code [reason]
    Return the specified error code to the client and abandon the request.
    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.
    vcl_miss

    Called after a cache lookup if the requested document was not found in the cache. Its purpose is to decide whether or not to attempt to retrieve the document from the backend, and which backend to use.

    The vcl_miss subroutine may terminate with calling return() with one of the following keywords:

    error code [reason]
    Return the specified error code to the client and abandon the request.
    pass
    Switch to pass mode. Control will eventually pass to vcl_pass.
    fetch
    Retrieve the requested object from the backend. Control will eventually pass to vcl_fetch.
    vcl_fetch

    Called after a document has been successfully retrieved from the backend.

    The vcl_fetch subroutine may terminate with calling return() with one of the following keywords:

    deliver
    Possibly insert the object into the cache, then deliver it to the client. Control will eventually pass to vcl_deliver.
    error code [reason]
    Return the specified error code to the client and abandon the request.
    hit_for_pass
    Pass in fetch. This will create a hit_for_pass object. Note that the TTL for the hit_for_pass object will be set to what the current value of beresp.ttl. Control will be handled to vcl_deliver on the current request, but subsequent requests will go directly to vcl_pass based on the hit_for_pass object.
    restart
    Restart the transaction. Increases the restart counter. If the number of restarts is higher than max_restarts varnish emits a guru meditation error.
    vcl_deliver

    Called before a cached object is delivered to the client.

    The vcl_deliver subroutine may terminate with one of the following keywords:

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

    Called when we hit an error, either explicitly or implicitly due to backend or internal errors.

    The vcl_error subroutine may terminate by calling return with one of the following keywords:

    deliver
    Deliver the error object to the client.
    restart
    Restart the transaction. Increases the restart counter. If the number of restarts is higher than max_restarts varnish emits a guru meditation error.
    vcl_fini

    Called when VCL is discarded only after all requests have exited the VCL. Typically used to clean up VMODs.

    return() values:

    ok
    Normal return, VCL will be discarded.

    If one of these subroutines is left undefined or terminates without reaching a handling decision, control will be handed over to the builtin default. See the EXAMPLES section for a listing of the default code.

    Multiple subroutines¶

    If multiple subroutines with the the name of one of the builtin ones are defined, they are concatenated in the order in which they appear in the source. The default versions distributed with Varnish will be implicitly concatenated as a last resort at the end.

    Example:

    # in file "main.vcl"
    include "backends.vcl";
    include "ban.vcl";
    
    # in file "backends.vcl"
    sub vcl_recv {
      if (req.http.host ~ "(?i)example.com") {
        set req.backend = foo;
      } elsif (req.http.host ~ "(?i)example.org") {
        set req.backend = bar;
      }
    }
    
    # in file "ban.vcl"
    sub vcl_recv {
      if (client.ip ~ admin_network) {
        if (req.http.Cache-Control ~ "no-cache") {
          ban_url(req.url);
        }
      }
    }
    Variables¶

    Although subroutines take no arguments, the necessary information is made available to the handler subroutines through global variables.

    The following variables are always available:

    now
    The current time, in seconds since the epoch. When used in string context it returns a formatted string.

    The following variables are available in backend declarations:

    .host
    Host name or IP address of a backend.
    .port
    Service name or port number of a backend.

    The following variables are available while processing a request:

    client.ip
    The client's IP address.
    client.identity
    Identification of the client, used to load balance in the client director.
    server.hostname
    The host name of the server.
    server.identity
    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
    The IP address of the socket on which the client connection was received.
    server.port
    The port number of the socket on which the client connection was received.
    req.request
    The request type (e.g. "GET", "HEAD").
    req.url
    The requested URL.
    req.proto
    The HTTP protocol version used by the client.
    req.backend
    The backend to use to service the request.
    req.backend.healthy
    Whether the backend is healthy or not. Requires an active probe to be set on the backend.
    req.http.header
    The corresponding HTTP header.
    req.hash_always_miss
    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
    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.can_gzip
    Does the client accept the gzip transfer encoding.
    req.restarts
    A count of how many times this request has been restarted.
    req.esi
    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
    A count of how many levels of ESI requests we're currently at.
    req.grace
    Set to a period to enable grace.
    req.xid
    Unique ID of this request.

    The following variables are available while preparing a backend request (either for a cache miss or for pass or pipe mode):

    bereq.request
    The request type (e.g. "GET", "HEAD").
    bereq.url
    The requested URL.
    bereq.proto
    The HTTP protocol version used to talk to the server.
    bereq.http.header
    The corresponding HTTP header.
    bereq.connect_timeout
    The time in seconds to wait for a backend connection.
    bereq.first_byte_timeout
    The time in seconds to wait for the first byte from the backend. Not available in pipe mode.
    bereq.between_bytes_timeout
    The time in seconds to wait between each received byte from the backend. Not available in pipe mode.

    The following variables are available after the requested object has been retrieved from the backend, before it is entered into the cache. In other words, they are available in vcl_fetch:

    beresp.do_stream
    Deliver the object to the client directly without fetching the whole object into varnish. If this request is pass'ed it will not be stored in memory. As of Varnish Cache 3.0 the object will marked as busy as it is delivered so only client can access the object.
    beresp.do_esi
    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_gzip
    Boolean. Gzip the object before storing it. Defaults to false.
    beresp.do_gunzip
    Boolean. Unzip the object before storing it in the cache. Defaults to false.
    beresp.http.header
    The corresponding HTTP header.
    beresp.proto
    The HTTP protocol version used the backend replied with.
    beresp.status
    The HTTP status code returned by the server.
    beresp.response
    The HTTP status message returned by the server.
    beresp.ttl
    The object's remaining time to live, in seconds. beresp.ttl is writable.
    beresp.grace
    Set to a period to enable grace.
    beresp.saintmode
    Set to a period to enable saint mode.
    beresp.backend.name
    Name of the backend this response was fetched from.
    beresp.backend.ip
    IP of the backend this response was fetched from.
    beresp.backend.port
    Port of the backend this response was fetched from.
    beresp.storage
    Set to force Varnish to save this object to a particular storage backend.

    After the object is entered into the cache, the following (mostly read-only) variables are available when the object has been located in cache, typically in vcl_hit, or when constructing a synthetic reply in vcl_error:

    obj.proto
    The HTTP protocol version used when the object was retrieved.
    obj.status
    The HTTP status code returned by the server.
    obj.response
    The HTTP status message returned by the server.
    obj.ttl
    The object's remaining time to live, in seconds. obj.ttl is writable.
    obj.lastuse
    The approximate time elapsed since the object was last requests, in seconds. This variable is also available in vcl_deliver.
    obj.hits
    The approximate number of times the object has been delivered. A value of 0 indicates a cache miss. This variable is also available in vcl_deliver.
    obj.grace
    The object's grace period in seconds. obj.grace is writable.
    obj.http.header
    The corresponding HTTP header.

    The following variables are available while determining the hash key of an object:

    req.hash
    The hash key used to refer to an object in the cache. Used when both reading from and writing to the cache.

    The following variables are available while preparing a response to the client:

    resp.proto
    The HTTP protocol version to use for the response.
    resp.status
    The HTTP status code that will be returned.
    resp.response
    The HTTP status message that will be returned.
    resp.http.header
    The corresponding HTTP header.

    Values may be assigned to variables using the set keyword:

    sub vcl_recv {
      # Normalize the Host: header
      if (req.http.host ~ "(?i)^(www.)?example.com$") {
        set req.http.host = "www.example.com";
      }
    }

    HTTP headers can be removed entirely using the remove keyword:

    sub vcl_fetch {
      # Don't cache cookies
      remove beresp.http.Set-Cookie;
    }

    Grace and saint mode¶

    If the backend takes a long time to generate an object there is a risk of a thread pile up. In order to prevent this you can enable grace. This allows varnish to serve an expired version of the object while a fresh object is being generated by the backend.

    The following vcl code will make Varnish serve expired objects. All object will be kept up to two minutes past their expiration time or a fresh object is generated.

    sub vcl_recv {
      set req.grace = 2m;
    }
    sub vcl_fetch {
      set beresp.grace = 2m;
    }

    Saint mode is similar to grace mode and relies on the same infrastructure but functions differently. You can add VCL code to vcl_fetch to see whether or not you like the response coming from the backend. If you find that the response is not appropriate you can set beresp.saintmode to a time limit and call restart. Varnish will then retry other backends to try to fetch the object again.

    If there are no more backends or if you hit max_restarts and we have an object that is younger than what you set beresp.saintmode to be Varnish will serve the object, even if it is stale.

    EXAMPLES¶

    The following code is the equivalent of the default configuration with the backend address set to "backend.example.com" and no backend port specified:

    backend default {
     .host = "backend.example.com";
     .port = "http";
    }
    /*-
     * Copyright (c) 2006 Verdens Gang AS
     * Copyright (c) 2006-2011 Varnish Software AS
     * All rights reserved.
     *
     * Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     * 1. Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     * 2. Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE
     * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 
     * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
     * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     *
     * The default VCL code.
     *
     * NB! You do NOT need to copy & paste all of these functions into your
     * own vcl code, if you do not provide a definition of one of these
     * functions, the compiler will automatically fall back to the default
     * code from this file.
     *
     * This code will be prefixed with a backend declaration built from the
     * -b argument.
     */
    
    sub vcl_recv {
        if (req.restarts == 0) {
            if (req.http.x-forwarded-for) {
                set req.http.X-Forwarded-For =
                    req.http.X-Forwarded-For + ", " + client.ip;
            } else {
                set req.http.X-Forwarded-For = client.ip;
            }
        }
        if (req.request != "GET" &&
          req.request != "HEAD" &&
          req.request != "PUT" &&
          req.request != "POST" &&
          req.request != "TRACE" &&
          req.request != "OPTIONS" &&
          req.request != "DELETE") {
            /* Non-RFC2616 or CONNECT which is weird. */
            return (pipe);
        }
        if (req.request != "GET" && req.request != "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 (lookup);
    }
    
    sub vcl_pipe {
        # Note that only the first request to the backend will have
        # X-Forwarded-For set.  If you use X-Forwarded-For and want to
        # have it set for all requests, make sure to have:
        # set bereq.http.connection = "close";
        # here.  It is not set by default as it might break some broken web
        # applications, like IIS with NTLM authentication.
        return (pipe);
    }
    
    sub vcl_pass {
        return (pass);
    }
    
    sub vcl_hash {
        hash_data(req.url);
        if (req.http.host) {
            hash_data(req.http.host);
        } else {
            hash_data(server.ip);
        }
        return (hash);
    }
    
    sub vcl_hit {
        return (deliver);
    }
    
    sub vcl_miss {
        return (fetch);
    }
    
    sub vcl_fetch {
        if (beresp.ttl <= 0s ||
            beresp.http.Set-Cookie ||
            beresp.http.Vary == "*") {
                    /*
                     * Mark as "Hit-For-Pass" for the next 2 minutes
                     */
                    set beresp.ttl = 120 s;
                    return (hit_for_pass);
        }
        return (deliver);
    }
    
    sub vcl_deliver {
        return (deliver);
    }
    
    sub vcl_error {
        set obj.http.Content-Type = "text/html; charset=utf-8";
        set obj.http.Retry-After = "5";
        synthetic {"
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
      <head>
        <title>"} + obj.status + " " + obj.response + {"</title>
      </head>
      <body>
        <h1>Error "} + obj.status + " " + obj.response + {"</h1>
        <p>"} + obj.response + {"</p>
        <h3>Guru Meditation:</h3>
        <p>XID: "} + req.xid + {"</p>
        <hr>
        <p>Varnish cache server</p>
      </body>
    </html>
    "};
        return (deliver);
    }
    
    sub vcl_init {
            return (ok);
    }
    
    sub vcl_fini {
            return (ok);
    }
    
    

    The following example shows how to support multiple sites running on separate backends in the same Varnish instance, by selecting backends based on the request URL:

    backend www {
      .host = "www.example.com";
      .port = "80";
    }
    
    backend images {
      .host = "images.example.com";
      .port = "80";
    }
    
    sub vcl_recv {
      if (req.http.host ~ "(?i)^(www.)?example.com$") {
        set req.http.host = "www.example.com";
        set req.backend = www;
      } elsif (req.http.host ~ "(?i)^images.example.com$") {
        set req.backend = images;
      } else {
        error 404 "Unknown virtual host";
      }
    }

    The following snippet demonstrates how to force a minimum TTL for all documents. Note that this is not the same as setting the default_ttl run-time parameter, as that only affects document for which the backend did not specify a TTL:

    import std; # needed for std.log
    
    sub vcl_fetch {
      if (beresp.ttl < 120s) {
        std.log("Adjusting TTL");
        set beresp.ttl = 120s;
      }
    }

    The following snippet demonstrates how to force Varnish to cache documents even when cookies are present:

    sub vcl_recv {
      if (req.request == "GET" && req.http.cookie) {
         return(lookup);
      }
    }
    
    sub vcl_fetch {
      if (beresp.http.Set-Cookie) {
         return(deliver);
     }
    }

    The following code implements the HTTP PURGE method as used by Squid for object invalidation:

    acl purge {
      "localhost";
      "192.0.2.1"/24;
    }
    
    sub vcl_recv {
      if (req.request == "PURGE") {
        if (!client.ip ~ purge) {
          error 405 "Not allowed.";
        }
        return(lookup);
      }
    }
    
    sub vcl_hit {
      if (req.request == "PURGE") {
        purge;
        error 200 "Purged.";
      }
    }
    
    sub vcl_miss {
      if (req.request == "PURGE") {
        purge;
        error 200 "Purged.";
      }
    }

    SEE ALSO¶

    • varnishd(1)
    • vmod_std(7)

    HISTORY¶

    VCL was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS, Redpill Linpro and Varnish Software. This manual page was written by Dag-Erling Smørgrav and later edited by Poul-Henning Kamp and Per Buer.

    varnish-3.0.5/doc/sphinx/=build/html/reference/varnishlog.html0000644000175000017500000003215712247037213021341 00000000000000 varnishlog — Varnish version 3.0.5 documentation

    varnishlog¶

    Display Varnish logs¶

    Author:Dag-Erling Smørgrav
    Author:Per Buer
    Date:2010-05-31
    Version:0.2
    Manual section:1

    SYNOPSIS¶

    varnishlog [-a] [-b] [-C] [-c] [-D] [-d] [-I regex] [-i tag] [-k keep] [-n varnish_name] [-o] [-O] [-m tag:regex ...] [-P file] [-r file] [-s num] [-u] [-V] [-w file] [-X regex] [-x tag]

    DESCRIPTION¶

    The varnishlog utility reads and presents varnishd(1) shared memory logs.

    The following options are available:

    -a When writing to a file, append to it rather than overwrite it.
    -b Include log entries which result from communication with a backend server. If neither -b nor -c is specified, varnishlog acts as if they both were.
    -C Ignore case when matching regular expressions.
    -c Include log entries which result from communication with a client. If neither -b nor -c is specified, varnishlog acts as if they both were.
    -D Daemonize.
    -d Process old log entries on startup. Normally, varnishlog will only process entries which are written to the log after it starts.
    -I regex Include log entries which match the specified regular expression. If neither -I nor -i is specified, all log entries are included.
    -i tag Include log entries with the specified tag. If neither -I nor -i is specified, all log entries are included.
    -k num Only show the first num log records.
    -m tag:regex only list transactions where tag matches regex. Multiple
    -m options are AND-ed together. Can not be combined with -O
    -n Specifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used.
    -o Ignored for compatibility with earlier versions.
    -O Do not group log entries by request ID. Can not be combined with -m.
    -P file Write the process's PID to the specified file.
    -r file Read log entries from file instead of shared memory.
    -s num Skip the first num log records.
    -u Unbuffered output.
    -V Display the version number and exit.
    -w file Write log entries to file instead of displaying them. The file will be overwritten unless the -a option was specified. If varnishlog receives a SIGHUP while writing to a file, it will reopen the file, allowing the old one to be rotated away.
    -X regex Exclude log entries which match the specified regular expression.
    -x tag Exclude log entries with the specified tag.

    TAGS¶

    The following log entry tags are currently defined:

    • Backend
    • BackendClose
    • BackendOpen
    • BackendReuse
    • BackendXID
    • CLI
    • ClientAddr
    • Debug
    • Error
    • ExpBan
    • ExpKill
    • ExpPick
    • Hit
    • HitPass
    • HttpError
    • HttpGarbage
    • Length
    • ObjHeader
    • ObjLostHeader
    • ObjProtocol
    • ObjRequest
    • ObjResponse
    • ObjStatus
    • ObjURL
    • ReqEnd
    • ReqStart
    • RxHeader
    • RxLostHeader
    • RxProtocol
    • RxRequest
    • RxResponse
    • RxStatus
    • RxURL
    • SessionClose
    • SessionOpen
    • StatAddr
    • StatSess
    • TTL
    • TxHeader
    • TxLostHeader
    • TxProtocol
    • TxRequest
    • TxResponse
    • TxStatus
    • TxURL
    • VCL_acl
    • VCL_call
    • VCL_return
    • VCL_trace
    • WorkThread

    EXAMPLES¶

    The following command line simply copies all log entries to a log file:

    $ varnishlog -w /var/log/varnish.log

    The following command line reads that same log file and displays requests for the front page:

    $ varnishlog -r /var/log/varnish.log -c -m 'RxURL:^/$'

    SEE ALSO¶

    • varnishd(1)
    • varnishhist(1)
    • varnishncsa(1)
    • varnishstat(1)
    • varnishtop(1)

    HISTORY¶

    The varnishlog utility was developed by Poul-Henning Kamp ⟨phk@phk.freebsd.dk⟩ in cooperation with Verdens Gang AS, Varnish Software AS and Varnish Software. This manual page was initially written by Dag-Erling Smørgrav.

    Table Of Contents

    Previous topic

    varnishhist

    Next topic

    varnishncsa

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/reference/varnishreplay.html0000644000175000017500000001713612247037213022054 00000000000000 varnishreplay — Varnish version 3.0.5 documentation

    varnishreplay¶

    HTTP traffic replay tool¶

    Author:Cecilie Fritzvold
    Author:Per Buer
    Date:2010-05-31
    Version:1.0
    Manual section:1

    SYNOPSIS¶

    varnishreplay [-D] -a address:port -r file

    DESCRIPTION¶

    The varnishreplay utility parses varnish logs and attempts to reproduce the traffic. It is typcally used to warm up caches or various forms of testing.

    The following options are available:

    -a backend Send the traffic over tcp to this server, specified by an address and a port. This option is mandatory. Only IPV4 is supported at this time.
    -D Turn on debugging mode.
    -r file Parse logs from this file. This option is mandatory.

    SEE ALSO¶

    • varnishd(1)
    • varnishlog(1)

    HISTORY¶

    The varnishreplay utility and this manual page were written by Cecilie Fritzvold and later updated by Per Buer.

    Table Of Contents

    Previous topic

    varnishncsa

    Next topic

    varnishsizes

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/reference/varnishsizes.html0000644000175000017500000002476212247037213021720 00000000000000 varnishsizes — Varnish version 3.0.5 documentation

    varnishsizes¶

    Varnish object size request histogram¶

    Author:Dag Erling Smørgrav
    Author:Kristian Lyngstøl
    Author:Per Buer
    Date:2010-05-31
    Version:1.0
    Manual section:1

    SYNOPSIS¶

    varnishsizes [-b] [-C] [-c] [-d] [-I regex] [-i tag] [-m tag:regex ...]
    [-n varnish_name] [-r file] [-V] [-w delay] [-X regex] [-x tag]

    DESCRIPTION¶

    The varnishsizes 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 a logarithmic representation of bytes. Hits are marked with a pipe character ("|"), and misses are marked with a hash character ("#").

    The following options are available:

    -b Include log entries which result from communication with a backend server. If neither -b nor -c is specified, varnishsizes acts as if they both were.
    -C Ignore case when matching regular expressions.
    -c Include log entries which result from communication with a client. If neither -b nor -c is specified, varnishsizes acts as if they both were.
    -d Process old log entries on startup. Normally, varnishsizes will only process entries which are written to the log after it starts.
    -I regex Include log entries which match the specified regular expression. If neither -I nor -i is specified, all log entries are included.
    -i tag Include log entries with the specified tag. If neither -I nor -i is specified, all log entries are included.
    -m tag:regex only list record where tag matches regex. Multiple -m
    options are AND-ed together.
    -n Specifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used.
    -r file Read log entries from file instead of shared memory.
    -V Display the version number and exit.
    -w delay Wait at least delay seconds between each update. The default is 1. file instead of displaying them. The file will be overwritten unless the -a option was specified.
    -X regex Exclude log entries which match the specified regular expression.
    -x tag Exclude log entries with the specified tag.

    SEE ALSO¶

    • varnishd(1)
    • varnishlog(1)
    • varnishncsa(1)
    • varnishstat(1)
    • varnishtop(1)

    HISTORY¶

    The varnishsizes utility was developed by Kristian Lyngstøl based on varnishhist. This manual page was written by Kristian Lyngstøl, Dag-Erling Smørgrav and Per Buer.

    Table Of Contents

    Previous topic

    varnishreplay

    Next topic

    varnishstat

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/reference/varnishadm.html0000644000175000017500000002343512247037213021320 00000000000000 varnishadm — Varnish version 3.0.5 documentation

    varnishadm¶

    Control a running varnish instance¶

    Author:Cecilie Fritzvold
    Author:Per Buer
    Date:2010-05-31
    Version:0.3
    Manual section:1

    SYNOPSIS¶

    varnishadm [-t timeout] [-S secret_file] [-T address:port] [-n name] [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¶

    -t timeout Wait no longer than this many seconds for an operation to finish.
    -S secret_file 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 address:port
    Connect to the management interface at the specified address and port.
    -n name Connect to the instance of varnishd with this name.

    The syntax and operation of the actual CLI interface is described in the varnish-cli(7) manual page. Parameteres are described in 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¶

    • varnishd(1)

    HISTORY¶

    The varnishadm utility and this manual page were written by Cecilie Fritzvold. Converted to reStructured and updated in 2010 by Per Buer.

    Table Of Contents

    Previous topic

    varnish

    Next topic

    varnishd

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/reference/varnishtop.html0000644000175000017500000002732012247037213021356 00000000000000 varnishtop — Varnish version 3.0.5 documentation

    varnishtop¶

    Varnish log entry ranking¶

    Author:Dag-Erling Smørgrav
    Date:2010-05-31
    Version:1.0
    Manual section:1

    SYNOPSIS¶

    varnishtop [-1] [-b] [-C] [-c] [-d] [-f] [-I regex] [-i tag] [-n varnish_name] [-r file] [-V] [-X regex] [-x tag]

    DESCRIPTION¶

    The varnishtop utility reads 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:

    -1 Instead of presenting of a continuously updated display, print the statistics once and exit. Implies -d.
    -b Include log entries which result from communication with a backend server. If neither -b nor -c is specified, varnishtop acts as if they both were.
    -C Ignore case when matching regular expressions.
    -c Include log entries which result from communication with a client. If neither -b nor -c is specified, varnishtop acts as if they both were.
    -d Process old log entries on startup. Normally, varnishtop will only process entries which are written to the log after it starts.
    -f Sort and group only on the first field of each log entry. This is useful when displaying e.g. stataddr entries, where the first field is the client IP address.
    -I regex Include log entries which match the specified regular expression. If neither -I nor -i is specified, all log entries are included.
    -i tag Include log entries with the specified tag. If neither -I nor -i is specified, all log entries are included.
    -p period Specifies the number of seconds to measure over, the default is 60 seconds. The first number in the list is the average number of requests seen over this time period.
    -n Specifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used.
    -r file Read log entries from file instead of shared memory.
    -V Display the version number and exit.
    -X regex Exclude log entries which match the specified regular expression.
    -x tag Exclude log entries with the specified tag.

    EXAMPLES¶

    The following example displays a continuously updated list of the most frequently requested URLs:

    varnishtop -i RxURL

    The following example displays a continuously updated list of the most commonly used user agents:

    varnishtop -i RxHeader -C -I ^User-Agent

    SEE ALSO¶

    • varnishd(1)
    • varnishhist(1)
    • varnishlog(1)
    • varnishncsa(1)
    • 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.

    Table Of Contents

    Previous topic

    varnishtest

    Next topic

    Shared Memory Logging and Statistics

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/reference/varnishncsa.html0000644000175000017500000003060512247037213021500 00000000000000 varnishncsa — Varnish version 3.0.5 documentation

    varnishncsa¶

    Display Varnish logs in Apache / NCSA combined log format¶

    Author:Dag-Erling Smørgrav
    Date:2010-05-31
    Version:1.0
    Manual section:1

    SYNOPSIS¶

    varnishncsa [-a] [-C] [-D] [-d] [-f] [-F format] [-I regex] [-i tag] [-n varnish_name] [-m tag:regex ...] [-P file] [-r file] [-V] [-w file] [-X regex] [-x tag]

    DESCRIPTION¶

    The varnishncsa utility reads varnishd(1) shared memory logs and presents them in the Apache / NCSA "combined" log format.

    The following options are available:

    -a When writing to a file, append to it rather than overwrite it.
    -C Ignore case when matching regular expressions.
    -D Daemonize.
    -d Process old log entries on startup. Normally, varnishncsa will only process entries which are written to the log after it starts.
    -f Prefer the X-Forwarded-For HTTP header over client.ip in the log output.
    -F format

    Specify the log format used. If no format is specified the default log format is used. Currently it 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.
    %H
    The request protocol. Defaults to HTTP/1.0 if not known.
    %h
    Remote host. Defaults to '-' if not known. Defaults to 127.0.0.1 for backend requests.
    %{X}i
    The contents of request header X.
    %l
    Remote logname (always '-')
    %m
    Request method. Defaults to '-' if not known.
    %q
    The query string, if no query string exists, an empty string.
    %{X}o
    The contents of response header X.
    %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).
    %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 to the first byte from the backend arrived
    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 error.
    VCL_Log:key
    Output value set by std.log("key:value") in VCL.
    -m tag:regex only list records where tag matches regex. Multiple
    -m options are AND-ed together.
    -n Specifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used.
    -P file Write the process's PID to the specified file.
    -r file Read log entries from file instead of shared memory.
    -V Display the version number and exit.
    -w file

    Write log entries to file instead of displaying them. The file will be overwritten unless the -a option was specified.

    If varnishncsa receives a SIGHUP while writing to a file, it will reopen the file, allowing the old one to be rotated away.

    -X regex Exclude log entries which match the specified regular expression.
    -x tag Exclude log entries with the specified tag.

    If the -o option was specified, a tag and a regex argument must be given. varnishncsa will then only log for request groups which include that tag and the regular expression matches on that tag.

    SEE ALSO¶

    • varnishd(1)
    • varnishhist(1)
    • varnishlog(1)
    • varnishstat(1)
    • varnishtop(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 written by Dag-Erling Smørgrav ⟨des@des.no⟩.

    Table Of Contents

    Previous topic

    varnishlog

    Next topic

    varnishreplay

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/reference/varnish-cli.html0000644000175000017500000004613712247037213021407 00000000000000 varnish — Varnish version 3.0.5 documentation

    varnish¶

    Varnish Command Line Interface¶

    Author:Per Buer
    Date:2011-03-23
    Version:0.1
    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 lastst 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(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 choosen 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 lenght. When using newline-terminated commands maximum lenght 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, carrage 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¶

    backend.list
    Lists the defined backends including health state.
    backend.set_health matcher state
    Sets the health state on a specific backend. This is useful if you want to take a certain backend out of sirculations.
    ban field operator argument [&& field operator argument [...]]
    Immediately invalidate all documents matching the ban expression. See Ban Expressions for more documentation and examples.
    ban.list

    All requests for objects from the cache are matched against items on the ban list. If an object in the cache is older than a matching ban list item, it is considered "banned", and will be fetched from the backend instead.

    When a ban expression is older than all the objects in the cache, it is removed from the list.

    ban.list displays the ban list. The output looks something like this (broken into two lines):

    0x7fea4fcb0580 1303835108.618863 131G req.http.host ~ www.myhost.com && req.url ~ /some/url

    The first field is the address of the ban.

    The second is the time of entry into the list, given as a high precision timestamp.

    The third field describes many objects point to this ban. When an object is compared to a ban the object is marked with a reference to the newest ban it was tested against. This isn't really useful unless you're debugging.

    A "G" marks that the ban is "Gone". Meaning it has been marked as a duplicate or it is no longer valid. It stays in the list for effiency reasons.

    Then follows the actual ban it self.

    ban.url regexp
    Immediately invalidate all documents whose URL matches the specified regular expression. Please note that the Host part of the URL is ignored, so if you have several virtual hosts all of them will be banned. Use ban to specify a complete ban if you need to narrow it down.
    help [command]
    Display a list of available commands. If the command is specified, display help for this command.
    param.set param value
    Set the parameter specified by param to the specified value. See Run-Time Parameters for a list of parame†ters.
    param.show [-l] [param]

    Display a list if run-time parameters and their values.

    If the -l option is specified, the list includes a brief explanation of each parameter.

    If a param is specified, display only the value and explanation for this parameter.

    ping [timestamp]
    Ping the Varnish cache process, keeping the connection alive.
    quit
    Close the connection to the varnish admin port.
    start
    Start the Varnish cache process if it is not already running.
    status
    Check the status of the Varnish cache process.
    stop
    Stop the Varnish cache process.
    storage.list
    Lists the defined storage backends.
    vcl.discard configname
    Discard the configuration specified by configname. This will have no effect if the specified configuration has a non-zero reference count.
    vcl.inline configname vcl
    Create a new configuration named configname with the VCL code specified by vcl, which must be a quoted string.
    vcl.list
    List available configurations and their respective reference counts. The active configuration is indicated with an asterisk ("*").
    vcl.load configname filename
    Create a new configuration named configname with the contents of the specified file.
    vcl.show configname
    Display the source code for the specified configuration.
    vcl.use configname
    Start using the configuration specified by configname for all new requests. Existing requests will con†tinue using whichever configuration was in use when they arrived.

    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 comparision, "~" 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.

    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.

    Details on authentication¶

    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 reponse 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 name does not end with ".ogg", and where the size of the object is greater than 10 megabytes:

    req.url !~ "\.ogg$" && obj.size > 10MB

    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"

    SEE ALSO¶

    • varnishd(1)
    • vanrishadm(1)
    • vcl(7)

    HISTORY¶

    The varnish manual page was written by Per Buer in 2011. Some of the text was taken from the Varnish Cache wiki, the varnishd(7) man page or the varnish source code.

    Table Of Contents

    Previous topic

    VCL

    Next topic

    varnishadm

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/reference/vmod_std.html0000644000175000017500000003072412247037213021002 00000000000000 vmod_std — Varnish version 3.0.5 documentation

    vmod_std¶

    Varnish Standard Module¶

    Author:Per Buer
    Date:2011-05-19
    Version:1.0
    Manual section:3

    SYNOPSIS¶

    import std

    DESCRIPTION¶

    The Varnish standard module contains useful, generic function that don't quite fit in the VCL core, but are still considered very useful to a broad audience.

    FUNCTIONS¶

    toupper¶

    Prototype
    toupper(STRING s)
    Return value
    String
    Description
    Converts the string s to upper case.
    Example
    set beresp.http.x-scream = std.toupper("yes!");

    tolower¶

    Prototype
    tolower(STRING s)
    Return value
    String
    Description
    Converts the string s to lower case.
    Example
    set beresp.http.x-nice = std.tolower("VerY");

    set_ip_tos¶

    Prototype
    set_ip_tos(INT i)
    Return value
    Void
    Description
    Sets the Type-of-Service flag for the current session. Please note that the TOS flag 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(0x0);
    }

    random¶

    Prototype
    random(REAL a, REAL b)
    Return value
    Real
    Description
    Returns a random REAL number between a and b.
    Example
    set beresp.http.x-random-number = std.random(1, 100);

    log¶

    Prototype
    log(STRING string)
    Return value
    Void
    Description
    Logs string to the shared memory log.
    Example
    std.log("Something fishy is going on with the vhost " + req.host);

    syslog¶

    Prototype
    syslog(INT priority, STRING string)
    Return value
    Void
    Description
    Logs string to syslog marked with priority.
    Example
    std.syslog( LOG_USER|LOG_ALERT, "There is serious troble");

    fileread¶

    Prototype
    fileread(STRING filename)
    Return value
    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.x-served-by = std.fileread("/etc/hostname");

    duration¶

    Prototype
    duration(STRING s, DURATION fallback)
    Return value
    Duration
    Description
    Converts the string s to seconds. s can be quantified with the usual s (seconds), m (minutes), h (hours), d (days) and w (weeks) units. If s fails to parse, fallback will be used.
    Example
    set beresp.ttl = std.duration("1w", 3600s);

    integer¶

    Prototype
    integer(STRING s, INT fallback)
    Return value
    Int
    Description
    Converts the string s to an integer. If s fails to parse, fallback will be used
    Example
    if (std.integer(beresp.http.x-foo, 0) > 5) { ... }

    collect¶

    Prototype
    collect(HEADER header)
    Return value
    Void
    Description
    Collapses the header, joining the headers into one.
    Example
    std.collect(req.http.cookie); This will collapse several Cookie: headers into one, long cookie header.

    SEE ALSO¶

    • vcl(7)
    • varnishd(1)

    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.

    Table Of Contents

    Previous topic

    VMOD - Varnish Modules

    Next topic

    Shared Memory Logging

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/reference/varnishstat.html0000644000175000017500000002455212247037213021533 00000000000000 varnishstat — Varnish version 3.0.5 documentation

    varnishstat¶

    Varnish Cache statistics¶

    Author:Dag-Erling Smørgrav
    Author:Per Buer
    Author:Lasse Karstensen
    Date:2011-11-07
    Version:1.1
    Manual section:1

    SYNOPSIS¶

    varnishstat [-1] [-x] [-j] [-f field_list] [-l] [-n varnish_name] [-V] [-w delay]

    DESCRIPTION¶

    The varnishstat utility displays statistics from a running varnishd(1) instance.

    The following options are available:

    -1 Instead of presenting of a continuously updated display, print the statistics to stdout.
    -f A comma separated list of the fields to display. If it starts with '^' it is used as an exclusion list.
    -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.
    -V Display the version number and exit.
    -w delay Wait delay seconds between updates. The default is 1. Can also be used with -1, -x or -j for repeated output.
    -x Displays the result as XML.
    -j Displays the result as JSON.

    The columns in the main display are, from left to right:

    1. Value
    2. Per-second average in the period since last update, or a period if the value can not be averaged
    3. Per-second average over process lifetime, or a period if the value can not be averaged
    4. Descriptive text

    When using the -1 option, the columns in the output are, from left to right:

    1. Symbolic entry name
    2. Value
    3. Per-second average over process lifetime, or a period if the value can not be averaged
    4. Descriptive text

    When using the -x option, the output is:

    <stat>
      <name>FIELD NAME</name>
      <value>FIELD VALUE</value>
      <description>FIELD DESCRIPTION</description>
    </stat>

    With -j the output format is:

    {
      "timestamp": "YYYY-MM-DDTHH:mm:SS",
      "client_conn": {
          "value": 0, "flag": "a",
          "description": "Client connections accepted"
      },
      "client_drop": {
          "value": 0, "flag": "a",
          "description": "Connection dropped, no sess/wrk"
      },
      "LCK.backend.creat": {
          "type": "LCK", "ident": "backend", "value": 1,
          "flag": "a", "description": "Created locks"
      },
      [..]
    }

    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¶

    • varnishd(1)
    • varnishhist(1)
    • varnishlog(1)
    • varnishncsa(1)
    • varnishtop(1)
    • curses(3)

    HISTORY¶

    The varnishstat utility was originally developed by Poul-Henning Kamp ⟨phk@phk.freebsd.dk⟩ in cooperation with Verdens Gang AS, Varnish Software AS and Varnish Software. Manual page written by Dag-Erling Smørgrav, and Per Buer.

    Table Of Contents

    Previous topic

    varnishsizes

    Next topic

    varnishtest

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/reference/varnishd.html0000644000175000017500000013261112247037213020777 00000000000000 varnishd — Varnish version 3.0.5 documentation

    varnishd¶

    HTTP accelerator daemon¶

    Author:Dag-Erling Smørgrav
    Author:Stig Sandbeck Mathisen
    Author:Per Buer
    Date:2010-05-31
    Version:1.0
    Manual section:1

    SYNOPSIS¶

    varnishd [-a address[:port]] [-b host[:port]] [-d] [-F] [-f config]
    [-g group] [-h type[,options]] [-i identity] [-l shmlogsize] [-n name] [-P file] [-p param=value] [-s type[,options]] [-T address[:port]] [-t ttl] [-u user] [-V] [-w min[,max[,timeout]]]

    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][,address[:port][...]
    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, the default HTTP port as listed in /etc/services is used. Multiple listening addresses and ports can be speci†fied as a whitespace- or comma-separated list.
    -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 Run in the foreground.
    -f config Use the specified VCL configuration file instead of the builtin default. See vcl(7) for details on VCL syntax. When no configuration is supplied varnishd will not start the cache process.
    -g group Specifies the name of an unprivileged group to which the child process should switch before it starts accepting connections. This is a shortcut for specifying the group run-time parameter.
    -h type[,options]
    Specifies the hash algorithm. See Hash Algorithms for a list of supported algorithms.
    -i identity Specify the identity of the varnish server. This can be accessed using server.identity from VCL
    -l shmlogsize Specify size of shmlog file. Scaling suffixes like 'k', 'm' can be used up to (e)tabytes. Default is 80 Megabytes. Specifying less than 8 Megabytes is unwise.
    -n name Specify a name for this instance. Amonst 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 process's PID to the specified file.
    -p param=value
    Set the parameter specified by param to the specified value. See Run-Time Parameters for a list of parameters. This option can be used multiple times to specify multiple parameters.
    -S file Path to a file containing a secret used for authorizing access to the management port.
    -s [name=]type[,options]
    Use the specified storage backend. See Storage Types for a list of supported storage types. This option can be used multiple times to specify multiple storage files. You can name the different backends. Varnish will then reference that backend with the given name in logs, statistics, etc.
    -T address[:port]
    Offer a management interface on the specified address and port. See Management Interface for a list of management commands.
    -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.
    -t ttl Specifies a hard minimum time to live for cached documents. This is a shortcut for specifying the default_ttl run-time parameter.
    -u user

    Specifies the name of an unprivileged user to which the child process should switch before it starts accepting connections. This is a shortcut for specifying the user run- time parameter.

    If specifying both a user and a group, the user should be specified first.

    -V Display the version number and exit.

    -w min[,max[,timeout]]

    Start at least min but no more than max worker threads with the specified idle timeout. This is a shortcut for specifying the thread_pool_min, thread_pool_max and thread_pool_timeout run-time parameters.

    If only one number is specified, thread_pool_min and thread_pool_max are both set to this number, and thread_pool_timeout has no effect.

    Hash Algorithms¶

    The following hash algorithms are available:

    simple_list
    A simple doubly-linked list. Not recommended for production use.
    classic[,buckets]
    A standard hash table. This is the default. 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.
    critbit
    A self-scaling tree structure. The default hash algorithm in 2.1. In comparison to a more traditional B tree the critbit tree is almost completely lockless.

    Storage Types¶

    The following storage types are available:

    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 approximately 1k of memory per object will be used for various internal structures.

    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.

    Mallocs performance is bound by memory speed so it is very fast.

    file[,path[,size[,granularity]]]

    The file backend stores objects in memory backed by a file on disk with mmap. This is the default storage backend and unless you specify another storage this one will used along with Transient storage.

    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 fol†lowed 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 size is expressed as a percentage of the free space on the
    file system where it resides.

    The default size is 50%.

    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. 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 size is assumed to be in bytes, unless followed by one of the suffixes described for size except for %.

    The default size is the VM page size. The size should be reduced if you have many small objects.

    File performance is typically limited by the write speed of the device, and depending on use, the seek time.

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

    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.

    Transient Storage¶

    If you name any of your storage backend "Transient" it will be used for transient (short lived) objects. By default Varnish would use an unlimited malloc backend for this.

    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¶

    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.

    Here is a list of all parameters, current as of last time we remembered to update the manual page. This text is produced from the same text you will find in the CLI if you use the param.show command, so should there be a new parameter which is not listed here, you can find the description using the CLI commands.

    Be aware that on 32 bit systems, certain default values, such as workspace_client (=16k), thread_pool_workspace (=16k), http_resp_size (=8k), http_req_size (=12k), gzip_stack_buffer (=4k) and thread_pool_stack (=64k) are reduced relative to the values listed here, in order to conserve VM space.

    acceptor_sleep_decay
    • Default: 0.900
    • 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 succesfull accept. (ie: 0.9 = reduce by 10%)

    acceptor_sleep_incr
    • Units: s
    • Default: 0.001
    • 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: s
    • Default: 0.050
    • 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

    Restart child process automatically if it dies.

    ban_dups
    • Units: bool
    • Default: on

    Detect and eliminate duplicate bans.

    ban_lurker_sleep
    • Units: s
    • Default: 0.01

    How long time does the ban lurker thread sleeps between successful attempts to push the last item up the ban list. It always sleeps a second when nothing can be done. A value of zero disables the ban lurker.

    between_bytes_timeout
    • Units: s
    • Default: 60

    Default timeout between bytes when receiving data from backend. We only wait for this many seconds between bytes before giving up. A value of 0 means it will never time out. VCL can override this default value for each backend request and backend request. This parameter does not apply to pipe.

    cc_command
    • Default: exec gcc -std=gnu99 -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: 8192

    Size of buffer for CLI 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_timeout
    • Units: seconds
    • Default: 10

    Timeout for the childs replies to CLI requests from the master.

    clock_skew
    • Units: s
    • Default: 10

    How much clockskew we are willing to accept between the backend and our own clock.

    connect_timeout
    • Units: s
    • Default: 0.7

    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: s
    • Default: 180.0
    • Flags:

    How long time the critbit hasher keeps deleted objheads on the cooloff list.

    default_grace
    • Units: seconds
    • Default: 10
    • Flags: delayed

    Default grace period. We will deliver an object this long after it has expired, provided another thread is attempting to get a new copy. Objects already cached will not be affected by changes made until they are fetched from the backend again.

    default_keep
    • Units: seconds
    • Default: 0
    • Flags: delayed

    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

    The TTL assigned to objects if neither the backend nor the VCL code assigns one. Objects already cached will not be affected by changes made until they are fetched from the backend again. To force an immediate effect at the expense of a total flush of the cache use "ban.url ."

    diag_bitmap
    • Units: bitmap
    • Default: 0

    Bitmap controlling diagnostics code:

    0x00000001 - CNT_Session states.
    0x00000002 - workspace debugging.
    0x00000004 - kqueue debugging.
    0x00000008 - mutex logging.
    0x00000010 - mutex contests.
    0x00000020 - waiting list.
    0x00000040 - object workspace.
    0x00001000 - do not core-dump child process.
    0x00002000 - only short panic message.
    0x00004000 - panic to stderr.
    0x00010000 - synchronize shmlog.
    0x00020000 - synchronous start of persistence.
    0x00040000 - release VCL early.
    0x00080000 - ban-lurker debugging.
    0x80000000 - do edge-detection on digest.

    Use 0x notation and do the bitor in your head :-)

    esi_syntax
    • Units: bitmap
    • Default: 0

    Bitmap controlling ESI parsing code:

    0x00000001 - Don't check if it looks like XML
    0x00000002 - Ignore non-esi elements
    0x00000004 - Emit parsing debug records
    0x00000008 - Force-split parser input (debugging)

    Use 0x notation and do the bitor in your head :-)

    expiry_sleep
    • Units: seconds
    • Default: 1

    How long the expiry thread sleeps when there is nothing for it to do.

    fetch_chunksize
    • Units: kilobytes
    • Default: 128
    • 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: kilobytes
    • Default: 262144
    • 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: s
    • Default: 60

    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.

    group
    • Default: magic
    • Flags: must_restart

    The unprivileged group to run as.

    gzip_level
    • Default: 6

    Gzip compression level: 0=debug, 1=fast, 9=best

    gzip_memlevel
    • Default: 8

    Gzip memory level 1=slow/least, 9=fast/most compression. Memory impact is 1=1k, 2=2k, ... 9=256k.

    gzip_stack_buffer
    • Units: Bytes
    • Default: 32768
    • Flags: experimental

    Size of stack buffer used for gzip processing. The stack 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_tmp_space
    • Default: 0
    • Flags: experimental

    Where temporary space for gzip/gunzip is allocated:

    0 - malloc
    1 - session workspace
    2 - thread workspace

    If you have much gzip/gunzip activity, it may be an advantage to use workspace for these allocations to reduce malloc activity. Be aware that gzip needs 256+KB and gunzip needs 32+KB of workspace (64+KB if ESI processing).

    gzip_window
    • Default: 15

    Gzip window size 8=least, 15=most compression. Memory impact is 8=1k, 9=2k, ... 15=128k.

    http_gzip_support
    • Units: bool
    • Default: on
    • Flags: experimental

    Enable gzip support. When enabled Varnish will compress uncompressed objects before they are stored in the cache. 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

    Maximum number of HTTP headers we will deal with in client request or backend reponses. Note that the first line occupies five header fields. This paramter does not influence storage consumption, objects allocate exact space for the headers they store.

    http_range_support
    • Units: bool
    • Default: on

    Enable support for HTTP Range headers.

    http_req_hdr_len
    • Units: bytes
    • Default: 8192

    Maximum length of any HTTP client request header we will allow. The limit is inclusive its continuation lines.

    http_req_size
    • Units: bytes
    • Default: 32768

    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 session workspace (param: sess_workspace) and this parameter limits how much of that the request is allowed to take up.

    http_resp_hdr_len
    • Units: bytes
    • Default: 8192

    Maximum length of any HTTP backend response header we will allow. The limit is inclusive its continuation lines.

    http_resp_size
    • Units: bytes
    • Default: 32768

    Maximum number of bytes of HTTP backend resonse 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 worker workspace (param: sess_workspace) and this parameter limits how much of that the request is allowed to take up.

    idle_send_timeout
    • Units: seconds
    • Default: 60
    • 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_address
    • Default: :80
    • Flags: must_restart

    Whitespace separated list of network endpoints where Varnish will accept requests. Possible formats: host, host:port, :port

    listen_depth
    • Units: connections
    • Default: 1024
    • Flags: must_restart

    Listen queue depth.

    log_hashstring
    • Units: bool
    • Default: on

    Log the hash string components to shared memory log.

    log_local_address
    • Units: bool
    • Default: off

    Log the local address on the TCP connection in the SessionOpen shared memory record.

    lru_interval
    • Units: seconds
    • Default: 2
    • 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

    Maximum depth of esi:include processing.

    max_restarts
    • Units: restarts
    • Default: 4

    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.

    nuke_limit
    • Units: allocations
    • Default: 50
    • Flags: experimental

    Maximum number of objects we attempt to nuke in orderto make space for a object body.

    pcre_match_limit
    • Default: 10000

    The limit for the number of internal matching function calls in a pcre_exec() execution.

    pcre_match_limit_recursion
    • Default: 10000

    The limit for the number of internal matching function recursions in a pcre_exec() execution.

    ping_interval
    • Units: seconds
    • Default: 3
    • 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

    Idle timeout for PIPE sessions. If nothing have been received in either direction for this many seconds, the session is closed.

    prefer_ipv6
    • Units: bool
    • Default: off

    Prefer IPv6 address when connecting to backends which have both IPv4 and IPv6 addresses.

    queue_max
    • Units: %
    • Default: 100
    • Flags: experimental

    Percentage permitted queue length.

    This sets the ratio of queued requests to worker threads, above which sessions will be dropped instead of queued.

    rush_exponent
    • Units: requests per request
    • Default: 3
    • 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.

    saintmode_threshold
    • Units: objects
    • Default: 10
    • Flags: experimental

    The maximum number of objects held off by saint mode before no further will be made to the backend until one times out. A value of 0 disables saintmode.

    send_timeout
    • Units: seconds
    • Default: 600
    • 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.

    sess_timeout
    • Units: seconds
    • Default: 5

    Idle timeout for persistent sessions. If a HTTP request has not been received in this many seconds, the session is closed.

    sess_workspace
    • Units: bytes
    • Default: 65536
    • Flags: delayed

    Bytes of HTTP protocol workspace allocated for sessions. This space must be big enough for the entire HTTP protocol header and any edits done to it in the VCL code. Minimum is 1024 bytes.

    session_linger
    • Units: ms
    • Default: 50
    • Flags: experimental

    How long time the workerthread lingers on the session to see if a new request appears right away. If 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.

    session_max
    • Units: sessions
    • Default: 100000

    Maximum number of sessions we will allocate 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: 255

    Maximum number of bytes in SHM log record. Maximum is 65535 bytes.

    shm_workspace
    • Units: bytes
    • Default: 8192
    • Flags: delayed

    Bytes of shmlog workspace allocated for worker threads. If too big, it wastes some ram, if too small it causes needless flushes of the SHM workspace. These flushes show up in stats as "SHM flushes due to overflow". Minimum is 4096 bytes.

    shortlived
    • Units: s
    • Default: 10.0

    Objects created with TTL shorter than this are always put in transient storage.

    syslog_cli_traffic
    • Units: bool
    • Default: on

    Log all CLI traffic to syslog(LOG_INFO).

    thread_pool_add_delay
    • Units: milliseconds
    • Default: 2

    Wait at least this long between creating threads.

    Setting this too long results in insuffient worker threads.

    Setting this too short increases the risk of worker thread pile-up.

    thread_pool_add_threshold
    • Units: requests
    • Default: 2
    • Flags: experimental

    Overflow threshold for worker thread creation.

    Setting this too low, will result in excess worker threads, which is generally a bad idea.

    Setting it too high results in insuffient worker threads.

    thread_pool_fail_delay
    • Units: milliseconds
    • Default: 200
    • 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 RAM resources for thread stacks. This delay tries to not rush it 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: 500
    • Flags: delayed, experimental

    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: 5
    • Flags: delayed, experimental

    The minimum number of worker threads in each pool.

    Increasing this may help ramp up faster from low load situations where threads have expired.

    Minimum is 2 threads.

    thread_pool_purge_delay
    • Units: milliseconds
    • Default: 1000
    • Flags: delayed, experimental

    Wait this long between purging threads.

    This controls the decay of thread pools when idle(-ish).

    Minimum is 100 milliseconds.

    thread_pool_stack
    • Units: bytes
    • Default: -1
    • Flags: experimental

    Worker thread stack size. On 32bit systems you may need to tweak this down to fit many threads into the limited address space.

    thread_pool_timeout
    • Units: seconds
    • Default: 300
    • Flags: delayed, experimental

    Thread idle threshold.

    Threads in excess of thread_pool_min, which have been idle for at least this long are candidates for purging.

    Minimum is 1 second.

    thread_pool_workspace
    • Units: bytes
    • Default: 65536
    • Flags: delayed

    Bytes of HTTP protocol workspace allocated for worker threads. This space must be big enough for the backend request and responses, and response to the client plus any other memory needs in the VCL code.Minimum is 1024 bytes.

    thread_pools
    • Units: pools
    • Default: 2
    • 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_stats_rate
    • Units: requests
    • Default: 10
    • Flags: experimental

    Worker threads accumulate statistics, and dump these into the global stats counters if the lock is free when they finish a request. This parameters defines the maximum number of requests a worker thread may handle, before it is forced to dump its accumulated stats into the global counters.

    user
    • Default: magic
    • Flags: must_restart

    The unprivileged user to run as. Setting this will also set "group" to the specified user's primary group.

    vcc_err_unref
    • Units: bool
    • Default: on

    Unreferenced VCL objects result in error.

    vcl_dir
    • Default: /usr/local/etc/varnish

    Directory from which relative VCL filenames (vcl.load and include) are opened.

    vcl_trace
    • Units: bool
    • Default: off

    Trace VCL execution in the shmlog. Enabling this will allow you to see the path each request has taken through the VCL program. This generates a lot of logrecords so it is off by default.

    vmod_dir
    • Default: /usr/local/lib/varnish/vmods

    Directory where VCL modules are to be found.

    waiter
    • Default: default
    • Flags: must_restart, experimental

    Select the waiter kernel interface.

    SEE ALSO¶

    • varnish-cli(7)
    • varnishlog(1)
    • varnishhist(1)
    • varnishncsa(1)
    • varnishstat(1)
    • varnishtop(1)
    • vcl(7)

    HISTORY¶

    The varnishd daemon was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS, Varnish Software AS and Varnish Software.

    This manual page was written by Dag-Erling Smørgrav with updates by Stig Sandbeck Mathisen ⟨ssm@debian.org⟩

    Table Of Contents

    Previous topic

    varnishadm

    Next topic

    varnishhist

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/glossary/0000755000175000017500000000000012247037213016254 500000000000000varnish-3.0.5/doc/sphinx/=build/html/glossary/index.html0000644000175000017500000001675312247037213020205 00000000000000 Varnish Glossary — Varnish version 3.0.5 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_fetch.
    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 a HTTP request, typically a browser, but do not forget to think about spiders, robots script-kiddies and criminals.
    header
    A 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 proces is a manager/nanny process which handles configuration, parameters, compilation of :term:VCL etc. but it does never get near the actual HTTP traffic.
    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 reponse 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 responsetime histogram in 1980ies 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-3.0.5/doc/sphinx/=build/html/objects.inv0000644000175000017500000000324212247037213016501 00000000000000# Sphinx inventory version 2 # Project: Varnish # Version: 3.0.5 # The remainder of this file is compressed using zlib. xÚµXmoÛ6þî_A`EÓa£Ó¡@?ôKÐ5E ‚9k€AK‰3%ª$åÄýõ;¾I²,uR‹}I¤{#y÷ÜÓ+^Ñ&}g@„þF2!µfjÊËž—¹)ÄOVG_ºÐF*–ÁRpm¼<‚‚2ÓS%×9Mï8GêébÃÊù1Ð)úËÍ?˜éûÎATä>‘EÁÊôaÖªÖ•OŒô¥æóvm—¯˜ÖÓ7»‘é~†5K¶€[S +Yê‰Å ^´ñ¢‹]"¦¯ú$ÕyU)™€Ö?Oóô^48ÙºðEÄ .u.ŸH"ËGž•¬€Y•@jýiÇŸ.æåÍíÃG׆™ùešìPñ2#äÞðp¥¢š‡ZëM_×¹ÌÔz6rƒ&%¯ÊÍ;òÄMNNÒ“‰åŽÎ´ÜPëJÓÐúµ¸zÏÕl@W\U³”Kº“ ±\N³m³U&šM_ð9ä–0 gvÎlºµíèÖú§\'L¥?Ò|!ÄaÿÙØ5¶ßÄE÷^Lošó¹Iâ¥àåÁ^ú¬8e?>JgKVê¨æK=«n4–Ìa+°û f’ÜÁ—˜Ù=žò1õÁhF}0GjþíV0mæßÞ«sTL±Âü=äÞ fÒžuñ$/üK'‹ß1pøŒ….@%”f~«ö8jŠÙŒ›Â' ñ'Þ1QÃ÷¤ áŸ|ÇÕ„G"%²ÅpŠ#Leuaqÿòå¸n¹\><ÌfwŽÆp4†“Gj“쀗¹€ï"¨Û¶M Lr¾]¿Y¾v!Û€°1Qxjr@¿‚’>ÊèúšÜæ²Îr£‰,‰ÉÀˆ|$Ÿýâc-L‡áL¸þCŒñDƧ­_äY5·5†–‰bÕñþ¢¦Ý]c{ÎS²—5I˜viTFJ¡ÉÙ¢©ƒ\/îžF…K®eZ —VÔž‹¥;†Oס“ÖÔ”ü3rØ1¯P¬~ð±¿ðÿà’­OÑë ì ꆙrömÚÄ øßbeo]®î€Ü¡”ܡح¦«œ—ÏÇ+xy5ØÝå{²òÌó+£êÄÔ Ò[x6X QºÆÙG‡š6°E´³ýüáŠ|ÄäYŽ£î¢iÚe›ˆGÝbM"ö:¢/ñŸ°wÞJ‚ q*Ë.q½hšà²cÑ¢&Çóãš­q2Ú@Îvö9w2ßréÁ&šÒŽi„¹ne$È\Úyµ{«ëd‹Ÿ°Ç™ï(Ûäw=.ovoÉÊ¿ n€Ÿ×tAlïr,ÒVŶêÿðrk÷yfëÙÌÚÿQÆ´WÃԣʿ¬S z]J6˜èA³Þ¯Z5E5uQb­ÏQJþ†\ Ô­š}å|e¥mLgs#Á§¿/o~uaŸ~ù¸º$¶ 5¢,.Ñ"hŒ T€ø—¶Œþ¸à@u»ö7²ôÊÝ4Q¸YY›M­´Ñ‹ Ê¥£4P¥çÈNÍâe?^5´èÕ %íqAó‘â&:~L‰+žZ’ND‚nTµÊäƒm“ƒ`lkw¶MÅÆO¹‚ôÿDúmüóøäYX‹ ֢ÿhaÉ·”dµºòíé1£•IDÃf®ºÐ3JŽBu)’:Ò]tv]ÍuÄàÙ@*q€Ÿ zVcé 1Þ‡wâßÛÅRØq”ƒ‰?«¯Ô5éà܉I#ï¦O§O7é[å ï8r …T{r%³ìQ=<ŒlîÛ¨é…üŒ ß ¿úÈ"A7¶:Â@‰fÙe–ZçܨøÁ6ŒAëÞ)Z+j­hŒù>É9¸+‹‘œg9 Š…¦’{Y ¢•7¸‰÷R…Wñ£TÅÀÅÔ¨ÚÆi­ox⮢F²ˆ,=&øŒi§OAÛAЛ¶:b±èÏhB®YY3q0h+cÓht|Ü>0ë"ª#ÛaÜ Žq°;ÊA³ˆUuR°o)·Æ ´ÑõƒuõÛ0¥øQ“ØòEM[½ÆvI­¸Ù“FÒtïR™|s¸s/qKa¬ë]­‘Ùwç5ÝÝ[Ç©tß)à÷èfON‚ö„œu“VÄ w4qE›¼F´ø¤_varnish-3.0.5/doc/sphinx/=build/html/phk/0000755000175000017500000000000012247037213015173 500000000000000varnish-3.0.5/doc/sphinx/=build/html/phk/backends.html0000644000175000017500000002335012247037213017556 00000000000000 What do you mean by 'backend' ? — Varnish version 3.0.5 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-3.0.5/doc/sphinx/=build/html/phk/platforms.html0000644000175000017500000002241512247037213020014 00000000000000 Picking platforms — Varnish version 3.0.5 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.

    Yes, we'd like to bump Solaris to tier-A but I have to say that the uncertainty about the future for OpenSolaris, and lack of time to care and feed the somewhat altmodishe socket-API on Solaris, does keep the enthusiasm bounded.

    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

    varnish-3.0.5/doc/sphinx/=build/html/phk/index.html0000644000175000017500000001723212247037213017115 00000000000000 Poul-Hennings random outbursts — Varnish version 3.0.5 documentation varnish-3.0.5/doc/sphinx/=build/html/phk/barriers.html0000644000175000017500000002630112247037213017614 00000000000000 Security barriers in Varnish — Varnish version 3.0.5 documentation

    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-3.0.5/doc/sphinx/=build/html/phk/autocrap.html0000644000175000017500000001744312247037213017630 00000000000000 Did you call them autocrap tools ? — Varnish version 3.0.5 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 activites of the autocrap generated configure script in Varnish are:

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

    &c. &c. &c.

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

    Poul-Henning, 2010-04-20

    Previous topic

    What were they thinking ?

    Next topic

    Why Sphinx and reStructuredText ?

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/phk/thetoolsweworkwith.html0000644000175000017500000003217312247037213022003 00000000000000 The Tools We Work With — Varnish version 3.0.5 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 appearantly "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 appearantly 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-3.0.5/doc/sphinx/=build/html/phk/vcl_expr.html0000644000175000017500000001471512247037213017633 00000000000000 VCL Expressions — Varnish version 3.0.5 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-3.0.5/doc/sphinx/=build/html/phk/sphinx.html0000644000175000017500000001752312247037213017322 00000000000000 Why Sphinx and reStructuredText ? — Varnish version 3.0.5 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-3.0.5/doc/sphinx/=build/html/phk/three-zero.html0000644000175000017500000001606112247037213020071 00000000000000 Thoughts on the eve of Varnish 3.0 — Varnish version 3.0.5 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-3.0.5/doc/sphinx/=build/html/phk/thoughts.html0000644000175000017500000001336512247037213017656 00000000000000 What were they thinking ? — Varnish version 3.0.5 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-3.0.5/doc/sphinx/=build/html/phk/varnish_does_not_hash.html0000644000175000017500000002431412247037213022354 00000000000000 Varnish Does Not Hash — Varnish version 3.0.5 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 Shannons 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 loosing any of the entropy.

    Needless to say, the more entropy you have to begin with, the more of it you can afford to loose, and loose 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 hash_data() are fed, 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 bytes long 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

    Poul-Hennings random outbursts

    Next topic

    The Tools We Work With

    This Page

    varnish-3.0.5/doc/sphinx/=build/html/phk/ssl.html0000644000175000017500000001626512247037213016614 00000000000000 Why no SSL ? — Varnish version 3.0.5 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 goodby 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-3.0.5/doc/sphinx/=build/html/phk/gzip.html0000644000175000017500000002647312247037213016766 00000000000000 How GZIP, and GZIP+ESI works in Varnish — Varnish version 3.0.5 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_fetch{} 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_fetch{} 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_fetch {
            if (req.url ~ "html$") {
                    set beresp.do_gzip = true;
            }
    }

    GZIP and ESI¶

    First, note the new syntax for activating ESI:

    sub vcl_fetch {
            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 bereq.http.accept-encoding;
            }
    }
    
    sub vcl_fetch {
            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-3.0.5/doc/sphinx/=build/html/phk/ipv6suckage.html0000644000175000017500000001567412247037213020245 00000000000000 IPv6 Suckage — Varnish version 3.0.5 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-3.0.5/doc/sphinx/=build/html/_sources/0000755000175000017500000000000012247037213016233 500000000000000varnish-3.0.5/doc/sphinx/=build/html/_sources/tutorial/0000755000175000017500000000000012247037213020076 500000000000000varnish-3.0.5/doc/sphinx/=build/html/_sources/tutorial/sizing_your_cache.txt0000644000175000017500000000217412247037213024267 00000000000000 Sizing your cache ----------------- Picking how much memory you should give Varnish 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:`reference-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 1k per object. So, if you have lots of small objects in your cache the overhead might be significant. varnish-3.0.5/doc/sphinx/=build/html/_sources/tutorial/backend_servers.txt0000644000175000017500000000245512247037213023725 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. 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. 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 comment in this bit of text and change the port setting from 8080 to 80, making the text look like.:: backend default { .host = "127.0.0.1"; .port = "80"; } 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 80 on localhost (127.0.0.1). Varnish can have several backends defined and can you can even join several backends together into clusters of backends for load balancing purposes. Now that we have the basic Varnish configuration done, let us start up Varnish on port 8080 so we can do some fundamental testing on it. varnish-3.0.5/doc/sphinx/=build/html/_sources/tutorial/handling_misbehaving_servers.txt0000644000175000017500000000653012247037213026474 00000000000000.. _tutorial-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 back end. 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 30 minutes beyond their TTL use the following VCL:: sub vcl_fetch { set beresp.grace = 30m; } Varnish still won't serve the stale objects. In order to enable Varnish to actually serve the stale object we must enable this on the request. Lets us say that we accept serving 15s old object.:: sub vcl_recv { set req.grace = 15s; } You might wonder why we should keep the objects in the cache for 30 minutes if we are unable to serve them? Well, if you have enabled :ref:`tutorial-advanced_backend_servers-health` you can check if the backend is sick and if it is we can serve the stale content for a bit longer.:: if (! req.backend.healthy) { set req.grace = 5m; } else { set req.grace = 15s; } So, to sum up, grace mode solves two problems: * it serves stale content to avoid request pile-up. * it serves stale content if the backend is not healthy. Saint mode ~~~~~~~~~~ Sometimes servers get flaky. They start throwing out random errors. You can instruct Varnish to try to handle this in a more-than-graceful way - enter *Saint mode*. Saint mode enables you to discard a certain page from one backend server and either try another server or serve stale content from cache. Lets have a look at how this can be enabled in VCL:: sub vcl_fetch { if (beresp.status == 500) { set beresp.saintmode = 10s; return(restart); } set beresp.grace = 5m; } When we set beresp.saintmode to 10 seconds Varnish will not ask *that* server for URL for 10 seconds. A blacklist, more or less. Also a restart is performed so if you have other backends capable of serving that content Varnish will try those. When you are out of backends Varnish will serve the content from its stale cache. This can really be a life saver. Known limitations on grace- and saint mode ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If your request fails while it is being fetched you're thrown into vcl_error. vcl_error has access to a rather limited set of data so you can't enable saint mode or grace mode here. This will be addressed in a future release but a work-around available. * Declare a backend that is always sick. * Set a magic marker in vcl_error * Restart the transaction * Note the magic marker in vcl_recv and set the backend to the one mentioned * Varnish will now serve stale data is any is available God mode ~~~~~~~~ Not implemented yet. :-) varnish-3.0.5/doc/sphinx/=build/html/_sources/tutorial/platformnotes.txt0000644000175000017500000000213212247037213023452 00000000000000 Platform specific notes ------------------------ 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:: $ echo "never" > /sys/kernel/mm/redhat_transparent_hugepage/enabled On Debian/Ubuntu systems running 3.2 kernels the default value is "madvise" and does not need to 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 to much memory per thread, which will make varnish fail as soon as the number of threads (traffic) increases. Reduce the maximum stack size by running:: ulimit -s 256 in the Varnish startup script. varnish-3.0.5/doc/sphinx/=build/html/_sources/tutorial/introduction.txt0000644000175000017500000000237312247037213023305 00000000000000.. _tutorial-intro: What is Varnish? ---------------- 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. Performance ~~~~~~~~~~~ Varnish performs really, really well. It is usually bound by the speed of the network, effectivly turning performance into a non-issue. We've seen Varnish delivering 20 Gbps on regular off-the-shelf hardware. Flexibility ~~~~~~~~~~~ One of the key features of Varnish Cache, in addition to it's performance, is the flexibility of it's 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. You can read more about this in our tutorial. 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 and OS X. varnish-3.0.5/doc/sphinx/=build/html/_sources/tutorial/purging.txt0000644000175000017500000001331012247037213022230 00000000000000.. _tutorial-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, let me explain the HTTP purges. HTTP Purges =========== 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 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.request == "PURGE") { if (!client.ip ~ purge) { error 405 "Not allowed."; } return (lookup); } } sub vcl_hit { if (req.request == "PURGE") { purge; error 200 "Purged."; } } sub vcl_miss { if (req.request == "PURGE") { purge; error 200 "Purged."; } } As you can see we have used to new VCL subroutines, vcl_hit and vcl_miss. When we call lookup Varnish will try to lookup the object in its cache. It will either hit an object or miss it and so the corresponding subroutine is called. In vcl_hit the object that is stored in cache is available and we can set the TTL. The purge in vcl_miss is necessary to purge all variants in the cases where you hit an object, but miss a particular variant. 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.request == "BAN") { # Same ACL check as above: if (!client.ip ~ purge) { error 405 "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. error 200 "Ban added"; } } This VCL sniplet enables Varnish to handle an 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_fetch { set beresp.http.x-url = req.url; } sub vcl_deliver { unset resp.http.x-url; # Optional } sub vcl_recv { if (req.request == "PURGE") { if (client.ip !~ purge) { error 401 "Not allowed"; } ban("obj.http.x-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 CLI. This will produce a status of all current bans:: 0xb75096d0 1318329475.377475 10 obj.http.x-url ~ test 0xb7509610 1318329470.785875 20G obj.http.x-url ~ test 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-3.0.5/doc/sphinx/=build/html/_sources/tutorial/statistics.txt0000644000175000017500000000362412247037213022756 00000000000000.. _tutorial-statistics: Statistics ---------- Now that your varnish is up and running let's have a look at how it is doing. There are several tools that can help. varnishtop ~~~~~~~~~~ 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 rxurl`` will show you what URLs are being asked for by the client. ``varnishtop -i txurl`` will show you what your backend is being asked the most. ``varnishtop -i RxHeader -I Accept-Encoding`` will show the most popular Accept-Encoding header the client are sending you. varnishhist ~~~~~~~~~~~ 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 ("#"). varnishsizes ~~~~~~~~~~~~ Varnishsizes does the same as varnishhist, except it shows the size of the objects and not the time take to complete the request. This gives you a good overview of how big the objects you are serving are. 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. varnish-3.0.5/doc/sphinx/=build/html/_sources/tutorial/esi.txt0000644000175000017500000000467412247037213021352 00000000000000.. _tutorial-esi: Edge Side Includes ------------------ *Edge Side Includes* is a language to include *fragments* of web pages in other web pages. Think of it as HTML include statement that works over HTTP. On most web sites a lot of content is shared between pages. Regenerating this content for every page view is wasteful and ESI tries to address that letting you decide the cache policy for each fragment individually. In Varnish we've only implemented a small subset of ESI. As of 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. 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_fetch { if (req.url == "/test.html") { set beresp.do_esi = true; /* Do ESI processing */ set beresp.ttl = 24 h; /* Sets the TTL on the HTML above */ } elseif (req.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, becoming an 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 varnish-3.0.5/doc/sphinx/=build/html/_sources/tutorial/index.txt0000644000175000017500000000151112247037213021664 00000000000000.. _tutorial-index: %%%%%%%%%%%%% Using Varnish %%%%%%%%%%%%% This tutorial is intended for system administrators managing Varnish cache. The reader should know how to configure her web- or application server and have basic knowledge of the HTTP protocol. The reader should have Varnish up and running with the default configuration. The tutorial is split into short chapters, each chapter taking on a separate topic. Good luck. .. toctree:: :maxdepth: 1 introduction backend_servers starting_varnish logging sizing_your_cache putting_varnish_on_port_80 vcl statistics increasing_your_hitrate cookies vary purging compression esi platformnotes websockets devicedetection advanced_backend_servers handling_misbehaving_servers advanced_topics troubleshooting varnish-3.0.5/doc/sphinx/=build/html/_sources/tutorial/advanced_topics.txt0000644000175000017500000000350412247037213023707 00000000000000.. _tutorial-advanced_topics: Advanced topics --------------- This tutorial has covered the basics in Varnish. If you read through it all you should now have the skills to run Varnish. Here is a short overview of topics that we haven't covered in the tutorial. More VCL ~~~~~~~~ VCL is a bit more complex then what we've covered so far. There are a few more subroutines available and there a few actions that we haven't discussed. For a complete(ish) guide to VCL have a look at the VCL man page - ref:`reference-vcl`. Using In-line C to extend Varnish ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can use *in-line 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 I saw of In-line 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 } Edge Side Includes ~~~~~~~~~~~~~~~~~~ Varnish can cache create web pages by putting different pages together. These *fragments* can have individual cache policies. If you have a web site with a list showing the 5 most popular articles on your site, this list can probably be cached as a fragment and included in all the other pages. Used properly it can dramatically increase your hit rate and reduce the load on your servers. ESI looks like this:: The time is: at this very moment. ESI is processed in vcl_fetch by setting *do_esi* to true.:: sub vcl_fetch { if (req.url == "/test.html") { set beresp.do_esi = true; /* Do ESI processing */ } } varnish-3.0.5/doc/sphinx/=build/html/_sources/tutorial/vcl.txt0000644000175000017500000001376012247037213021352 00000000000000Varnish 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. Varnish uses a domain specific language called Varnish Configuration Language, or VCL for short. Varnish translates this configuration into binary code which is then executed when requests arrive. The VCL files are divided 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. Varnish will execute these subroutines of code at different stages of its work. Because it is code it is execute line by line precedence isn't a problem. At some point you call an action in this subroutine and then the execution of the subroutine stops. 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 default.vcl. 99% of all the changes you'll need to do will be done in two of these subroutines. *vcl_recv* and *vcl_fetch*. vcl_recv ~~~~~~~~ vcl_recv (yes, we're skimpy with characters, it's Unix) is called at the beginning of a request, after the complete request has been received and parsed. Its purpose is to decide whether or not to serve the request, how to do it, and, if applicable, which backend to use. In vcl_recv you can also alter the request. Typically you can alter the cookies and add and remove request headers. Note that in vcl_recv only the request object, req is available. vcl_fetch ~~~~~~~~~ vcl_fetch is called *after* a document has been successfully retrieved from the backend. Normal tasks her are to alter the response headers, trigger ESI processing, try alternate backend servers in case the request failed. In vcl_fetch you still have the request object, req, available. There is also a *backend response*, beresp. beresp will contain the HTTP headers from the backend. 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 *hit_for_pass* Similar to pass, but accessible from vcl_fetch. Unlike pass, hit_for_pass will create a hitforpass object in the cache. This has the side-effect of caching the decision not to cache. This is to allow would-be uncachable requests to be passed to the backend at the same time. The same logic is not necessary in vcl_recv because this happens before any potential queueing for an object takes place. *lookup* When you return lookup from vcl_recv you tell Varnish to deliver content from cache even if the request othervise indicates that the request should be passed. You can't return lookup from vcl_fetch. *pipe* 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. Beware that with HTTP 1.1 a client can send several requests on the same connection and so you should instruct Varnish to add a "Connection: close" header before actually returning pipe. *deliver* Deliver the cached object to the client. Usually returned from vcl_fetch. Requests, responses and objects ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In VCL, there are three important data structures. The request, coming from the client, the response coming from the backend server and the object, stored in cache. In VCL you should know the following structures. *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. *beresp* The backend respons object. It contains the headers of the object comming from the backend. Most of the work you do in vcl_fetch you do on the beresp object. *obj* The cached object. Mostly a read only object that resides in memory. obj.ttl is writable, the rest is read only. 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* Example 1 - manipulating headers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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). Example 2 - manipulating beresp ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Here we override the TTL of a object comming from the backend if it matches certain criteria:: sub vcl_fetch { if (req.url ~ "\.(png|gif|jpg)$") { unset beresp.http.set-cookie; set beresp.ttl = 1h; } } Example 3 - 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.request == "PURGE") { if (client.ip ~ local) { return(lookup); } } } sub vcl_hit { if (req.request == "PURGE") { set obj.ttl = 0s; error 200 "Purged."; } } sub vcl_miss { if (req.request == "PURGE") { error 404 "Not in cache."; } } varnish-3.0.5/doc/sphinx/=build/html/_sources/tutorial/advanced_backend_servers.txt0000644000175000017500000001005312247037213025543 00000000000000Advanced Backend configuration ------------------------------ 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 a 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 where to send the difference URL. Lets look at vcl_recv.:: sub vcl_recv { if (req.url ~ "^/java/") { set req.backend = java; } else { set req.backend = 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.User-agent ~ /mobile/) .... should do the trick. .. _tutorial-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.:: backend server1 { .host = "192.168.0.10"; } backend server2{ .host = "192.168.0.10"; } Now we create the director.:: director example_director round-robin { { .backend = server1; } # server2 { .backend = server2; } # foo } 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. 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. .. _tutorial-advanced_backend_servers-health: Health checks ------------- Lets set up a director with two backends and health checks. First lets define the backends.:: backend server1 { .host = "server1.example.com"; .probe = { .url = "/"; .interval = 5s; .timeout = 1 s; .window = 5; .threshold = 3; } } backend server2 { .host = "server2.example.com"; .probe = { .url = "/"; .interval = 5s; .timeout = 1 s; .window = 5; .threshold = 3; } } Whats new here is the probe. Varnish will check the health of each backend with a probe. The options are url What URL should varnish request. interval How often should we poll timeout What is the timeout of the probe window Varnish will maintain a *sliding window* of the results. Here the window has five checks. threshold How many of the .window last polls must be good for the backend to be declared healthy. initial How many of the of the probes a good when Varnish starts - defaults to the same amount as the threshold. Now we define the director.:: director example_director round-robin { { .backend = server1; } # server2 { .backend = server2; } } You use this director just as you would use any other director or 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:`tutorial-handling_misbehaving_servers` for more information on how to enable this. Please note that Varnish will keep probes active 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. varnish-3.0.5/doc/sphinx/=build/html/_sources/tutorial/troubleshooting.txt0000644000175000017500000000713512247037213024014 00000000000000Troubleshooting Varnish ----------------------- Sometimes Varnish misbehaves. In order for you to understand whats going on there are a couple of places you can check. varnishlog, /var/log/syslog, /var/log/messages are all places where varnish might leave clues of whats going on. When Varnish won't start ~~~~~~~~~~~~~~~~~~~~~~~~ Sometimes Varnish wont start. There is a plethora of 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 option. It will give you some more information on what is going on. Let us see how Varnish will react to something else 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. 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 ~~~~~~~~~~~~~~~~~~~ When varnish goes bust the child processes crashes. Usually the mother process will manage this by restarting the child process again. Any errors will be logged in syslog. It might look like this:: Mar 8 13:23:38 smoke varnishd[15670]: Child (15671) not responding to CLI, killing it. Mar 8 13:23:43 smoke varnishd[15670]: last message repeated 2 times Mar 8 13:23:43 smoke varnishd[15670]: Child (15671) died signal=3 Mar 8 13:23:43 smoke varnishd[15670]: Child cleanup complete Mar 8 13:23:43 smoke varnishd[15670]: child (15697) Started Specifically if you see the "Error in munmap" error on Linux you might want to increase the amount of maps available. Linux is limited to a maximum of 64k maps. Setting vm.max_map_count in sysctl.conf will enable you to increase this limit. You can inspect the number of maps your program is consuming by counting the lines in /proc/$PID/maps This is a rather odd thing to document here - but hopefully Google will serve you this page if you ever encounter this error. Varnish gives me Guru meditation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ First find the relevant log entries in varnishlog. That will probably give you a clue. Since varnishlog logs so much 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 -c -m TxStatus:503 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 option:: $ varnishlog -d -c -m TxStatus:503 Please see the varnishlog man page for elaborations on further filtering capabilities and explanation of the various options. Varnish doesn't cache ~~~~~~~~~~~~~~~~~~~~~ See :ref:`tutorial-increasing_your_hitrate`. varnish-3.0.5/doc/sphinx/=build/html/_sources/tutorial/vary.txt0000644000175000017500000000455612247037213021552 00000000000000.. _tutorial-vary: Vary ~~~~ The Vary header is sent by the web server to indicate what makes a HTTP object Vary. This makes a lot of sense with headers like Accept-Encoding. When a server issues a "Vary: Accept-Encoding" it tells Varnish that its needs to cache a separate version for every different Accept-Encoding that is coming from the clients. So, if a clients only accepts gzip encoding Varnish won't serve the version of the page encoded with the deflate encoding. The problem is that the Accept-Encoding field contains a lot of different encodings. If one browser sends:: Accept-Encoding: gzip,deflate And another one sends:: Accept-Encoding: deflate,gzip Varnish will keep two variants of the page requested due to the different Accept-Encoding headers. Normalizing the accept-encoding header will sure that you have as few variants as possible. The following VCL code will normalize the Accept-Encoding headers:: if (req.http.Accept-Encoding) { if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg)$") { # No point in compressing these remove req.http.Accept-Encoding; } elsif (req.http.Accept-Encoding ~ "gzip") { set req.http.Accept-Encoding = "gzip"; } elsif (req.http.Accept-Encoding ~ "deflate") { set req.http.Accept-Encoding = "deflate"; } else { # unknown algorithm remove req.http.Accept-Encoding; } } The code sets the Accept-Encoding header from the client to either gzip, deflate with a preference for gzip. Vary parse errors ~~~~~~~~~~~~~~~~~ Varnish will return a 503 internal server error page when it fails to parse the Vary server 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. 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-3.0.5/doc/sphinx/=build/html/_sources/tutorial/websockets.txt0000644000175000017500000000075412247037213022736 00000000000000 Using Websockets ---------------- Websockets is a technology for creating a bidirectional stream-based channel over HTTP. To run websockets through Varnish you need to pipe it, and copy the Upgrade header. Use the following VCL config to do so:: sub vcl_pipe { if (req.http.upgrade) { set bereq.http.upgrade = req.http.upgrade; } } sub vcl_recv { if (req.http.Upgrade ~ "(?i)websocket") { return (pipe); } } varnish-3.0.5/doc/sphinx/=build/html/_sources/tutorial/compression.txt0000644000175000017500000000476712247037213023136 00000000000000.. _tutorial-compression: Compression ~~~~~~~~~~~ New in Varnish 3.0 was native support for compression, using gzip encoding. *Before* 3.0, Varnish would never compress objects. In Varnish 3.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:`ref-varnishd` for details. Default behaviour ~~~~~~~~~~~~~~~~~ The default for Varnish is to check if the client supports our compression scheme (gzip) and if it does it will override the Accept-Encoding header and set it to "gzip". When Varnish then issues a backend request the Accept-Encoding will then only consist of "gzip". If the server responds with gzip'ed content it will be stored in memory in its compressed form. If the backend sends content in clear text it will be stored like that. You can make Varnish compress content before storing it in cache in vcl_fetch by setting do_gzip to true, like this:: sub vcl_fetch { if (beresp.http.content-type ~ "text") { set beresp.do_gzip = true; } } Please make sure that you don't try to compress content that is incompressable, like jpgs, gifs and mp3. You'll only waste CPU cycles. You can also uncompress objects before storing it in memory by setting do_gunzip to *true* but I have no idea why anybody would want to do that. 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. GZIP and ESI ~~~~~~~~~~~~ If you are using Edge Side Includes 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. Clients that don't support gzip ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If the client does not support gzip the Accept-Encoding header is left alone and we'll end up serving whatever we get from the backend server. Remember that the Backend might tell Varnish to *Vary* on the Accept-Encoding. If the client does not support gzip but we've already got a compressed version of the page in memory Varnish will automatically decompress the page while delivering it. A random outburst ~~~~~~~~~~~~~~~~~ Poul has written :ref:`phk_gzip` which talks abit more about how the implementation works. varnish-3.0.5/doc/sphinx/=build/html/_sources/tutorial/putting_varnish_on_port_80.txt0000644000175000017500000000152212247037213026052 00000000000000 Put Varnish on port 80 ---------------------- Until now we've been running with Varnish on a high port, for testing purposes. You should test your application and if it works OK we can switch, so Varnish will be running on port 80 and your web server on a high port. First we kill off varnishd:: # pkill varnishd and stop your web server. Edit the configuration for your web server and make it bind to port 8080 instead of 80. Now open the Varnish default.vcl and change the port of the *default* backend to 8080. Start up your web server and then start varnish:: # varnishd -f /usr/local/etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1:2000 Note that we've removed the -a option. Now Varnish, as its default setting dictates, will bind to the http port (80). Now everyone accessing your site will be accessing through Varnish. varnish-3.0.5/doc/sphinx/=build/html/_sources/tutorial/cookies.txt0000644000175000017500000000600112247037213022210 00000000000000.. _tutorial-cookies: Cookies ------- Varnish will, in the default configuration, not cache a 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 application 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 don't I suggest you either pick up a book on the subject, read through the *pcrepattern* man page or read through one of many online guides. Let me show you what Varnish Software uses. We use 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 we will discard these unnecessary cookies in VCL. In the following VCL we discard all cookies that start with a 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*", ""); Let me show you an example where we remove everything except the cookies named COOKIE1 and COOKIE2 and you can marvel at 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 == "") { remove req.http.Cookie; } } The example is taken from the Varnish Wiki, where you can find other scary examples of what can be done in VCL. Cookies coming from the backend ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If your backend server sets a cookie using the Set-Cookie header Varnish will not cache the page. A hit-for-pass object (see :ref:`tutorial_vcl_fetch_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. varnish-3.0.5/doc/sphinx/=build/html/_sources/tutorial/devicedetection.txt0000644000175000017500000002152712247037213023724 00000000000000.. _tutorial-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 strategies on what to do with such clients: 1) Redirect them to another URL. 2) Use a different backend for the special clients. 3) Change the backend requests so the usual backend sends tailored content. To make the examples easier to understand, it is assumed in this text that all the req.http.X-UA-Device header is present and unique per client class that content is to be served to. Setting this header can be as simple as:: sub vcl_recv {  if (req.http.User-Agent ~ "(?i)iphone" { set req.http.X-UA-Device = "mobile-iphone"; } } There are different commercial and free offerings in doing grouping and identifiying clients in further detail than this. For a basic and community based regular expression set, see https://github.com/varnish/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 what client class this is. 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 while still making sure that we only get 1 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 conterintuitive. 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_fetch { if (req.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 = req.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 signaling 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 bereq.http.User-Agent = req.http.X-UA-Device; } } sub vcl_pass { if (req.http.X-UA-Device) { set bereq.http.User-Agent = req.http.X-UA-Device; } } # standard Vary handling code from previous examples. sub vcl_fetch { if (req.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 = req.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.request == "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_fetch { if (req.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 = req.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 = 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") { error 750 "Moved Temporarily"; } } sub vcl_error { 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-3.0.5/doc/sphinx/=build/html/_sources/tutorial/increasing_your_hitrate.txt0000644000175000017500000001564712247037213025514 00000000000000.. _tutorial-increasing_your_hitrate: Achieving a high hitrate ------------------------ Now that Varnish is up and running, and 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 hit rate 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, I'll guide you through a couple of tools that you will find useful. Note that you need a tool to see what HTTP headers fly between you and the web server. On the Varnish server, the easiest is to use varnishlog and varnishtop but sometimes a client-side tool makes sense. Here are the ones I use. Tool: varnishtop ~~~~~~~~~~~~~~~~ You can use varnishtop to identify what URLs are hitting the backend the most. ``varnishtop -i txurl`` is an essential command. You can see some other examples of varnishtop usage in :ref:`tutorial-statistics`. Tool: varnishlog ~~~~~~~~~~~~~~~~ When you have identified the an URL which is frequently sent to the backend you can use varnishlog to have a look at the request. ``varnishlog -c -m 'RxURL:^/foo/bar`` will show you the requests coming from the client (-c) matching /foo/bar. For more information on how varnishlog works please see :ref:`tutorial-logging` or man :ref:`ref-varnishlog`. For extended diagnostics headers, see http://www.varnish-cache.org/trac/wiki/VCLExampleHitMissHeader Tool: lwp-request ~~~~~~~~~~~~~~~~~ lwp-request is part of The World-Wide Web library for Perl. It's a couple of really basic programs that can execute an HTTP request and give you the result. I mostly use 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. Let me explain what it does. GET usually sends off HTTP 0.9 requests, which lack the Host header. So I 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. *Live HTTP Headers* can show you what headers are being sent and recieved. 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. Please note that when considering 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 so 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: Cache-Control ~~~~~~~~~~~~~ The Cache-Control instructs caches how to handle the content. Varnish cares about the *max-age* parameter and uses it to calculate the TTL for an object. "Cache-Control: nocache" is ignored but if you need this you can easily add support for it. 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 like this:: varnishlog -i TxHeader -I ^Age Pragma ~~~~~~ An HTTP 1.0 server might send "Pragma: nocache". Varnish ignores this header. You could easily add support for this header in VCL. In vcl_fetch:: if (beresp.http.Pragma ~ "nocache") { return(hit_for_pass); } 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 than 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_fetch { if (req.url ~ "^/legacy_broken_cms/") { set beresp.ttl = 5d; } } The 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 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 different, 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"; } Ways of increasing your hitrate even more ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The following chapters should give your ways of further increasing your hitrate, especially the chapter on Cookies. * :ref:`tutorial-cookies` * :ref:`tutorial-vary` * :ref:`tutorial-purging` * :ref:`tutorial-esi` varnish-3.0.5/doc/sphinx/=build/html/_sources/tutorial/logging.txt0000644000175000017500000000452512247037213022213 00000000000000.. _tutorial-logging: Logging in Varnish ------------------ One of the really nice features in Varnish is how logging works. Instead of logging to normal log file Varnish logs to a shared memory segment. When the end of the segment is reached we start over, overwriting old data. This is much, much faster then logging to a file and it doesn't require disk space. The flip side is that if you forget to have a program actually write the logs to disk they will disappear. 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 as well, we'll show you these later. In the terminal window you started varnish now type *varnishlog* and press enter. You'll see lines like these scrolling slowly by.:: 0 CLI - Rd ping 0 CLI - Wr 200 PONG 1273698726 1.0 These is the Varnish master process checking up on the caching process to see that everything is OK. Now go to the browser and reload the page displaying your web app. You'll see lines like these.:: 11 SessionOpen c 127.0.0.1 58912 0.0.0.0:8080 11 ReqStart c 127.0.0.1 58912 595005213 11 RxRequest c GET 11 RxURL c / 11 RxProtocol c HTTP/1.1 11 RxHeader c Host: localhost:8080 11 RxHeader c Connection: keep-alive The first column is an arbitrary number, it defines the request. Lines with the same number are part of the same HTTP 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. Tags starting with Rx indicate Varnish is recieving data and Tx indicates sending data. The third column tell us whether this is is data coming or going to the client (c) or to/from the backend (b). The forth column is the data being logged. Now, you can filter quite a bit with varnishlog. The basic option you want to know are: -b Only show log lines from traffic going between Varnish and the backend servers. This will be useful when we want to optimize cache hit rates. -c Same as -b but for client side traffic. -m tag:regex Only list transactions where the tag matches a regular expression. If it matches you will get the whole transaction. Now that Varnish seem to work OK it's time to put Varnish on port 80 while we tune it. varnish-3.0.5/doc/sphinx/=build/html/_sources/tutorial/starting_varnish.txt0000644000175000017500000000437612247037213024156 00000000000000.. _tutorial-starting_varnish: Starting Varnish ---------------- I assume varnishd is in your path. You might want to run ``pkill varnishd`` to make sure varnishd isn't running. Become root and type: ``# varnishd -f /usr/local/etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1:2000 -a 0.0.0.0:8080`` I added a few options, lets go through them: ``-f /usr/local/etc/varnish/default.vcl`` The -f options specifies what configuration varnishd should use. ``-s malloc,1G`` The -s options chooses the storage type Varnish should use for storing its content. I used the type *malloc*, which just uses memory for storage. There are other backends as well, described in :ref:tutorial-storage. 1G specifies how much memory should be allocated - one gigabyte. ``-T 127.0.0.1:2000`` Varnish has a built-in text-based administration interface. Activating the interface makes Varnish manageble without stopping it. You can specify what interface the management interface should listen to. Make sure you don't expose the management interface to the world as you can easily gain root access to a system via the Varnish management interface. I recommend tieing it to localhost. If you have users on your system that you don't fully trust, use firewall rules to restrict access to the interface to root only. ``-a 0.0.0.0:8080`` I specify that I want Varnish to listen on port 8080 for incomming HTTP requests. For a production environment you would probably make Varnish listen on port 80, which is the default. Now you have Varnish running. Let us make sure that it works properly. Use your browser to go to http://192.168.2.2:8080/ (obviously, you should replace the IP address with one on your own system) - you should now see your web application running there. Whether or not the application actually goes faster when run through Varnish depends on a few factors. If you application uses cookies for every session (a lot of PHP and Java applications seem to send a session cookie if it is needed or not) or if it uses authentication chances are Varnish won't do much caching. Ignore that for the moment, we come back to that in :ref:`tutorial-increasing_your_hitrate`. Lets make sure that Varnish really does do something to your web site. To do that we'll take a look at the logs. varnish-3.0.5/doc/sphinx/=build/html/_sources/installation/0000755000175000017500000000000012247037213020734 500000000000000varnish-3.0.5/doc/sphinx/=build/html/_sources/installation/bugs.txt0000644000175000017500000001274012247037213022361 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. Roughly we have three clases of bugs with Varnish, and the information we need to debug them depends on the kind of bug. Varnish crashes =============== Plain and simple: **boom** Varnish is split over two processes, the manager and the child. The child does all the work, and the manager hangs around to resurect it, if it crashes. Therefore, the first thing to do if you see a varnish crash, is to examine your syslogs, to see if it has happened before. (One site is rumoured to have had varnish restarting every 10 minutes and *still* provide better service than their CMS system.) When it crashes, if at all possible, Varnish will spew out a crash dump that looks something like:: Child (32619) died signal=6 (core dumped) Child (32619) Panic message: Assert error in ccf_panic(), cache_cli.c line 153: Condition(!strcmp("", "You asked for it")) not true. errno = 9 (Bad file descriptor) thread = (cache-main) ident = FreeBSD,9.0-CURRENT,amd64,-sfile,-hcritbit,kqueue Backtrace: 0x42bce1: pan_ic+171 0x4196af: ccf_panic+4f 0x8006b3ef2: _end+80013339a 0x8006b4307: _end+8001337af 0x8006b8b76: _end+80013801e 0x8006b8d84: _end+80013822c 0x8006b51c1: _end+800134669 0x4193f6: CLI_Run+86 0x429f8b: child_main+14b 0x43ef68: start_child+3f8 [...] If you can get that information to us, we are usually able to see exactly where things went haywire, and that speeds up bugfixing a lot. There will be a lot more information than this, and before sending it all to us, you should obscure any sensitive/secret data/cookies/passwords/ip# etc. Please make sure to keep context when you do so, ie: do not change all the IP# to "X.X.X.X", but change each IP# to something unique, otherwise we are likely to be more confused than informed. The most important line is the "Panic Message", which comes in two general forms: "Missing errorhandling code in ..." This is a place where we can conceive ending up, and have not (yet) written the padded-box error handling code for. The most likely cause here, is that you need a larger workspace for HTTP headers and Cookies. (XXX: which params to tweak) Please try that before reporting a bug. "Assert error in ..." This is something bad that should never happen, and a bug report is almost certainly in order. As always, if in doubt ask us on IRC before opening the ticket. In your syslog it may all be joined into one single line, but if you can reproduce the crash, do so while running varnishd manually: ``varnishd -d |& tee /tmp/_catch_bug`` That will get you the entire panic message into a file. (Remember to type ``start`` to launch the worker process, that is not automatic when ``-d`` is used.) Varnish goes on vacation ======================== This kind of bug is nasty to debug, because usually people tend to kill the process and send us an email saying "Varnish hung, I restarted it" which gives us only about 1.01 bit of usable debug information to work with. What we need here is all the information can you squeeze out of your operating system **before** you kill the Varnish process. One of the most valuable bits of information, is if all Varnish' threads are waiting for something or if one of them is spinning furiously on some futile condition. Commands like ``top -H`` or ``ps -Haxlw`` or ``ps -efH`` should be able to figure that out. If one or more threads are spinning, use ``strace`` or ``ktrace`` or ``truss`` (or whatever else your OS provides) to get a trace of which system calls the varnish process issues. Be aware that this may generate a lot of very repetitive data, usually one second worth is more than enough. Also, run ``varnishlog`` for a second, and collect the output for us, and if ``varnishstat`` shows any activity, capture that also. When you have done this, kill the Varnish *child* process, and let the *master* process restart it. Remember to tell us if that does or does not work. If it does not, kill all Varnish processes, and start from scratch. If that does not work either, tell us, that means that we have wedged your kernel. Varnish does something wrong ============================ These are the easy bugs: usually all we need from you is the relevant transactions recorded with ``varnishlog`` and your explanation of what is wrong about what Varnish does. Be aware, that often Varnish does exactly what you asked it to, rather than what you intended it to do, so it sounds like a bug that would have tripped up everybody else, take a moment to read though your VCL and see if it really does what you think. You can also try setting the ``vcl_trace`` parameter, that will generate log records with like and char number for each statement executed in your VCL program. varnish-3.0.5/doc/sphinx/=build/html/_sources/installation/prerequisites.txt0000644000175000017500000000072612247037213024326 00000000000000Prerequisites ============= In order for you to install Varnish you must have the following: * A fairly modern and 64 bit version of either - Linux - FreeBSD - Solaris * root access to said system Varnish can be installed on other UNIX systems as well, but it is not tested particularly well on these plattforms. Varnish is, from time to time, said to work on: * 32 bit versions of the before-mentioned systems. * OS X * NetBSD * OpenBSD varnish-3.0.5/doc/sphinx/=build/html/_sources/installation/index.txt0000644000175000017500000000057112247037213022527 00000000000000.. _install-index: %%%%%%%%%%%%%%%%%%%% Varnish Installation %%%%%%%%%%%%%%%%%%%% This document explains how to get Varnish onto your system, where to get help, how report bugs etc. In other words, it is a manual about pretty much everything else than actually using Varnish to move traffic. .. toctree:: prerequisites.rst install.rst help.rst bugs.rst upgrade.rst varnish-3.0.5/doc/sphinx/=build/html/_sources/installation/help.txt0000644000175000017500000000667712247037213022365 00000000000000%%%%%%%%%%%%%%%%%% Getting hold of us %%%%%%%%%%%%%%%%%% Getting hold of the gang behind Varnish is pretty straight forward, we try to help as much as time permits and have tried to streamline this process as much as possible. But before you grab hold of us, spend a moment composing your thoughts and formulate your question, there is nothing as pointless as simply telling us "Varnish does not work for me" with no further information to give any clue to why. And before you even do that, do a couple of searches to see if your question is already answered, if it has been, you will get your answer much faster that way. IRC Channel =========== The most immediate way to get hold of us, is to join our IRC channel: ``#varnish on server irc.linpro.no`` The main timezone of the channel is Europe+America. If you can explain your problem in a few clear sentences, without too much copy&paste, IRC is a good way to try to get help. If you do need to paste log files, VCL and so on, please use a pastebin_. If the channel is all quiet, try again some time later, we do have lives, families and jobs to deal with also. You are more than welcome to just hang out, and while we don't mind the occational intrusion of the real world into the flow, keep it mostly on topic, and dont paste random links unless they are *really* spectacular and intelligent. Mailing Lists ============= Getting on or off our mailinglist happens through MailMan_. If you are going to use Varnish, subscribing to our ``varnish-announce`` mailing list is probably a very good idea. The typical pattern is that people spend some time getting Varnish running, and then more or less forget about it. Therefore the announce list is a good way to be reminded about new releases, bad bugs or security holes. The ``varnish-misc`` mailing list is for general banter, questions, suggestions, ideas and so on. If you are new to Varnish it may pay off to subscribe to -misc, simply to have an ear to the telegraph-pole and learn some smart tricks. This is a good place to ask for help with more complex issues, that require quoting of files and 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. Trouble Tickets =============== Please do not open a trouble ticket, unless you have spotted an actual bug in Varnish. Ask on IRC first if you are in doubt. The reason for this policy, is to avoid the bugs being drowned in a pile of sensible suggestions for future enhancements and call for help from people who forget to check back if they get it and so on. We track suggestions and ideas in our `"Shopping-List" wiki page`_, and user support via email and IRC. Commercial Support ================== The following companies offer commercial Varnish support, and are listed here for your convenience. If you want your company listed here, drop an email to phk@FreeBSD.org. Varnish Software sales@varnish-software.com .. _Mailman: http://lists.varnish-cache.org/mailman/listinfo .. _pastebin: http://gist.github.com/ .. _"Shopping-List" wiki page: http://varnish-cache.org/wiki/PostTwoShoppingList varnish-3.0.5/doc/sphinx/=build/html/_sources/installation/upgrade.txt0000644000175000017500000001071512247037213023050 00000000000000%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Upgrading from Varnish 2.1 to 3.0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% This is a compilation of items you need to pay attention to when upgrading from Varnish 2.1 to 3.0 Changes to VCL ============== In most cases you need to update your VCL since there has been some changes to the syntax. string concatenation operator ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ String concatenation did not have an operator previously, but this has now been changed to ``+``. no more %-escapes in strings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To simplify strings, the %-encoding has been removed. If you need non-printable characters, you need to use inline C. ``log`` moved to the std vmod ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``log`` has moved to the std vmod:: log "log something"; becomes:: import std; std.log("log something"); You only need to import std once. purges are now called bans ~~~~~~~~~~~~~~~~~~~~~~~~~~ ``purge()`` and ``purge_url()`` are now respectively ``ban()`` and ``ban_url()``, so you should replace all occurences:: purge("req.url = " req.url); becomes:: ban("req.url = " + req.url); ``purge`` does not take any arguments anymore, but can be used in vcl_hit or vcl_miss to purge the item from the cache, where you would reduce ttl to 0 in Varnish 2.1:: sub vcl_hit { if (req.request == "PURGE") { set obj.ttl = 0s; error 200 "Purged."; } } becomes:: sub vcl_hit { if (req.request == "PURGE") { purge; error 200 "Purged."; } } ``beresp.cacheable`` and ``obj.cacheable`` are gone ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``beresp.cacheable`` is gone, and can be replaced with ``beresp.ttl > 0s``. Similarly ``obj.cacheable`` can be replaced with ``obj.ttl > 0s``. returns are now done with the ``return()`` function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``pass``, ``pipe``, ``lookup``, ``deliver``, ``fetch``, ``hash``, ``pipe`` and ``restart`` are no longer keywords, but arguments to ``return()``, so:: sub vcl_pass { pass; } becomes:: sub vcl_pass { return(pass); } ``req.hash`` is replaced with ``hash_data()`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You no longer append to the hash with ``+=``, so:: set req.hash += req.url; becomes:: hash_data(req.url); ``esi`` is replaced with ``beresp.do_esi`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You no longer enable ESI with ``esi``, so:: esi; in ``vcl_fetch`` becomes:: set beresp.do_esi = true; ``pass`` in ``vcl_fetch`` renamed to ``hit_for_pass`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The difference in behaviour of ``pass`` in ``vcl_recv`` and ``vcl_fetch`` confused people, so to make it clearer that they are different, you must now do ``return(hit_for_pass)`` when doing a pass in ``vcl_fetch``. Changes to runtime parameters ============================= Deleted parameters ~~~~~~~~~~~~~~~~~~ ``cache_vbe_conns`` and ``err_ttl`` has been removed. New parameters ~~~~~~~~~~~~~~ The following parameters have been added, see man varnishd for reference: * ``default_keep`` * ``expiry_sleep`` * ``fetch_maxchunksize`` * ``gzip_level`` * ``gzip_memlevel`` * ``gzip_stack_buffer`` * ``gzip_tmp_space`` * ``gzip_window`` * ``http_gzip_support`` * ``http_req_hdr_len`` * ``http_req_size`` * ``http_resp_hdr_len`` * ``http_resp_size`` * ``shortlived`` * ``thread_pool_workspace`` * ``vcc_err_unref`` * ``vcl_dir`` * ``vmod_dir`` Changed default values ~~~~~~~~~~~~~~~~~~~~~~ The following parameters have new defaults: * ``ban_lurker_sleep`` changed from 0 to 0.01 seconds, enabling the ban lurker by default. * ``connect_timeout`` changed from 0.4 to 0.7 seconds. * ``log_hashstring`` changed from off to on. * ``send_timeout`` changed from 600 to 60 seconds. * ``thread_pool_add_delay`` changed from 20 to 2 ms. Changed parameter names ~~~~~~~~~~~~~~~~~~~~~~~ The following parameters have new names: * ``http_headers`` has been renamed to ``http_max_hdr``. * ``max_esi_includes`` has been renamed to ``max_esi_depth``. * ``overflow_max`` has been renamed to ``queue_max``. * ``purge_dups`` has been renamed to ``ban_dups``. Changes to behaviour ==================== Varnish will return an error when headers are too large instead of just ignoring them. If the limits are too low, Varnish will return HTTP 413. You can change the limits by increasing http_req_hdr_len and http_req_size. thread_pool_max is now per thread pool, while it was a total across all pools in 2.1. If you had this set in 2.1, you should adjust it for 3.0. varnish-3.0.5/doc/sphinx/=build/html/_sources/installation/install.txt0000644000175000017500000001034312247037213023064 00000000000000.. _install-doc: Installing Varnish ================== With open source software, you can choose to install binary packages or compile stuff from source-code. To install a package or compile from source is a matter of personal taste. If you don't know which method too choose read the whole document and choose the method you are most comfortable with. Source or packages? ~~~~~~~~~~~~~~~~~~~ Installing Varnish on most relevant operating systems can usually be done with with the systems package manager, typical examples being: FreeBSD ~~~~~~~ From source: ``cd /usr/ports/varnish && make install clean`` Binary package: ``pkg_add -r varnish`` CentOS/RedHat ~~~~~~~~~~~~~ We try to keep the latest version available as prebuilt RPMs (el5) on `repo.varnish-cache.org `. See the `RedHat installation instructions ` for more information. Varnish is included in the `EPEL `_ repository. Unfortunately we had a syntax change in Varnish 2.0.6->2.1.X. This means that we can not update Varnish in `EPEL 5 `_ so the latest version there is Varnish 2.0.6. EPEL6 should have Varnish 2.1 available once it releases. 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 installation instructions for `Debian ` or `Ubuntu `. Other systems ~~~~~~~~~~~~~ You are probably best of compiling your own code. See `Compiling Varnish from source`_. If that worked for you, you can skip the rest of this document for now, and and start reading the much more interesting :ref:`tutorial-index` instead. Compiling Varnish from source ============================= If there are no binary packages available for your system, or if you want to compile Varnish from source for other reasons, follow these steps: We recommend downloading a release tarball, which you can find on `repo.varnish-cache.org `. 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 Please note that a git checkout will need some more build-dependencies than listed below, in particular the Python Docutils and Sphinx. 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: * autotools-dev * automake1.9 * libtool * autoconf * libncurses-dev * xsltproc * groff-base * libpcre3-dev * pkg-config Build dependencies on Red Hat / CentOS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To build Varnish on a Red Hat or CentOS system you need the following packages installed: * automake * autoconf * libtool * ncurses-devel * libxslt * groff * pcre-devel * pkgconfig Configuring and compiling ~~~~~~~~~~~~~~~~~~~~~~~~~ Next, configuration: 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 are run time parameters. Before you install, you may want to run the regression tests, make a cup of tea while it runs, it takes some minutes:: make check Don't worry of a single or two tests fail, some of the tests are a bit too timing sensitive (Please tell us which so we can fix it) but if a lot of them fails, and in particular if the ``b00000.vtc`` test fails, something is horribly wrong, and you will get nowhere without figuring out what. Installing ~~~~~~~~~~ And finally, the true test of a brave heart:: make install Varnish will now be installed in /usr/local. The varnishd binary is in /usr/local/sbin/varnishd and its default configuration will be /usr/local/etc/varnish/default.vcl. You can now proceed to the :ref:`tutorial-index`. varnish-3.0.5/doc/sphinx/=build/html/_sources/index.txt0000644000175000017500000000131612247037213020024 00000000000000.. Varnish documentation master file, created by sphinx-quickstart on Tue Apr 20 13:02:15 2010. Welcome to Varnish's documentation! =================================== Varnish is a state of the art web accelerator. Its mission is to sit in front of a web server and cache content. It makes your web site go faster. We suggest you start by reading the installation guide :ref:`install-index`. Once you have Varnish up and running go through our tutorial - :ref:`tutorial-index`. Contents: .. toctree:: :maxdepth: 1 installation/index.rst tutorial/index.rst reference/index.rst phk/index.rst glossary/index.rst Indices and tables ================== * :ref:`genindex` * :ref:`search` $Id$ varnish-3.0.5/doc/sphinx/=build/html/_sources/reference/0000755000175000017500000000000012247037213020171 500000000000000varnish-3.0.5/doc/sphinx/=build/html/_sources/reference/varnishstat.txt0000644000175000017500000000575012247037213023227 00000000000000.. _reference-varnishstat: =========== varnishstat =========== --------------------------- Varnish Cache statistics --------------------------- :Author: Dag-Erling Smørgrav :Author: Per Buer :Author: Lasse Karstensen :Date: 2011-11-07 :Version: 1.1 :Manual section: 1 SYNOPSIS ======== varnishstat [-1] [-x] [-j] [-f field_list] [-l] [-n varnish_name] [-V] [-w delay] DESCRIPTION =========== The varnishstat utility displays statistics from a running varnishd(1) instance. The following options are available: -1 Instead of presenting of a continuously updated display, print the statistics to stdout. -f A comma separated list of the fields to display. If it starts with '^' it is used as an exclusion list. -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. -V Display the version number and exit. -w delay Wait delay seconds between updates. The default is 1. Can also be used with -1, -x or -j for repeated output. -x Displays the result as XML. -j Displays the result as JSON. The columns in the main display are, from left to right: 1. Value 2. Per-second average in the period since last update, or a period if the value can not be averaged 3. Per-second average over process lifetime, or a period if the value can not be averaged 4. Descriptive text When using the -1 option, the columns in the output are, from left to right: 1. Symbolic entry name 2. Value 3. Per-second average over process lifetime, or a period if the value can not be averaged 4. Descriptive text When using the -x option, the output is:: FIELD NAME FIELD VALUE FIELD DESCRIPTION With -j the output format is:: { "timestamp": "YYYY-MM-DDTHH:mm:SS", "client_conn": { "value": 0, "flag": "a", "description": "Client connections accepted" }, "client_drop": { "value": 0, "flag": "a", "description": "Connection dropped, no sess/wrk" }, "LCK.backend.creat": { "type": "LCK", "ident": "backend", "value": 1, "flag": "a", "description": "Created locks" }, [..] } 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 ======== * varnishd(1) * varnishhist(1) * varnishlog(1) * varnishncsa(1) * varnishtop(1) * curses(3) HISTORY ======= The varnishstat utility was originally developed by Poul-Henning Kamp ⟨phk@phk.freebsd.dk⟩ in cooperation with Verdens Gang AS, Varnish Software AS and Varnish Software. Manual page written by Dag-Erling Smørgrav, and Per Buer. 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-2011 Varnish Software AS varnish-3.0.5/doc/sphinx/=build/html/_sources/reference/vcl_var.txt0000644000175000017500000002217412247037213022314 00000000000000 bereq ~~~~~ bereq.backend Type: BACKEND Readable from: vcl_pipe, backend Writeable frome: vcl_pipe, backend bereq.between_bytes_timeout Type: DURATION Readable from: vcl_pipe, backend Writeable frome: vcl_pipe, 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 Writeable frome: vcl_pipe, backend The time in seconds to wait for a backend connection. bereq.first_byte_timeout Type: DURATION Readable from: vcl_pipe, backend Writeable frome: vcl_pipe, 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 Writeable frome: vcl_pipe, backend The corresponding HTTP header. bereq.method Type: STRING Readable from: vcl_pipe, backend Writeable frome: vcl_pipe, backend The request type (e.g. "GET", "HEAD"). bereq.proto Type: STRING Readable from: vcl_pipe, backend Writeable frome: vcl_pipe, backend The HTTP protocol version used to talk to the server. bereq.retries Type: INT Readable from: backend bereq.uncacheable Type: BOOL Readable from: backend Writeable frome: backend bereq.url Type: STRING Readable from: vcl_pipe, backend Writeable frome: vcl_pipe, backend The requested URL. beresp ~~~~~~ beresp.backend.ip Type: IP Readable from: vcl_backend_response IP of the backend this response was fetched from. beresp.backend.name Type: STRING Readable from: vcl_backend_response Name of the backend this response was fetched from. beresp.do_esi Type: BOOL Readable from: vcl_backend_response Writeable frome: vcl_backend_response 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 Writeable frome: vcl_backend_response Boolean. Unzip the object before storing it in the cache. Defaults to false. beresp.do_gzip Type: BOOL Readable from: vcl_backend_response Writeable frome: vcl_backend_response 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 Writeable frome: vcl_backend_response 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. As of Varnish Cache 3.0 the object will marked as busy as it is delivered so only client can access the object. beresp.grace Type: DURATION Readable from: vcl_backend_response Writeable frome: vcl_backend_response Set to a period to enable grace. beresp.http. Type: HEADER Readable from: vcl_backend_response Writeable frome: vcl_backend_response The corresponding HTTP header. beresp.keep Type: DURATION Readable from: vcl_backend_response Writeable frome: vcl_backend_response beresp.proto Type: STRING Readable from: vcl_backend_response Writeable frome: vcl_backend_response The HTTP protocol version used the backend replied with. beresp.reason Type: STRING Readable from: vcl_backend_response Writeable frome: vcl_backend_response The HTTP status message returned by the server. beresp.status Type: INT Readable from: vcl_backend_response Writeable frome: vcl_backend_response The HTTP status code returned by the server. beresp.storage Type: STRING Readable from: vcl_backend_response Writeable frome: vcl_backend_response Set to force Varnish to save this object to a particular storage backend. beresp.ttl Type: DURATION Readable from: vcl_backend_response Writeable frome: vcl_backend_response The object's remaining time to live, in seconds. beresp.ttl is writable. beresp.uncacheable Type: BOOL Readable from: vcl_backend_response Writeable frome: vcl_backend_response client ~~~~~~ client.identity Type: STRING Readable from: client, backend Writeable frome: client, backend Identification of the client, used to load balance in the client director. client.ip Type: IP Readable from: client, backend The client's IP address. now ~~~ now Type: TIME Readable from: vcl_all The current time, in seconds since the epoch. When used in string context it returns a formatted string. obj ~~~ obj.grace Type: DURATION Readable from: vcl_hit, vcl_error Writeable frome: vcl_hit, vcl_error The object's grace period in seconds. obj.grace is writable. obj.hits Type: INT Readable from: vcl_hit, vcl_deliver Writeable frome: vcl_hit, vcl_deliver The approximate number of times the object has been delivered. A value of 0 indicates a cache miss. This variable is also available in vcl_deliver. obj.http. Type: HEADER Readable from: vcl_hit, vcl_error Writeable frome: vcl_error The corresponding HTTP header. obj.keep Type: DURATION Readable from: vcl_hit, vcl_error Writeable frome: vcl_hit, vcl_error obj.last_use Type: TIME Readable from: vcl_hit, vcl_deliver Writeable frome: vcl_hit, vcl_deliver The approximate time elapsed since the object was last requests, in seconds. This variable is also available in vcl_deliver. obj.proto Type: STRING Readable from: vcl_hit, vcl_error Writeable frome: vcl_hit, vcl_error The HTTP protocol version used when the object was retrieved. obj.reason Type: STRING Readable from: vcl_error Writeable frome: vcl_error The HTTP status message returned by the server. obj.status Type: INT Readable from: vcl_error Writeable frome: vcl_error The HTTP status code returned by the server. obj.ttl Type: DURATION Readable from: vcl_hit, vcl_error Writeable frome: vcl_hit, vcl_error The object's remaining time to live, in seconds. obj.ttl is writable. obj.uncacheable Type: BOOL Readable from: vcl_hit, vcl_deliver, vcl_error req ~~~ req.backend Type: BACKEND Readable from: client Writeable frome: client The backend to use to service the request. req.can_gzip Type: BOOL Readable from: client Does the client accept the gzip transfer encoding. req.esi Type: BOOL Readable from: vcl_recv, vcl_backend_response, vcl_deliver, vcl_error Writeable frome: vcl_recv, vcl_backend_response, vcl_deliver, vcl_error 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 Writeable frome: 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 Writeable frome: 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 Writeable frome: client The corresponding HTTP header. req.method Type: STRING Readable from: client Writeable frome: client The request type (e.g. "GET", "HEAD"). req.proto Type: STRING Readable from: client Writeable frome: 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 Writeable frome: client req.url Type: STRING Readable from: client Writeable frome: client The requested URL. req.xid Type: STRING Readable from: client Unique ID of this request. resp ~~~~ resp.http. Type: HEADER Readable from: vcl_deliver Writeable frome: vcl_deliver The corresponding HTTP header. resp.proto Type: STRING Readable from: vcl_deliver Writeable frome: vcl_deliver The HTTP protocol version to use for the response. resp.reason Type: STRING Readable from: vcl_deliver Writeable frome: vcl_deliver The HTTP status message that will be returned. resp.status Type: INT Readable from: vcl_deliver Writeable frome: vcl_deliver The HTTP status code that will be returned. server ~~~~~~ server.hostname Type: STRING Readable from: client The host name of the server. server.identity Type: STRING Readable from: client 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. varnish-3.0.5/doc/sphinx/=build/html/_sources/reference/index.txt0000644000175000017500000000216512247037213021765 00000000000000.. _reference-index: %%%%%%%%%%%%%%%%%%%%%%%%%%%% The Varnish Reference Manual %%%%%%%%%%%%%%%%%%%%%%%%%%%% .. toctree:: vcl.rst varnish-cli.rst varnishadm.rst varnishd.rst varnishhist.rst varnishlog.rst varnishncsa.rst varnishreplay.rst varnishsizes.rst varnishstat.rst varnishtest.rst varnishtop.rst shmem.rst vmod.rst vmod_std.rst vsl.rst .. todo:: The programs: . varnishd manual page . varnishstat . - counters explained . common filtering options for shmlog tools . varnishlog .. . varnsihtop .. . varnsihncsa .. . varnsihhist .. The CLI: . connections: -T -S -M . varnishadm . CLI commands and what they do . - vcl.load . - stop . - start . - ... VCL language . The functions: . - vcl_recv . - vcl_miss . --- . The things you can do . - set . - unset . - esi . - rollback Varnishtest . syntax etc. Shared Memory . internals . Log records Libvarnishapi . function descriptions varnish-3.0.5/doc/sphinx/=build/html/_sources/reference/varnishreplay.txt0000644000175000017500000000217512247037213023546 00000000000000============= varnishreplay ============= ------------------------ HTTP traffic replay tool ------------------------ :Author: Cecilie Fritzvold :Author: Per Buer :Date: 2010-05-31 :Version: 1.0 :Manual section: 1 SYNOPSIS ======== varnishreplay [-D] -a address:port -r file DESCRIPTION =========== The varnishreplay utility parses varnish logs and attempts to reproduce the traffic. It is typcally used to *warm* up caches or various forms of testing. The following options are available: -a backend Send the traffic over tcp to this server, specified by an address and a port. This option is mandatory. Only IPV4 is supported at this time. -D Turn on debugging mode. -r file Parse logs from this file. This option is mandatory. SEE ALSO ======== * varnishd(1) * varnishlog(1) HISTORY ======= The varnishreplay utility and this manual page were written by Cecilie Fritzvold and later updated by Per Buer. COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2007-2010 Varnish Software AS varnish-3.0.5/doc/sphinx/=build/html/_sources/reference/varnishsizes.txt0000644000175000017500000000551012247037213023403 00000000000000============ varnishsizes ============ ------------------------------------- Varnish object size request histogram ------------------------------------- :Author: Dag Erling Smørgrav :Author: Kristian Lyngstøl :Author: Per Buer :Date: 2010-05-31 :Version: 1.0 :Manual section: 1 SYNOPSIS ======== varnishsizes [-b] [-C] [-c] [-d] [-I regex] [-i tag] [-m tag:regex ...] [-n varnish_name] [-r file] [-V] [-w delay] [-X regex] [-x tag] DESCRIPTION =========== The varnishsizes 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 a logarithmic representation of bytes. Hits are marked with a pipe character ("|"), and misses are marked with a hash character ("#"). The following options are available: -b Include log entries which result from communication with a backend server. If neither -b nor -c is specified, varnishsizes acts as if they both were. -C Ignore case when matching regular expressions. -c Include log entries which result from communication with a client. If neither -b nor -c is specified, varnishsizes acts as if they both were. -d Process old log entries on startup. Normally, varnishsizes will only process entries which are written to the log after it starts. -I regex Include log entries which match the specified regular expression. If neither -I nor -i is specified, all log entries are included. -i tag Include log entries with the specified tag. If neither -I nor -i is specified, all log entries are included. -m tag:regex only list record where tag matches regex. Multiple -m options are AND-ed together. -n Specifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used. -r file Read log entries from file instead of shared memory. -V Display the version number and exit. -w delay Wait at least delay seconds between each update. The default is 1. file instead of displaying them. The file will be overwritten unless the -a option was specified. -X regex Exclude log entries which match the specified regular expression. -x tag Exclude log entries with the specified tag. SEE ALSO ======== * varnishd(1) * varnishlog(1) * varnishncsa(1) * varnishstat(1) * varnishtop(1) HISTORY ======= The varnishsizes utility was developed by Kristian Lyngstøl based on varnishhist. This manual page was written by Kristian Lyngstøl, Dag-Erling Smørgrav and Per Buer. COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2010 Varnish Software AS varnish-3.0.5/doc/sphinx/=build/html/_sources/reference/varnishtop.txt0000644000175000017500000000650112247037213023051 00000000000000============ varnishtop ============ ------------------------- Varnish log entry ranking ------------------------- :Author: Dag-Erling Smørgrav :Date: 2010-05-31 :Version: 1.0 :Manual section: 1 SYNOPSIS ======== varnishtop [-1] [-b] [-C] [-c] [-d] [-f] [-I regex] [-i tag] [-n varnish_name] [-r file] [-V] [-X regex] [-x tag] DESCRIPTION =========== The varnishtop utility reads ``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: -1 Instead of presenting of a continuously updated display, print the statistics once and exit. Implies ``-d``. -b Include log entries which result from communication with a backend server. If neither ``-b`` nor ``-c`` is specified, varnishtop acts as if they both were. -C Ignore case when matching regular expressions. -c Include log entries which result from communication with a client. If neither ``-b`` nor ``-c`` is specified, varnishtop acts as if they both were. -d Process old log entries on startup. Normally, varnishtop will only process entries which are written to the log after it starts. -f Sort and group only on the first field of each log entry. This is useful when displaying e.g. stataddr entries, where the first field is the client IP address. -I regex Include log entries which match the specified regular expression. If neither ``-I`` nor ``-i`` is specified, all log entries are included. -i tag Include log entries with the specified tag. If neither ``-I`` nor ``-i`` is specified, all log entries are included. -p period Specifies the number of seconds to measure over, the default is 60 seconds. The first number in the list is the average number of requests seen over this time period. -n Specifies the name of the varnishd instance to get logs from. If ``-n`` is not specified, the host name is used. -r file Read log entries from file instead of shared memory. -V Display the version number and exit. -X regex Exclude log entries which match the specified regular expression. -x tag Exclude log entries with the specified tag. EXAMPLES ======== The following example displays a continuously updated list of the most frequently requested URLs:: varnishtop -i RxURL The following example displays a continuously updated list of the most commonly used user agents:: varnishtop -i RxHeader -C -I ^User-Agent SEE ALSO ======== * varnishd(1) * varnishhist(1) * varnishlog(1) * varnishncsa(1) * 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. 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-2011 Varnish Software AS varnish-3.0.5/doc/sphinx/=build/html/_sources/reference/varnishhist.txt0000644000175000017500000000544212247037213023221 00000000000000=========== varnishhist =========== ------------------------- Varnish request histogram ------------------------- :Author: Dag-Erling Smørgrav :Date: 2010-05-31 :Version: 1.0 :Manual section: 1 SYNOPSIS ======== varnishhist [-b] [-C] [-c] [-d] [-I regex] [-i tag] [-m tag:regex ...] [-n varnish_name] [-r file] [-V] [-w delay] [-X regex] [-x tag] DESCRIPTION =========== The varnishhist utility reads varnishd(1) shared memory logs and presents a continuously updated histogram show†ing the distribution of the last N requests by their processing. The value of N and the vertical scale are dis†played in the top left corner. The horizontal scale is logarithmic. Hits are marked with a pipe character ("|"), and misses are marked with a hash character ("#"). The following options are available: -b Include log entries which result from communication with a backend server. If neither -b nor -c is specified, varnishhist acts as if they both were. -C Ignore case when matching regular expressions. -c Include log entries which result from communication with a client. If neither -b nor -c is specified, varnishhist acts as if they both were. -d Process old log entries on startup. Normally, varnishhist will only process entries which are written to the log after it starts. -I regex Include log entries which match the specified regular expression. If neither -I nor -i is specified, all log entries are included. -i tag Include log entries with the specified tag. If neither -I nor -i is specified, all log entries are included. -m tag:regex only count transactions where tag matches regex. Multiple -m options are AND-ed together. -n Specifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used. -r file Read log entries from file instead of shared memory. -V Display the version number and exit. -w delay Wait at least delay seconds between each update. The default is 1. file instead of displaying them. The file will be overwritten unless the -a option was specified. -X regex Exclude log entries which match the specified regular expression. -x tag Exclude log entries with the specified tag. SEE ALSO ======== * varnishd(1) * varnishlog(1) * varnishncsa(1) * varnishstat(1) * 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-2011 Varnish Software AS varnish-3.0.5/doc/sphinx/=build/html/_sources/reference/vcl.txt0000644000175000017500000007263512247037213021453 00000000000000.. _reference-vcl: === VCL === ------------------------------ Varnish Configuration Language ------------------------------ :Author: Dag-Erling Smørgrav :Author: Poul-Henning Kamp :Author: Kristian Lyngstøl :Author: Per Buer :Date: 2010-06-02 :Version: 1.0 :Manual section: 7 DESCRIPTION =========== The VCL language is a small domain-specific language designed to be used to define 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 dynamically linked into the server process. SYNTAX ====== The VCL syntax is very simple, and deliberately similar to C and 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. In addition to the C-like assignment (=), comparison (==, !=) and boolean (!, && and \|\|) operators, VCL supports both regular expression and ACL matching using the ~ and the !~ operators. Basic strings are enclosed in " ... ", and may not contain newlines. Long strings are enclosed in {" ... "}. They may contain any character including ", newline and other control characters except for the NUL (0x00) character. Unlike C and Perl, the backslash (\) character has no special meaning in strings in VCL, so it can be freely used in regular expressions without doubling. Strings are concatenated using the '+' operator. Assignments are introduced with the *set* keyword. There are no user-defined variables; values can only be assigned to variables attached to backend, request or document objects. Most of these are typed, and the values assigned to them must have a compatible unit suffix. You can use the *set* keyword to arbitrary HTTP headers. You can remove headers with the *remove* or *unset* keywords, which are synonym. You can use the *rollback* keyword to revert any changes to req at any time. The *synthetic* keyword is used to produce a synthetic response body in vcl_error. It takes a single string as argument. You can force a crash of the client process with the *panic* keyword. *panic* takes a string as argument. The ``return(action)`` keyword terminates the subroutine. *action* can be, depending on context one of * deliver * error * fetch * hash * hit_for_pass * lookup * ok * pass * pipe * restart Please see the list of subroutines to see what return actions are available where. VCL has if tests, but no loops. The contents of another VCL file may be inserted at any point in the code by using the *include* keyword followed by the name of the other file as a quoted string. Backend declarations -------------------- A backend declaration creates and initializes a named backend object: :: backend www { .host = "www.example.com"; .port = "http"; } The backend object can later be used to select a backend at request time: :: if (req.http.host ~ "(?i)^(www.)?example.com$") { set req.backend = www; } To avoid overloading backend servers, .max_connections can be set to limit the maximum number of concurrent backend connections. The timeout parameters can be overridden in the backend declaration. The timeout parameters are .connect_timeout for the time to wait for a backend connection, .first_byte_timeout for the time to wait for the first byte from the backend and .between_bytes_timeout for time to wait between each received byte. These can be set in the declaration like this: :: backend www { .host = "www.example.com"; .port = "http"; .connect_timeout = 1s; .first_byte_timeout = 5s; .between_bytes_timeout = 2s; } To mark a backend as unhealthy after number of items have been added to its saintmode list ``.saintmode_threshold`` can be set to the maximum list size. Setting a value of 0 disables saint mode checking entirely for that backend. The value in the backend declaration overrides the parameter. Directors --------- A director is a logical group of backend servers clustered together for redundancy. The basic role of the director is to let Varnish choose a backend server amongst several so if one is down another can be used. There are several types of directors. The different director types use different algorithms to choose which backend to use. Configuring a director may look like this: :: director b2 random { .retries = 5; { // We can refer to named backends .backend = b1; .weight = 7; } { // Or define them inline .backend = { .host = "fs2"; } .weight = 3; } } The family of random directors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ There are three directors that share the same logic, called the random director, client director and hash director. They each distribute traffic among the backends assigned to it using a random distribution seeded with either the client identity, a random number or the cache hash (typically url). Beyond the initial seed, they act the same. Each backend requires a .weight option which sets the amount of traffic each backend will get compared to the others. Equal weight means equal traffic. A backend with lower weight than an other will get proportionally less traffic. The director has an optional .retries option which defaults to the number of backends the director has. The director will attempt .retries times to find a healthy backend if the first attempt fails. Each attempt re-uses the previous seed in an iterative manner. For the random director this detail is of no importance as it will give different results each time. For the hash and client director, this means the same URL or the same client will fail to the same server consistently. The random director ................... This uses a random number to seed the backend selection. The client director ................... The client director picks a backend based on the clients *identity*. You can set the VCL variable *client.identity* to identify the client by picking up the value of a session cookie or similar. The hash director ................. The hash director will pick a backend based on the URL hash value. This is useful is you are using Varnish to load balance in front of other Varnish caches or other web accelerators as objects won't be duplicated across caches. It will use the value of req.hash, just as the normal cache lookup methods. The round-robin director ~~~~~~~~~~~~~~~~~~~~~~~~ The round-robin director does not take any options. It will use the first backend for the first request, the second backend for the second request and so on, and start from the top again when it gets to the end. If a backend is unhealthy or Varnish fails to connect, it will be skipped. The round-robin director will try all the backends once before giving up. The DNS director ~~~~~~~~~~~~~~~~ The DNS director can use backends in two different ways. Either like the random or round-robin director or using .list: :: director directorname dns { .list = { .host_header = "www.example.com"; .port = "80"; .connect_timeout = 0.4s; "192.168.15.0"/24; "192.168.16.128"/25; } .ttl = 5m; .suffix = "internal.example.net"; } This will specify 384 backends, all using port 80 and a connection timeout of 0.4s. Options must come before the list of IPs in the .list statement. The .list-method does not support IPv6. It is not a white-list, it is an actual list of backends that will be created internally in Varnish - the larger subnet the more overhead. The .ttl defines the cache duration of the DNS lookups. The above example will append "internal.example.net" to the incoming Host header supplied by the client, before looking it up. All settings are optional. Health checks are not thoroughly supported. DNS round robin balancing is supported. If a hostname resolves to multiple backends, the director will divide the traffic between all of them in a round-robin manner. The fallback director ~~~~~~~~~~~~~~~~~~~~~ The fallback director will pick the first backend that is healthy. It considers them in the order in which they are listed in its definition. The fallback director does not take any options. An example of a fallback director: :: director b3 fallback { { .backend = www1; } { .backend = www2; } // will only be used if www1 is unhealthy. { .backend = www3; } // will only be used if both www1 and www2 // are unhealthy. } Backend probes -------------- Backends can be probed to see whether they should be considered healthy or not. The return status can also be checked by using req.backend.healthy. Probes take the following parameters: .url Specify a URL to request from the backend. 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. .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. .initial How many of the probes are considered good when Varnish starts. Defaults to the same amount as the threshold. .expected_response The expected backend HTTP response code. Defaults to 200. .interval Defines how often the probe should check the backend. Default is every 5 seconds. .timeout How fast each probe times out. Default is 2 seconds. A backend with a probe can be defined like this, together with the backend or director: :: backend www { .host = "www.example.com"; .port = "http"; .probe = { .url = "/test.jpg"; .timeout = 0.3 s; .window = 8; .threshold = 3; .initial = 3; } } Or it can be defined separately and then referenced: :: probe healthcheck { .url = "/status.cgi"; .interval = 60s; .timeout = 0.3 s; .window = 8; .threshold = 3; .initial = 3; .expected_response = 200; } backend www { .host = "www.example.com"; .port = "http"; .probe = healthcheck; } If you have many backends this can simplify the config a lot. It is also possible to specify the raw HTTP request: :: probe rawprobe { # NB: \r\n automatically inserted after each string! .request = "GET / HTTP/1.1" "Host: www.foo.bar" "Connection: close"; } 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); } Regular Expressions ------------------- Varnish uses PCRE - Perl-compatible regular expressions. For a complete description of PCRE please see the pcre(3) man page. To send flags to the PCRE engine, such as to turn on *case insensitivity* 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$") { ... } Functions --------- The following built-in functions are available: hash_data(str) Adds a string to the hash input. In default.vcl hash_data() is called on the host and URL of the *request*. 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 regsuball() but this replaces all occurrences. ban(ban expression) Bans all objects in cache that match the expression. ban_url(regex) Bans all objects in cache whose URLs match regex. 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; There are a number of special subroutines which hook into the Varnish workflow. These subroutines may inspect and manipulate HTTP headers and various other aspects of each request, and to a certain extent decide how the request should be handled. Each subroutine terminates by calling one of a small number of keywords which indicates the desired outcome. vcl_init Called when VCL is loaded, before any requests pass through it. Typically used to initialize VMODs. return() values: ok Normal return, VCL continues loading. vcl_recv Called at the beginning of a request, after the complete request has been received and parsed. Its purpose is to decide whether or not to serve the request, how to do it, and, if applicable, which backend to use. The vcl_recv subroutine may terminate with calling return() on one of the following keywords: error code [reason] Return the specified error code to the client and abandon the request. pass Switch to pass mode. Control will eventually pass to vcl_pass. pipe Switch to pipe mode. Control will eventually pass to vcl_pipe. lookup Look up the requested object in the cache. Control will eventually pass to vcl_hit or vcl_miss, depending on whether the object is in the cache. The ``bereq.request`` value will be set to ``GET`` regardless of the value of ``req.request``. vcl_pipe Called upon entering pipe mode. In this mode, the request is passed on to the backend, and any further data from either client or backend is passed on unaltered until either end closes the connection. The vcl_pipe subroutine may terminate with calling return() with one of the following keywords: error code [reason] Return the specified error code to the client and abandon the request. pipe Proceed with pipe mode. 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: error code [reason] Return the specified error code to the client and abandon the request. pass Proceed with pass mode. restart Restart the transaction. Increases the restart counter. If the number of restarts is higher than *max_restarts* varnish emits a guru meditation error. vcl_hash You may call hash_data() on the data you would like to add to the hash. The vcl_hash subroutine may terminate with calling return() with one of the following keywords: hash Proceed. vcl_hit Called after a cache lookup if the requested document was found in the cache. The vcl_hit subroutine may terminate with calling return() with one of the following keywords: deliver Deliver the cached object to the client. Control will eventually pass to vcl_deliver. error code [reason] Return the specified error code to the client and abandon the request. 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. vcl_miss Called after a cache lookup if the requested document was not found in the cache. Its purpose is to decide whether or not to attempt to retrieve the document from the backend, and which backend to use. The vcl_miss subroutine may terminate with calling return() with one of the following keywords: error code [reason] Return the specified error code to the client and abandon the request. pass Switch to pass mode. Control will eventually pass to vcl_pass. fetch Retrieve the requested object from the backend. Control will eventually pass to vcl_fetch. vcl_fetch Called after a document has been successfully retrieved from the backend. The vcl_fetch subroutine may terminate with calling return() with one of the following keywords: deliver Possibly insert the object into the cache, then deliver it to the client. Control will eventually pass to vcl_deliver. error code [reason] Return the specified error code to the client and abandon the request. hit_for_pass Pass in fetch. This will create a hit_for_pass object. Note that the TTL for the hit_for_pass object will be set to what the current value of beresp.ttl. Control will be handled to vcl_deliver on the current request, but subsequent requests will go directly to vcl_pass based on the hit_for_pass object. restart Restart the transaction. Increases the restart counter. If the number of restarts is higher than *max_restarts* varnish emits a guru meditation error. vcl_deliver Called before a cached object is delivered to the client. The vcl_deliver subroutine may terminate with one of the following keywords: 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. vcl_error Called when we hit an error, either explicitly or implicitly due to backend or internal errors. The vcl_error subroutine may terminate by calling return with one of the following keywords: deliver Deliver the error object to the client. restart Restart the transaction. Increases the restart counter. If the number of restarts is higher than *max_restarts* varnish emits a guru meditation error. vcl_fini Called when VCL is discarded only after all requests have exited the VCL. Typically used to clean up VMODs. return() values: ok Normal return, VCL will be discarded. If one of these subroutines is left undefined or terminates without reaching a handling decision, control will be handed over to the builtin default. See the EXAMPLES section for a listing of the default code. Multiple subroutines ~~~~~~~~~~~~~~~~~~~~ If multiple subroutines with the the name of one of the builtin ones are defined, they are concatenated in the order in which they appear in the source. The default versions distributed with Varnish will be implicitly concatenated as a last resort at the end. Example: :: # in file "main.vcl" include "backends.vcl"; include "ban.vcl"; # in file "backends.vcl" sub vcl_recv { if (req.http.host ~ "(?i)example.com") { set req.backend = foo; } elsif (req.http.host ~ "(?i)example.org") { set req.backend = bar; } } # in file "ban.vcl" sub vcl_recv { if (client.ip ~ admin_network) { if (req.http.Cache-Control ~ "no-cache") { ban_url(req.url); } } } Variables ~~~~~~~~~ Although subroutines take no arguments, the necessary information is made available to the handler subroutines through global variables. The following variables are always available: now The current time, in seconds since the epoch. When used in string context it returns a formatted string. The following variables are available in backend declarations: .host Host name or IP address of a backend. .port Service name or port number of a backend. The following variables are available while processing a request: client.ip The client's IP address. client.identity Identification of the client, used to load balance in the client director. server.hostname The host name of the server. server.identity 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 The IP address of the socket on which the client connection was received. server.port The port number of the socket on which the client connection was received. req.request The request type (e.g. "GET", "HEAD"). req.url The requested URL. req.proto The HTTP protocol version used by the client. req.backend The backend to use to service the request. req.backend.healthy Whether the backend is healthy or not. Requires an active probe to be set on the backend. req.http.header The corresponding HTTP header. req.hash_always_miss 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 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.can_gzip Does the client accept the gzip transfer encoding. req.restarts A count of how many times this request has been restarted. req.esi 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 A count of how many levels of ESI requests we're currently at. req.grace Set to a period to enable grace. req.xid Unique ID of this request. The following variables are available while preparing a backend request (either for a cache miss or for pass or pipe mode): bereq.request The request type (e.g. "GET", "HEAD"). bereq.url The requested URL. bereq.proto The HTTP protocol version used to talk to the server. bereq.http.header The corresponding HTTP header. bereq.connect_timeout The time in seconds to wait for a backend connection. bereq.first_byte_timeout The time in seconds to wait for the first byte from the backend. Not available in pipe mode. bereq.between_bytes_timeout The time in seconds to wait between each received byte from the backend. Not available in pipe mode. The following variables are available after the requested object has been retrieved from the backend, before it is entered into the cache. In other words, they are available in vcl_fetch: beresp.do_stream Deliver the object to the client directly without fetching the whole object into varnish. If this request is pass'ed it will not be stored in memory. As of Varnish Cache 3.0 the object will marked as busy as it is delivered so only client can access the object. beresp.do_esi 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_gzip Boolean. Gzip the object before storing it. Defaults to false. beresp.do_gunzip Boolean. Unzip the object before storing it in the cache. Defaults to false. beresp.http.header The corresponding HTTP header. beresp.proto The HTTP protocol version used the backend replied with. beresp.status The HTTP status code returned by the server. beresp.response The HTTP status message returned by the server. beresp.ttl The object's remaining time to live, in seconds. beresp.ttl is writable. beresp.grace Set to a period to enable grace. beresp.saintmode Set to a period to enable saint mode. beresp.backend.name Name of the backend this response was fetched from. beresp.backend.ip IP of the backend this response was fetched from. beresp.backend.port Port of the backend this response was fetched from. beresp.storage Set to force Varnish to save this object to a particular storage backend. After the object is entered into the cache, the following (mostly read-only) variables are available when the object has been located in cache, typically in vcl_hit, or when constructing a synthetic reply in vcl_error: obj.proto The HTTP protocol version used when the object was retrieved. obj.status The HTTP status code returned by the server. obj.response The HTTP status message returned by the server. obj.ttl The object's remaining time to live, in seconds. obj.ttl is writable. obj.lastuse The approximate time elapsed since the object was last requests, in seconds. This variable is also available in vcl_deliver. obj.hits The approximate number of times the object has been delivered. A value of 0 indicates a cache miss. This variable is also available in vcl_deliver. obj.grace The object's grace period in seconds. obj.grace is writable. obj.http.header The corresponding HTTP header. The following variables are available while determining the hash key of an object: req.hash The hash key used to refer to an object in the cache. Used when both reading from and writing to the cache. The following variables are available while preparing a response to the client: resp.proto The HTTP protocol version to use for the response. resp.status The HTTP status code that will be returned. resp.response The HTTP status message that will be returned. resp.http.header The corresponding HTTP header. Values may be assigned to variables using the set keyword: :: sub vcl_recv { # Normalize the Host: header if (req.http.host ~ "(?i)^(www.)?example.com$") { set req.http.host = "www.example.com"; } } HTTP headers can be removed entirely using the remove keyword: :: sub vcl_fetch { # Don't cache cookies remove beresp.http.Set-Cookie; } Grace and saint mode -------------------- If the backend takes a long time to generate an object there is a risk of a thread pile up. In order to prevent this you can enable *grace*. This allows varnish to serve an expired version of the object while a fresh object is being generated by the backend. The following vcl code will make Varnish serve expired objects. All object will be kept up to two minutes past their expiration time or a fresh object is generated. :: sub vcl_recv { set req.grace = 2m; } sub vcl_fetch { set beresp.grace = 2m; } Saint mode is similar to grace mode and relies on the same infrastructure but functions differently. You can add VCL code to vcl_fetch to see whether or not you *like* the response coming from the backend. If you find that the response is not appropriate you can set beresp.saintmode to a time limit and call *restart*. Varnish will then retry other backends to try to fetch the object again. If there are no more backends or if you hit *max_restarts* and we have an object that is younger than what you set beresp.saintmode to be Varnish will serve the object, even if it is stale. EXAMPLES ======== The following code is the equivalent of the default configuration with the backend address set to "backend.example.com" and no backend port specified: :: backend default { .host = "backend.example.com"; .port = "http"; } .. include:: ../../../bin/varnishd/default.vcl :literal: The following example shows how to support multiple sites running on separate backends in the same Varnish instance, by selecting backends based on the request URL: :: backend www { .host = "www.example.com"; .port = "80"; } backend images { .host = "images.example.com"; .port = "80"; } sub vcl_recv { if (req.http.host ~ "(?i)^(www.)?example.com$") { set req.http.host = "www.example.com"; set req.backend = www; } elsif (req.http.host ~ "(?i)^images.example.com$") { set req.backend = images; } else { error 404 "Unknown virtual host"; } } The following snippet demonstrates how to force a minimum TTL for all documents. Note that this is not the same as setting the default_ttl run-time parameter, as that only affects document for which the backend did not specify a TTL: :: import std; # needed for std.log sub vcl_fetch { if (beresp.ttl < 120s) { std.log("Adjusting TTL"); set beresp.ttl = 120s; } } The following snippet demonstrates how to force Varnish to cache documents even when cookies are present: :: sub vcl_recv { if (req.request == "GET" && req.http.cookie) { return(lookup); } } sub vcl_fetch { if (beresp.http.Set-Cookie) { return(deliver); } } The following code implements the HTTP PURGE method as used by Squid for object invalidation: :: acl purge { "localhost"; "192.0.2.1"/24; } sub vcl_recv { if (req.request == "PURGE") { if (!client.ip ~ purge) { error 405 "Not allowed."; } return(lookup); } } sub vcl_hit { if (req.request == "PURGE") { purge; error 200 "Purged."; } } sub vcl_miss { if (req.request == "PURGE") { purge; error 200 "Purged."; } } SEE ALSO ======== * varnishd(1) * vmod_std(7) HISTORY ======= VCL was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS, Redpill Linpro and Varnish Software. This manual page was written by Dag-Erling Smørgrav and later edited by Poul-Henning Kamp and Per Buer. 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-2011 Varnish Software AS varnish-3.0.5/doc/sphinx/=build/html/_sources/reference/vsl.txt0000644000175000017500000000342012247037213021455 00000000000000.. _reference-vsl: ===================== Shared Memory Logging ===================== TTL records ~~~~~~~~~~~ A TTL record is emitted whenever the ttl, grace or keep values for an object is set. The format is:: %u %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" +------------------------------ object XID The last three fields are only present in "RFC" headers. Examples:: 1001 RFC 19 -1 -1 1312966109 4 0 0 23 1001 VCL 10 -1 -1 1312966109 4 1001 VCL 7 -1 -1 1312966111 6 1001 VCL 7 120 -1 1312966111 6 1001 VCL 7 120 3600 1312966111 6 1001 VCL 12 120 3600 1312966113 8 Gzip records ~~~~~~~~~~~~ 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 varnish-3.0.5/doc/sphinx/=build/html/_sources/reference/varnish-cli.txt0000644000175000017500000002535712247037213023105 00000000000000======= varnish ======= ------------------------------ Varnish Command Line Interface ------------------------------ :Author: Per Buer :Date: 2011-03-23 :Version: 0.1 :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 lastst 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(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 choosen 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 lenght. When using newline-terminated commands maximum lenght 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, carrage 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 -------- .. glossary:: :sorted: help [command] Display a list of available commands. If the command is specified, display help for this command. param.set param value Set the parameter specified by param to the specified value. See Run-Time Parameters for a list of parame†ters. param.show [-l] [param] Display a list if run-time parameters and their values. If the -l option is specified, the list includes a brief explanation of each parameter. If a param is specified, display only the value and explanation for this parameter. ping [timestamp] Ping the Varnish cache process, keeping the connection alive. ban *field operator argument* [&& field operator argument [...]] Immediately invalidate all documents matching the ban expression. See *Ban Expressions* for more documentation and examples. ban.list All requests for objects from the cache are matched against items on the ban list. If an object in the cache is older than a matching ban list item, it is considered "banned", and will be fetched from the backend instead. When a ban expression is older than all the objects in the cache, it is removed from the list. ban.list displays the ban list. The output looks something like this (broken into two lines): 0x7fea4fcb0580 1303835108.618863 131G req.http.host ~ www.myhost.com && req.url ~ /some/url The first field is the address of the ban. The second is the time of entry into the list, given as a high precision timestamp. The third field describes many objects point to this ban. When an object is compared to a ban the object is marked with a reference to the newest ban it was tested against. This isn't really useful unless you're debugging. A "G" marks that the ban is "Gone". Meaning it has been marked as a duplicate or it is no longer valid. It stays in the list for effiency reasons. Then follows the actual ban it self. ban.url regexp Immediately invalidate all documents whose URL matches the specified regular expression. Please note that the Host part of the URL is ignored, so if you have several virtual hosts all of them will be banned. Use *ban* to specify a complete ban if you need to narrow it down. quit Close the connection to the varnish admin port. start Start the Varnish cache process if it is not already running. status Check the status of the Varnish cache process. stop Stop the Varnish cache process. vcl.discard configname Discard the configuration specified by configname. This will have no effect if the specified configuration has a non-zero reference count. vcl.inline configname vcl Create a new configuration named configname with the VCL code specified by vcl, which must be a quoted string. vcl.list List available configurations and their respective reference counts. The active configuration is indicated with an asterisk ("*"). vcl.load configname filename Create a new configuration named configname with the contents of the specified file. vcl.show configname Display the source code for the specified configuration. vcl.use configname Start using the configuration specified by configname for all new requests. Existing requests will con†tinue using whichever configuration was in use when they arrived. storage.list Lists the defined storage backends. backend.list Lists the defined backends including health state. backend.set_health matcher state Sets the health state on a specific backend. This is useful if you want to take a certain backend out of sirculations. 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 comparision, "~" 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. 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. Details on authentication ------------------------- 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 reponse 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 name does not end with ".ogg", and where the size of the object is greater than 10 megabytes:: req.url !~ "\.ogg$" && obj.size > 10MB 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" SEE ALSO ======== * varnishd(1) * vanrishadm(1) * vcl(7) HISTORY ======= The varnish manual page was written by Per Buer in 2011. Some of the text was taken from the Varnish Cache wiki, the varnishd(7) man page or the varnish source code. COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2011 Varnish Software AS varnish-3.0.5/doc/sphinx/=build/html/_sources/reference/varnishtest.txt0000644000175000017500000000677412247037213023242 00000000000000=========== varnishtest =========== ------------------------ Test program for Varnish ------------------------ :Author: Stig Sandbeck Mathisen :Author: Kristian Lyngstøl :Date: 2011-11-15 :Version: 1.1 :Manual section: 1 SYNOPSIS ======== varnishtest [-iklLqv] [-n iter] [-D name=val] [-j jobs] [-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: -D name=val Define macro for use in scripts -i Find varnishd in build tree -j jobs Run this many tests in parallel -k Continue on test failure -l Leave /tmp/vtc.* if test fails -L Always leave /tmp/vtc.* -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 -h Show help file File to use as a script Macro definitions that can be overridden. varnishd Path to varnishd to use [varnishd] 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_fetch { set beresp.do_esi = true; if (req.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 * varnishhist(1) * varnishlog(1) * varnishncsa(1) * varnishstat(1) * varnishtop(1) * vcl(7) 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). COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2007-2011 Varnish Software AS varnish-3.0.5/doc/sphinx/=build/html/_sources/reference/shmem.txt0000644000175000017500000000510112247037213021760 00000000000000%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Shared Memory Logging and Statistics %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Varnish uses shared memory for logging and statistics, because it is faster and much more efficient. But it is also tricky in ways a regular logfile is not. When you open a file in "append" mode, the operating system guarantees that whatever you write will not overwrite existing data in the file. The neat result of this is that multiple procesess or threads writing 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 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, 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. When Varnishd starts, if it finds an existing shared memory file, and it can safely read the master_pid field, it will check if that process is running, and if so, fail with an error message, indicating that -n arguments collide. In all other cases, it will delete and create a new shmlog file, in order to provide running readers a cooling off period, where they can discover that there is a new shmlog file, by doing a stat(2) call and checking the st_dev & st_inode fields. Allocations ----------- Sections inside the shared memory file are allocated dynamically, for instance when a new backend is added. While changes happen to the linked list of allocations, the "alloc_seq" header field is zero, and after the change, it gets a value different from what it had before. Deallocations ------------- When a section is freed, its class will change to "Cool" for at least 10 seconds, giving programs using it time to detect the change in alloc_seq header field and/or the change of class. varnish-3.0.5/doc/sphinx/=build/html/_sources/reference/vmod.txt0000644000175000017500000001665712247037213021636 00000000000000%%%%%%%%%%%%%%%%%%%%%% 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(7). This part of the manual is about how you go about writing your own VMOD, how the language interface between C and VCC works etc. This explanation will use the "std" VMOD as example, having a varnish source tree handy may be a good idea. 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 "vmod.py" turns into thaumathurgically challenged C data structures that does all the hard work. The std VMODs vmod.vcc file looks somewhat like this:: Module std Init init_function Function STRING toupper(PRIV_CALL, STRING_LIST) Function STRING tolower(PRIV_VCL, STRING_LIST) Function VOID set_ip_tos(INT) The first line gives the name of the module, nothing special there. The second line specifies an optional "Init" function, which will be called whenever a VCL program which imports this VMOD is loaded. This gives a chance to initialize the module before any of the functions it implements are called. The next three lines specify two functions in the VMOD, along with the types of the arguments, and that is probably where the hardest bit of writing a VMOD is to be found, so we will talk about that at length in a moment. Notice that the third function returns VOID, that makes it a "procedure" in VCL lingo, meaning that it cannot be used in expressions, right side of assignments and such places. Instead it can be used as a primary action, something functions which return a value can not:: sub vcl_recv { std.set_ip_tos(32); } Running vmod.py on the vmod.vcc file, produces an "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 sess; struct VCL_conf; const char * vmod_toupper(struct sess *, struct vmod_priv *, const char *, ...); const char * vmod_tolower(struct sess *, struct vmod_priv *, const char *, ...); int meta_function(void **, const struct VCL_conf *); Those are your C prototypes. Notice the ``vmod_`` prefix on the function names and the C-types as return types and arguments. 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, from simple to nasty. INT C-type: ``int`` An integer as we know and love them. REAL C-type: ``double`` A floating point value DURATION C-type: ``double`` Units: seconds A time interval, as in "25 minutes". TIME C-type: ``double`` Units: seconds since UNIX epoch An absolute time, as in "Mon Sep 13 19:06:01 UTC 2010". STRING C-type: ``const char *`` A NUL-terminated text-string. Can be NULL to indicate that the nonexistent string, for instance:: 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 session or worker 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 do that, by not editing separate pieces of a sting together to one string, until we need to. Consider this contrived example:: set bereq.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 thread_pool_workspace param is big enough. PRIV_VCL See below PRIV_CALL See below VOID C-type: ``void`` Can only be used for return-value, which makes the function a VCL procedure. HEADER C-type: ``enum gethdr_e, const char *`` XXX: explain me IP, BOOL XXX: these types are not released for use in vmods yet. 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 two levels of private pointers, "per call" and "per VCL" "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. "per vcl" private pointers are useful for such global state that applies to all calls in this VCL, for instance flags that determine if regular expressions are case-sensitive in this vmod or similar. The way it works in the vmod code, is that a ``struct vmod_priv *`` is passed to the functions where argument type PRIV_VCL or PRIV_CALL is specified. This structure contains two members:: typedef void vmod_priv_free_f(void *); struct vmod_priv { void *priv; 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 "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 only argument. The "per vcl" pointers is guaranteed to be the last one inspected. varnish-3.0.5/doc/sphinx/=build/html/_sources/reference/varnishadm.txt0000644000175000017500000000474612247037213023021 00000000000000========== varnishadm ========== ---------------------------------- Control a running varnish instance ---------------------------------- :Author: Cecilie Fritzvold :Author: Per Buer :Date: 2010-05-31 :Version: 0.3 :Manual section: 1 SYNOPSIS ======== varnishadm [-t timeout] [-S secret_file] [-T address:port] [-n name] [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 ======= -t timeout Wait no longer than this many seconds for an operation to finish. -S secret_file 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 address:port Connect to the management interface at the specified address and port. -n name Connect to the instance of varnishd with this name. The syntax and operation of the actual CLI interface is described in the varnish-cli(7) manual page. Parameteres are described in 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 ======== * varnishd(1) HISTORY ======= The varnishadm utility and this manual page were written by Cecilie Fritzvold. Converted to reStructured and updated in 2010 by Per Buer. COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2007-2011 Varnish Software AS varnish-3.0.5/doc/sphinx/=build/html/_sources/reference/varnishncsa.txt0000644000175000017500000001113712247037213023174 00000000000000=========== varnishncsa =========== --------------------------------------------------------- Display Varnish logs in Apache / NCSA combined log format --------------------------------------------------------- :Author: Dag-Erling Smørgrav :Date: 2010-05-31 :Version: 1.0 :Manual section: 1 SYNOPSIS ======== varnishncsa [-a] [-C] [-D] [-d] [-f] [-F format] [-I regex] [-i tag] [-n varnish_name] [-m tag:regex ...] [-P file] [-r file] [-V] [-w file] [-X regex] [-x tag] DESCRIPTION =========== The varnishncsa utility reads varnishd(1) shared memory logs and presents them in the Apache / NCSA "combined" log format. The following options are available: -a When writing to a file, append to it rather than overwrite it. -C Ignore case when matching regular expressions. -D Daemonize. -d Process old log entries on startup. Normally, varnishncsa will only process entries which are written to the log after it starts. -f Prefer the X-Forwarded-For HTTP header over client.ip in the log output. -F format Specify the log format used. If no format is specified the default log format is used. Currently it 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. %H The request protocol. Defaults to HTTP/1.0 if not known. %h Remote host. Defaults to '-' if not known. Defaults to 127.0.0.1 for backend requests. %{X}i The contents of request header X. %l Remote logname (always '-') %m Request method. Defaults to '-' if not known. %q The query string, if no query string exists, an empty string. %{X}o The contents of response header X. %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). %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 to the first byte from the backend arrived 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 error. VCL_Log:key Output value set by std.log("key:value") in VCL. -m tag:regex only list records where tag matches regex. Multiple -m options are AND-ed together. -n Specifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used. -P file Write the process's PID to the specified file. -r file Read log entries from file instead of shared memory. -V Display the version number and exit. -w file Write log entries to file instead of displaying them. The file will be overwritten unless the -a option was specified. If varnishncsa receives a SIGHUP while writing to a file, it will reopen the file, allowing the old one to be rotated away. -X regex Exclude log entries which match the specified regular expression. -x tag Exclude log entries with the specified tag. If the -o option was specified, a tag and a regex argument must be given. varnishncsa will then only log for request groups which include that tag and the regular expression matches on that tag. SEE ALSO ======== * varnishd(1) * varnishhist(1) * varnishlog(1) * varnishstat(1) * varnishtop(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 written by Dag-Erling Smørgrav ⟨des@des.no⟩. 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-2011 Varnish Software AS varnish-3.0.5/doc/sphinx/=build/html/_sources/reference/varnishlog.txt0000644000175000017500000001001712247037213023025 00000000000000.. _ref-varnishlog: ========== varnishlog ========== -------------------- Display Varnish logs -------------------- :Author: Dag-Erling Smørgrav :Author: Per Buer :Date: 2010-05-31 :Version: 0.2 :Manual section: 1 SYNOPSIS ======== varnishlog [-a] [-b] [-C] [-c] [-D] [-d] [-I regex] [-i tag] [-k keep] [-n varnish_name] [-o] [-O] [-m tag:regex ...] [-P file] [-r file] [-s num] [-u] [-V] [-w file] [-X regex] [-x tag] DESCRIPTION =========== The varnishlog utility reads and presents varnishd(1) shared memory logs. The following options are available: -a When writing to a file, append to it rather than overwrite it. -b Include log entries which result from communication with a backend server. If neither -b nor -c is specified, varnishlog acts as if they both were. -C Ignore case when matching regular expressions. -c Include log entries which result from communication with a client. If neither -b nor -c is specified, varnishlog acts as if they both were. -D Daemonize. -d Process old log entries on startup. Normally, varnishlog will only process entries which are written to the log after it starts. -I regex Include log entries which match the specified regular expression. If neither -I nor -i is specified, all log entries are included. -i tag Include log entries with the specified tag. If neither -I nor -i is specified, all log entries are included. -k num Only show the first num log records. -m tag:regex only list transactions where tag matches regex. Multiple -m options are AND-ed together. Can not be combined with -O -n Specifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used. -o Ignored for compatibility with earlier versions. -O Do not group log entries by request ID. Can not be combined with -m. -P file Write the process's PID to the specified file. -r file Read log entries from file instead of shared memory. -s num Skip the first num log records. -u Unbuffered output. -V Display the version number and exit. -w file Write log entries to file instead of displaying them. The file will be overwritten unless the -a option was specified. If varnishlog receives a SIGHUP while writing to a file, it will reopen the file, allowing the old one to be rotated away. -X regex Exclude log entries which match the specified regular expression. -x tag Exclude log entries with the specified tag. TAGS ==== The following log entry tags are currently defined: * Backend * BackendClose * BackendOpen * BackendReuse * BackendXID * CLI * ClientAddr * Debug * Error * ExpBan * ExpKill * ExpPick * Hit * HitPass * HttpError * HttpGarbage * Length * ObjHeader * ObjLostHeader * ObjProtocol * ObjRequest * ObjResponse * ObjStatus * ObjURL * ReqEnd * ReqStart * RxHeader * RxLostHeader * RxProtocol * RxRequest * RxResponse * RxStatus * RxURL * SessionClose * SessionOpen * StatAddr * StatSess * TTL * TxHeader * TxLostHeader * TxProtocol * TxRequest * TxResponse * TxStatus * TxURL * VCL_acl * VCL_call * VCL_return * VCL_trace * WorkThread EXAMPLES ======== The following command line simply copies all log entries to a log file:: $ varnishlog -w /var/log/varnish.log The following command line reads that same log file and displays requests for the front page:: $ varnishlog -r /var/log/varnish.log -c -m 'RxURL:^/$' SEE ALSO ======== * varnishd(1) * varnishhist(1) * varnishncsa(1) * varnishstat(1) * varnishtop(1) HISTORY ======= The varnishlog utility was developed by Poul-Henning Kamp ⟨phk@phk.freebsd.dk⟩ in cooperation with Verdens Gang AS, Varnish Software AS and Varnish Software. This manual page was initially written by Dag-Erling Smørgrav. 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-2011 Varnish Software AS varnish-3.0.5/doc/sphinx/=build/html/_sources/reference/varnishd.txt0000644000175000017500000002772712247037213022507 00000000000000.. _ref-varnishd: ========= varnishd ========= ----------------------- HTTP accelerator daemon ----------------------- :Author: Dag-Erling Smørgrav :Author: Stig Sandbeck Mathisen :Author: Per Buer :Date: 2010-05-31 :Version: 1.0 :Manual section: 1 SYNOPSIS ======== varnishd [-a address[:port]] [-b host[:port]] [-d] [-F] [-f config] [-g group] [-h type[,options]] [-i identity] [-l shmlogsize] [-n name] [-P file] [-p param=value] [-s type[,options]] [-T address[:port]] [-t ttl] [-u user] [-V] [-w min[,max[,timeout]]] 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][,address[:port][...] 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, the default HTTP port as listed in /etc/services is used. Multiple listening addresses and ports can be speci†fied as a whitespace- or comma-separated list. -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 Run in the foreground. -f config Use the specified VCL configuration file instead of the builtin default. See vcl(7) for details on VCL syntax. When no configuration is supplied varnishd will not start the cache process. -g group Specifies the name of an unprivileged group to which the child process should switch before it starts accepting connections. This is a shortcut for specifying the group run-time parameter. -h type[,options] Specifies the hash algorithm. See Hash Algorithms for a list of supported algorithms. -i identity Specify the identity of the varnish server. This can be accessed using server.identity from VCL -l shmlogsize Specify size of shmlog file. Scaling suffixes like 'k', 'm' can be used up to (e)tabytes. Default is 80 Megabytes. Specifying less than 8 Megabytes is unwise. -n name Specify a name for this instance. Amonst 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 process's PID to the specified file. -p param=value Set the parameter specified by param to the specified value. See Run-Time Parameters for a list of parameters. This option can be used multiple times to specify multiple parameters. -S file Path to a file containing a secret used for authorizing access to the management port. -s [name=]type[,options] Use the specified storage backend. See Storage Types for a list of supported storage types. This option can be used multiple times to specify multiple storage files. You can name the different backends. Varnish will then reference that backend with the given name in logs, statistics, etc. -T address[:port] Offer a management interface on the specified address and port. See Management Interface for a list of management commands. -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. -t ttl Specifies a hard minimum time to live for cached documents. This is a shortcut for specifying the default_ttl run-time parameter. -u user Specifies the name of an unprivileged user to which the child process should switch before it starts accepting connections. This is a shortcut for specifying the user run- time parameter. If specifying both a user and a group, the user should be specified first. -V Display the version number and exit. -w min[,max[,timeout]] Start at least min but no more than max worker threads with the specified idle timeout. This is a shortcut for specifying the thread_pool_min, thread_pool_max and thread_pool_timeout run-time parameters. If only one number is specified, thread_pool_min and thread_pool_max are both set to this number, and thread_pool_timeout has no effect. Hash Algorithms --------------- The following hash algorithms are available: simple_list A simple doubly-linked list. Not recommended for production use. classic[,buckets] A standard hash table. This is the default. 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. critbit A self-scaling tree structure. The default hash algorithm in 2.1. In comparison to a more traditional B tree the critbit tree is almost completely lockless. Storage Types ------------- The following storage types are available: 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 approximately 1k of memory per object will be used for various internal structures. 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. Mallocs performance is bound by memory speed so it is very fast. file[,path[,size[,granularity]]] The file backend stores objects in memory backed by a file on disk with mmap. This is the default storage backend and unless you specify another storage this one will used along with Transient storage. 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 fol†lowed 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 size is expressed as a percentage of the free space on the file system where it resides. The default size is 50%. 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. 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 size is assumed to be in bytes, unless followed by one of the suffixes described for size except for %. The default size is the VM page size. The size should be reduced if you have many small objects. File performance is typically limited by the write speed of the device, and depending on use, the seek time. 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 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. 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. Transient Storage ----------------- If you name any of your storage backend "Transient" it will be used for transient (short lived) objects. By default Varnish would use an unlimited malloc backend for this. 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 ------------------- 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. Here is a list of all parameters, current as of last time we remembered to update the manual page. This text is produced from the same text you will find in the CLI if you use the param.show command, so should there be a new parameter which is not listed here, you can find the description using the CLI commands. Be aware that on 32 bit systems, certain default values, such as workspace_client (=16k), thread_pool_workspace (=16k), http_resp_size (=8k), http_req_size (=12k), gzip_stack_buffer (=4k) and thread_pool_stack (=64k) are reduced relative to the values listed here, in order to conserve VM space. .. include:: params.rst SEE ALSO ======== * varnish-cli(7) * varnishlog(1) * varnishhist(1) * varnishncsa(1) * varnishstat(1) * varnishtop(1) * vcl(7) HISTORY ======= The varnishd daemon was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS, Varnish Software AS and Varnish Software. This manual page was written by Dag-Erling Smørgrav with updates by Stig Sandbeck Mathisen ⟨ssm@debian.org⟩ COPYRIGHT ========= This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2007-2011 Varnish Software AS varnish-3.0.5/doc/sphinx/=build/html/_sources/reference/vmod_std.txt0000644000175000017500000000632112247037213022473 00000000000000======== vmod_std ======== ----------------------- Varnish Standard Module ----------------------- :Author: Per Buer :Date: 2011-05-19 :Version: 1.0 :Manual section: 3 SYNOPSIS ======== import std DESCRIPTION =========== The Varnish standard module contains useful, generic function that don't quite fit in the VCL core, but are still considered very useful to a broad audience. FUNCTIONS ========= toupper ------- Prototype toupper(STRING s) Return value String Description Converts the string *s* to upper case. Example set beresp.http.x-scream = std.toupper("yes!"); tolower ------- Prototype tolower(STRING s) Return value String Description Converts the string *s* to lower case. Example set beresp.http.x-nice = std.tolower("VerY"); set_ip_tos ---------- Prototype set_ip_tos(INT i) Return value Void Description Sets the Type-of-Service flag for the current session. Please note that the TOS flag 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(0x0); | } random ------ Prototype random(REAL a, REAL b) Return value Real Description Returns a random REAL number between *a* and *b*. Example set beresp.http.x-random-number = std.random(1, 100); log --- Prototype log(STRING string) Return value Void Description Logs *string* to the shared memory log. Example std.log("Something fishy is going on with the vhost " + req.host); syslog ------ Prototype syslog(INT priority, STRING string) Return value Void Description Logs *string* to syslog marked with *priority*. Example std.syslog( LOG_USER|LOG_ALERT, "There is serious troble"); fileread -------- Prototype fileread(STRING filename) Return value 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.x-served-by = std.fileread("/etc/hostname"); duration -------- Prototype duration(STRING s, DURATION fallback) Return value Duration Description Converts the string *s* to seconds. *s* can be quantified with the usual s (seconds), m (minutes), h (hours), d (days) and w (weeks) units. If *s* fails to parse, *fallback* will be used. Example set beresp.ttl = std.duration("1w", 3600s); integer -------- Prototype integer(STRING s, INT fallback) Return value Int Description Converts the string *s* to an integer. If *s* fails to parse, *fallback* will be used Example if (std.integer(beresp.http.x-foo, 0) > 5) { ... } collect ------- Prototype collect(HEADER header) Return value Void Description Collapses the header, joining the headers into one. Example std.collect(req.http.cookie); This will collapse several Cookie: headers into one, long cookie header. SEE ALSO ======== * vcl(7) * varnishd(1) 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) 2011 Varnish Software varnish-3.0.5/doc/sphinx/=build/html/_sources/glossary/0000755000175000017500000000000012247037213020076 500000000000000varnish-3.0.5/doc/sphinx/=build/html/_sources/glossary/index.txt0000644000175000017500000000676212247037213021701 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 proces is a manager/nanny process which handles configuration, parameters, compilation of :term:VCL etc. but it does never get near the actual HTTP traffic. worker (process) The worker process is started and configured by the master process. This is the process that does all the work you actually want varnish to do. If the worker dies, the master will try start it again, to keep your website alive. backend The HTTP server varnishd is caching for. This can be any sort of device that handles HTTP requests, including, but not limited to: a webserver, a CMS, a load-balancer another varnishd, etc. client The program which sends varnishd a HTTP request, typically a browser, but do not forget to think about spiders, robots script-kiddies and criminals. varnishstat Program which presents varnish statistics counters. varnishlog Program which presents varnish transaction log in native format. varnishtop Program which gives real-time "top-X" list view of transaction log. varnishncsa Program which presents varnish transaction log in "NCSA" format. varnishhist Eye-candy program showing responsetime histogram in 1980ies ASCII-art style. varnishtest Program to test varnishd's behaviour with, simulates backend and client according to test-scripts. .. comment: "components of traffic ---------------------------------" header A HTTP protocol header, like "Accept-Encoding:". request What the client sends to varnishd and varnishd sends to the backend. response What the backend returns to varnishd and varnishd returns to the client. When the response is stored in varnishd's cache, we call it an object. backend response The response specifically served from a backend to varnishd. The backend response may be manipulated in vcl_fetch. 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 reponse 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-3.0.5/doc/sphinx/=build/html/_sources/phk/0000755000175000017500000000000012247037213017015 500000000000000varnish-3.0.5/doc/sphinx/=build/html/_sources/phk/backends.txt0000644000175000017500000001020212247037213021243 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 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 varnish-3.0.5/doc/sphinx/=build/html/_sources/phk/gzip.txt0000644000175000017500000001312112247037213020445 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_fetch{} 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_fetch{} 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_fetch { if (req.url ~ "html$") { set beresp.do_gzip = true; } } GZIP and ESI ------------ First, note the new syntax for activating ESI:: sub vcl_fetch { 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 bereq.http.accept-encoding; } } sub vcl_fetch { 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-3.0.5/doc/sphinx/=build/html/_sources/phk/thoughts.txt0000644000175000017500000000266312247037213021352 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-3.0.5/doc/sphinx/=build/html/_sources/phk/thetoolsweworkwith.txt0000644000175000017500000001751512247037213023503 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 appearantly "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 appearantly 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-3.0.5/doc/sphinx/=build/html/_sources/phk/index.txt0000644000175000017500000000057212247037213020611 00000000000000.. _phk: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Poul-Hennings random outbursts %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% You may or may not want to know what Poul-Henning thinks. .. toctree:: 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-3.0.5/doc/sphinx/=build/html/_sources/phk/platforms.txt0000644000175000017500000000707212247037213021513 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*. Yes, we'd like to bump Solaris to tier-A but I have to say that the uncertainty about the future for OpenSolaris, and lack of time to care and feed the somewhat altmodishe socket-API on Solaris, does keep the enthusiasm bounded. 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 varnish-3.0.5/doc/sphinx/=build/html/_sources/phk/sphinx.txt0000644000175000017500000000612212247037213021010 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:) http://docs.python.org/py3k/reference/expressions.html Dependency wise, that means you can edit docs with no special tools, you need python+docutils+sphinx to format HTML and a LaTex (pdflatex ?) to produce PDFs, something I only expect to happen on the project server on a regular basis. I can live with that, I might even rewrite the VCC scripts from Tcl to Python in that case. Poul-Henning, 2010-04-11 .. _Sphinx: http://sphinx.pocoo.org/ .. _reStructuredText: http://docutils.sourceforge.net/rst.html varnish-3.0.5/doc/sphinx/=build/html/_sources/phk/ssl.txt0000644000175000017500000000537012247037213020304 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 goodby 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-3.0.5/doc/sphinx/=build/html/_sources/phk/autocrap.txt0000644000175000017500000000577412247037213021331 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 activites of the autocrap generated configure script in Varnish are: * Looks for ANSI-C header files (show me a system later than 1995 without them ?) * Existence and support for POSIX mandated symlinks, (which are not used by Varnish btw.) * Tests, 19 different ways, that the compiler is not a relic from SYS III days. (Find me just one SYS III running computer with an ethernet interface ?) * Checks if the ISO-C and POSIX mandated ``cos()`` function exists in ``libm`` (No, I have no idea either...) &c. &c. &c. Some day when I have the time, I will rip out all the autocrap stuff and replace it with a 5 line shellscript that calls ``uname -s``. Poul-Henning, 2010-04-20 varnish-3.0.5/doc/sphinx/=build/html/_sources/phk/ipv6suckage.txt0000644000175000017500000000445512247037213021735 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-3.0.5/doc/sphinx/=build/html/_sources/phk/vcl_expr.txt0000644000175000017500000000347012247037213021324 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-3.0.5/doc/sphinx/=build/html/_sources/phk/three-zero.txt0000644000175000017500000000524112247037213021564 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-3.0.5/doc/sphinx/=build/html/_sources/phk/varnish_does_not_hash.txt0000644000175000017500000001211012247037213024040 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 Shannons 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 loosing any of the entropy. Needless to say, the more entropy you have to begin with, the more of it you can afford to loose, and loose 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 hash_data() are fed, 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 bytes long 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-3.0.5/doc/sphinx/=build/html/_sources/phk/barriers.txt0000644000175000017500000001344612247037213021317 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-3.0.5/doc/sphinx/=build/html/genindex.html0000644000175000017500000002367612247037213017036 00000000000000 Index — Varnish version 3.0.5 documentation varnish-3.0.5/doc/sphinx/=build/html/_static/0000755000175000017500000000000012247037213016037 500000000000000varnish-3.0.5/doc/sphinx/=build/html/_static/underscore.js0000644000175000017500000012071112247037213020470 00000000000000// Underscore.js 1.4.4 // http://underscorejs.org // (c) 2009-2013 Jeremy Ashkenas, DocumentCloud Inc. // Underscore may be freely distributed under the MIT license. (function() { // Baseline setup // -------------- // Establish the root object, `window` in the browser, or `global` on the server. var root = this; // Save the previous value of the `_` variable. var previousUnderscore = root._; // Establish the object that gets returned to break out of a loop iteration. var breaker = {}; // Save bytes in the minified (but not gzipped) version: var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype; // Create quick reference variables for speed access to core prototypes. var push = ArrayProto.push, slice = ArrayProto.slice, concat = ArrayProto.concat, toString = ObjProto.toString, hasOwnProperty = ObjProto.hasOwnProperty; // All **ECMAScript 5** native function implementations that we hope to use // are declared here. var nativeForEach = ArrayProto.forEach, nativeMap = ArrayProto.map, nativeReduce = ArrayProto.reduce, nativeReduceRight = ArrayProto.reduceRight, nativeFilter = ArrayProto.filter, nativeEvery = ArrayProto.every, nativeSome = ArrayProto.some, nativeIndexOf = ArrayProto.indexOf, nativeLastIndexOf = ArrayProto.lastIndexOf, nativeIsArray = Array.isArray, nativeKeys = Object.keys, nativeBind = FuncProto.bind; // Create a safe reference to the Underscore object for use below. var _ = function(obj) { if (obj instanceof _) return obj; if (!(this instanceof _)) return new _(obj); this._wrapped = obj; }; // Export the Underscore object for **Node.js**, with // backwards-compatibility for the old `require()` API. If we're in // the browser, add `_` as a global object via a string identifier, // for Closure Compiler "advanced" mode. if (typeof exports !== 'undefined') { if (typeof module !== 'undefined' && module.exports) { exports = module.exports = _; } exports._ = _; } else { root._ = _; } // Current version. _.VERSION = '1.4.4'; // Collection Functions // -------------------- // The cornerstone, an `each` implementation, aka `forEach`. // Handles objects with the built-in `forEach`, arrays, and raw objects. // Delegates to **ECMAScript 5**'s native `forEach` if available. var each = _.each = _.forEach = function(obj, iterator, context) { if (obj == null) return; if (nativeForEach && obj.forEach === nativeForEach) { obj.forEach(iterator, context); } else if (obj.length === +obj.length) { for (var i = 0, l = obj.length; i < l; i++) { if (iterator.call(context, obj[i], i, obj) === breaker) return; } } else { for (var key in obj) { if (_.has(obj, key)) { if (iterator.call(context, obj[key], key, obj) === breaker) return; } } } }; // Return the results of applying the iterator to each element. // Delegates to **ECMAScript 5**'s native `map` if available. _.map = _.collect = function(obj, iterator, context) { var results = []; if (obj == null) return results; if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context); each(obj, function(value, index, list) { results[results.length] = iterator.call(context, value, index, list); }); return results; }; var reduceError = 'Reduce of empty array with no initial value'; // **Reduce** builds up a single result from a list of values, aka `inject`, // or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available. _.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) { var initial = arguments.length > 2; if (obj == null) obj = []; if (nativeReduce && obj.reduce === nativeReduce) { if (context) iterator = _.bind(iterator, context); return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator); } each(obj, function(value, index, list) { if (!initial) { memo = value; initial = true; } else { memo = iterator.call(context, memo, value, index, list); } }); if (!initial) throw new TypeError(reduceError); return memo; }; // The right-associative version of reduce, also known as `foldr`. // Delegates to **ECMAScript 5**'s native `reduceRight` if available. _.reduceRight = _.foldr = function(obj, iterator, memo, context) { var initial = arguments.length > 2; if (obj == null) obj = []; if (nativeReduceRight && obj.reduceRight === nativeReduceRight) { if (context) iterator = _.bind(iterator, context); return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator); } var length = obj.length; if (length !== +length) { var keys = _.keys(obj); length = keys.length; } each(obj, function(value, index, list) { index = keys ? keys[--length] : --length; if (!initial) { memo = obj[index]; initial = true; } else { memo = iterator.call(context, memo, obj[index], index, list); } }); if (!initial) throw new TypeError(reduceError); return memo; }; // Return the first value which passes a truth test. Aliased as `detect`. _.find = _.detect = function(obj, iterator, context) { var result; any(obj, function(value, index, list) { if (iterator.call(context, value, index, list)) { result = value; return true; } }); return result; }; // Return all the elements that pass a truth test. // Delegates to **ECMAScript 5**'s native `filter` if available. // Aliased as `select`. _.filter = _.select = function(obj, iterator, context) { var results = []; if (obj == null) return results; if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context); each(obj, function(value, index, list) { if (iterator.call(context, value, index, list)) results[results.length] = value; }); return results; }; // Return all the elements for which a truth test fails. _.reject = function(obj, iterator, context) { return _.filter(obj, function(value, index, list) { return !iterator.call(context, value, index, list); }, context); }; // Determine whether all of the elements match a truth test. // Delegates to **ECMAScript 5**'s native `every` if available. // Aliased as `all`. _.every = _.all = function(obj, iterator, context) { iterator || (iterator = _.identity); var result = true; if (obj == null) return result; if (nativeEvery && obj.every === nativeEvery) return obj.every(iterator, context); each(obj, function(value, index, list) { if (!(result = result && iterator.call(context, value, index, list))) return breaker; }); return !!result; }; // Determine if at least one element in the object matches a truth test. // Delegates to **ECMAScript 5**'s native `some` if available. // Aliased as `any`. var any = _.some = _.any = function(obj, iterator, context) { iterator || (iterator = _.identity); var result = false; if (obj == null) return result; if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context); each(obj, function(value, index, list) { if (result || (result = iterator.call(context, value, index, list))) return breaker; }); return !!result; }; // Determine if the array or object contains a given value (using `===`). // Aliased as `include`. _.contains = _.include = function(obj, target) { if (obj == null) return false; if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1; return any(obj, function(value) { return value === target; }); }; // Invoke a method (with arguments) on every item in a collection. _.invoke = function(obj, method) { var args = slice.call(arguments, 2); var isFunc = _.isFunction(method); return _.map(obj, function(value) { return (isFunc ? method : value[method]).apply(value, args); }); }; // Convenience version of a common use case of `map`: fetching a property. _.pluck = function(obj, key) { return _.map(obj, function(value){ return value[key]; }); }; // Convenience version of a common use case of `filter`: selecting only objects // containing specific `key:value` pairs. _.where = function(obj, attrs, first) { if (_.isEmpty(attrs)) return first ? null : []; return _[first ? 'find' : 'filter'](obj, function(value) { for (var key in attrs) { if (attrs[key] !== value[key]) return false; } return true; }); }; // Convenience version of a common use case of `find`: getting the first object // containing specific `key:value` pairs. _.findWhere = function(obj, attrs) { return _.where(obj, attrs, true); }; // Return the maximum element or (element-based computation). // Can't optimize arrays of integers longer than 65,535 elements. // See: https://bugs.webkit.org/show_bug.cgi?id=80797 _.max = function(obj, iterator, context) { if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) { return Math.max.apply(Math, obj); } if (!iterator && _.isEmpty(obj)) return -Infinity; var result = {computed : -Infinity, value: -Infinity}; each(obj, function(value, index, list) { var computed = iterator ? iterator.call(context, value, index, list) : value; computed >= result.computed && (result = {value : value, computed : computed}); }); return result.value; }; // Return the minimum element (or element-based computation). _.min = function(obj, iterator, context) { if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) { return Math.min.apply(Math, obj); } if (!iterator && _.isEmpty(obj)) return Infinity; var result = {computed : Infinity, value: Infinity}; each(obj, function(value, index, list) { var computed = iterator ? iterator.call(context, value, index, list) : value; computed < result.computed && (result = {value : value, computed : computed}); }); return result.value; }; // Shuffle an array. _.shuffle = function(obj) { var rand; var index = 0; var shuffled = []; each(obj, function(value) { rand = _.random(index++); shuffled[index - 1] = shuffled[rand]; shuffled[rand] = value; }); return shuffled; }; // An internal function to generate lookup iterators. var lookupIterator = function(value) { return _.isFunction(value) ? value : function(obj){ return obj[value]; }; }; // Sort the object's values by a criterion produced by an iterator. _.sortBy = function(obj, value, context) { var iterator = lookupIterator(value); return _.pluck(_.map(obj, function(value, index, list) { return { value : value, index : index, criteria : iterator.call(context, value, index, list) }; }).sort(function(left, right) { var a = left.criteria; var b = right.criteria; if (a !== b) { if (a > b || a === void 0) return 1; if (a < b || b === void 0) return -1; } return left.index < right.index ? -1 : 1; }), 'value'); }; // An internal function used for aggregate "group by" operations. var group = function(obj, value, context, behavior) { var result = {}; var iterator = lookupIterator(value || _.identity); each(obj, function(value, index) { var key = iterator.call(context, value, index, obj); behavior(result, key, value); }); return result; }; // Groups the object's values by a criterion. Pass either a string attribute // to group by, or a function that returns the criterion. _.groupBy = function(obj, value, context) { return group(obj, value, context, function(result, key, value) { (_.has(result, key) ? result[key] : (result[key] = [])).push(value); }); }; // Counts instances of an object that group by a certain criterion. Pass // either a string attribute to count by, or a function that returns the // criterion. _.countBy = function(obj, value, context) { return group(obj, value, context, function(result, key) { if (!_.has(result, key)) result[key] = 0; result[key]++; }); }; // Use a comparator function to figure out the smallest index at which // an object should be inserted so as to maintain order. Uses binary search. _.sortedIndex = function(array, obj, iterator, context) { iterator = iterator == null ? _.identity : lookupIterator(iterator); var value = iterator.call(context, obj); var low = 0, high = array.length; while (low < high) { var mid = (low + high) >>> 1; iterator.call(context, array[mid]) < value ? low = mid + 1 : high = mid; } return low; }; // Safely convert anything iterable into a real, live array. _.toArray = function(obj) { if (!obj) return []; if (_.isArray(obj)) return slice.call(obj); if (obj.length === +obj.length) return _.map(obj, _.identity); return _.values(obj); }; // Return the number of elements in an object. _.size = function(obj) { if (obj == null) return 0; return (obj.length === +obj.length) ? obj.length : _.keys(obj).length; }; // Array Functions // --------------- // Get the first element of an array. Passing **n** will return the first N // values in the array. Aliased as `head` and `take`. The **guard** check // allows it to work with `_.map`. _.first = _.head = _.take = function(array, n, guard) { if (array == null) return void 0; return (n != null) && !guard ? slice.call(array, 0, n) : array[0]; }; // Returns everything but the last entry of the array. Especially useful on // the arguments object. Passing **n** will return all the values in // the array, excluding the last N. The **guard** check allows it to work with // `_.map`. _.initial = function(array, n, guard) { return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n)); }; // Get the last element of an array. Passing **n** will return the last N // values in the array. The **guard** check allows it to work with `_.map`. _.last = function(array, n, guard) { if (array == null) return void 0; if ((n != null) && !guard) { return slice.call(array, Math.max(array.length - n, 0)); } else { return array[array.length - 1]; } }; // Returns everything but the first entry of the array. Aliased as `tail` and `drop`. // Especially useful on the arguments object. Passing an **n** will return // the rest N values in the array. The **guard** // check allows it to work with `_.map`. _.rest = _.tail = _.drop = function(array, n, guard) { return slice.call(array, (n == null) || guard ? 1 : n); }; // Trim out all falsy values from an array. _.compact = function(array) { return _.filter(array, _.identity); }; // Internal implementation of a recursive `flatten` function. var flatten = function(input, shallow, output) { each(input, function(value) { if (_.isArray(value)) { shallow ? push.apply(output, value) : flatten(value, shallow, output); } else { output.push(value); } }); return output; }; // Return a completely flattened version of an array. _.flatten = function(array, shallow) { return flatten(array, shallow, []); }; // Return a version of the array that does not contain the specified value(s). _.without = function(array) { return _.difference(array, slice.call(arguments, 1)); }; // Produce a duplicate-free version of the array. If the array has already // been sorted, you have the option of using a faster algorithm. // Aliased as `unique`. _.uniq = _.unique = function(array, isSorted, iterator, context) { if (_.isFunction(isSorted)) { context = iterator; iterator = isSorted; isSorted = false; } var initial = iterator ? _.map(array, iterator, context) : array; var results = []; var seen = []; each(initial, function(value, index) { if (isSorted ? (!index || seen[seen.length - 1] !== value) : !_.contains(seen, value)) { seen.push(value); results.push(array[index]); } }); return results; }; // Produce an array that contains the union: each distinct element from all of // the passed-in arrays. _.union = function() { return _.uniq(concat.apply(ArrayProto, arguments)); }; // Produce an array that contains every item shared between all the // passed-in arrays. _.intersection = function(array) { var rest = slice.call(arguments, 1); return _.filter(_.uniq(array), function(item) { return _.every(rest, function(other) { return _.indexOf(other, item) >= 0; }); }); }; // Take the difference between one array and a number of other arrays. // Only the elements present in just the first array will remain. _.difference = function(array) { var rest = concat.apply(ArrayProto, slice.call(arguments, 1)); return _.filter(array, function(value){ return !_.contains(rest, value); }); }; // Zip together multiple lists into a single array -- elements that share // an index go together. _.zip = function() { var args = slice.call(arguments); var length = _.max(_.pluck(args, 'length')); var results = new Array(length); for (var i = 0; i < length; i++) { results[i] = _.pluck(args, "" + i); } return results; }; // Converts lists into objects. Pass either a single array of `[key, value]` // pairs, or two parallel arrays of the same length -- one of keys, and one of // the corresponding values. _.object = function(list, values) { if (list == null) return {}; var result = {}; for (var i = 0, l = list.length; i < l; i++) { if (values) { result[list[i]] = values[i]; } else { result[list[i][0]] = list[i][1]; } } return result; }; // If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**), // we need this function. Return the position of the first occurrence of an // item in an array, or -1 if the item is not included in the array. // Delegates to **ECMAScript 5**'s native `indexOf` if available. // If the array is large and already in sort order, pass `true` // for **isSorted** to use binary search. _.indexOf = function(array, item, isSorted) { if (array == null) return -1; var i = 0, l = array.length; if (isSorted) { if (typeof isSorted == 'number') { i = (isSorted < 0 ? Math.max(0, l + isSorted) : isSorted); } else { i = _.sortedIndex(array, item); return array[i] === item ? i : -1; } } if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item, isSorted); for (; i < l; i++) if (array[i] === item) return i; return -1; }; // Delegates to **ECMAScript 5**'s native `lastIndexOf` if available. _.lastIndexOf = function(array, item, from) { if (array == null) return -1; var hasIndex = from != null; if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) { return hasIndex ? array.lastIndexOf(item, from) : array.lastIndexOf(item); } var i = (hasIndex ? from : array.length); while (i--) if (array[i] === item) return i; return -1; }; // Generate an integer Array containing an arithmetic progression. A port of // the native Python `range()` function. See // [the Python documentation](http://docs.python.org/library/functions.html#range). _.range = function(start, stop, step) { if (arguments.length <= 1) { stop = start || 0; start = 0; } step = arguments[2] || 1; var len = Math.max(Math.ceil((stop - start) / step), 0); var idx = 0; var range = new Array(len); while(idx < len) { range[idx++] = start; start += step; } return range; }; // Function (ahem) Functions // ------------------ // Create a function bound to a given object (assigning `this`, and arguments, // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if // available. _.bind = function(func, context) { if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1)); var args = slice.call(arguments, 2); return function() { return func.apply(context, args.concat(slice.call(arguments))); }; }; // Partially apply a function by creating a version that has had some of its // arguments pre-filled, without changing its dynamic `this` context. _.partial = function(func) { var args = slice.call(arguments, 1); return function() { return func.apply(this, args.concat(slice.call(arguments))); }; }; // Bind all of an object's methods to that object. Useful for ensuring that // all callbacks defined on an object belong to it. _.bindAll = function(obj) { var funcs = slice.call(arguments, 1); if (funcs.length === 0) funcs = _.functions(obj); each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); }); return obj; }; // Memoize an expensive function by storing its results. _.memoize = function(func, hasher) { var memo = {}; hasher || (hasher = _.identity); return function() { var key = hasher.apply(this, arguments); return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments)); }; }; // Delays a function for the given number of milliseconds, and then calls // it with the arguments supplied. _.delay = function(func, wait) { var args = slice.call(arguments, 2); return setTimeout(function(){ return func.apply(null, args); }, wait); }; // Defers a function, scheduling it to run after the current call stack has // cleared. _.defer = function(func) { return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1))); }; // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. _.throttle = function(func, wait) { var context, args, timeout, result; var previous = 0; var later = function() { previous = new Date; timeout = null; result = func.apply(context, args); }; return function() { var now = new Date; var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); } else if (!timeout) { timeout = setTimeout(later, remaining); } return result; }; }; // Returns a function, that, as long as it continues to be invoked, will not // be triggered. The function will be called after it stops being called for // N milliseconds. If `immediate` is passed, trigger the function on the // leading edge, instead of the trailing. _.debounce = function(func, wait, immediate) { var timeout, result; return function() { var context = this, args = arguments; var later = function() { timeout = null; if (!immediate) result = func.apply(context, args); }; var callNow = immediate && !timeout; clearTimeout(timeout); timeout = setTimeout(later, wait); if (callNow) result = func.apply(context, args); return result; }; }; // Returns a function that will be executed at most one time, no matter how // often you call it. Useful for lazy initialization. _.once = function(func) { var ran = false, memo; return function() { if (ran) return memo; ran = true; memo = func.apply(this, arguments); func = null; return memo; }; }; // Returns the first function passed as an argument to the second, // allowing you to adjust arguments, run code before and after, and // conditionally execute the original function. _.wrap = function(func, wrapper) { return function() { var args = [func]; push.apply(args, arguments); return wrapper.apply(this, args); }; }; // Returns a function that is the composition of a list of functions, each // consuming the return value of the function that follows. _.compose = function() { var funcs = arguments; return function() { var args = arguments; for (var i = funcs.length - 1; i >= 0; i--) { args = [funcs[i].apply(this, args)]; } return args[0]; }; }; // Returns a function that will only be executed after being called N times. _.after = function(times, func) { if (times <= 0) return func(); return function() { if (--times < 1) { return func.apply(this, arguments); } }; }; // Object Functions // ---------------- // Retrieve the names of an object's properties. // Delegates to **ECMAScript 5**'s native `Object.keys` _.keys = nativeKeys || function(obj) { if (obj !== Object(obj)) throw new TypeError('Invalid object'); var keys = []; for (var key in obj) if (_.has(obj, key)) keys[keys.length] = key; return keys; }; // Retrieve the values of an object's properties. _.values = function(obj) { var values = []; for (var key in obj) if (_.has(obj, key)) values.push(obj[key]); return values; }; // Convert an object into a list of `[key, value]` pairs. _.pairs = function(obj) { var pairs = []; for (var key in obj) if (_.has(obj, key)) pairs.push([key, obj[key]]); return pairs; }; // Invert the keys and values of an object. The values must be serializable. _.invert = function(obj) { var result = {}; for (var key in obj) if (_.has(obj, key)) result[obj[key]] = key; return result; }; // Return a sorted list of the function names available on the object. // Aliased as `methods` _.functions = _.methods = function(obj) { var names = []; for (var key in obj) { if (_.isFunction(obj[key])) names.push(key); } return names.sort(); }; // Extend a given object with all the properties in passed-in object(s). _.extend = function(obj) { each(slice.call(arguments, 1), function(source) { if (source) { for (var prop in source) { obj[prop] = source[prop]; } } }); return obj; }; // Return a copy of the object only containing the whitelisted properties. _.pick = function(obj) { var copy = {}; var keys = concat.apply(ArrayProto, slice.call(arguments, 1)); each(keys, function(key) { if (key in obj) copy[key] = obj[key]; }); return copy; }; // Return a copy of the object without the blacklisted properties. _.omit = function(obj) { var copy = {}; var keys = concat.apply(ArrayProto, slice.call(arguments, 1)); for (var key in obj) { if (!_.contains(keys, key)) copy[key] = obj[key]; } return copy; }; // Fill in a given object with default properties. _.defaults = function(obj) { each(slice.call(arguments, 1), function(source) { if (source) { for (var prop in source) { if (obj[prop] == null) obj[prop] = source[prop]; } } }); return obj; }; // Create a (shallow-cloned) duplicate of an object. _.clone = function(obj) { if (!_.isObject(obj)) return obj; return _.isArray(obj) ? obj.slice() : _.extend({}, obj); }; // Invokes interceptor with the obj, and then returns obj. // The primary purpose of this method is to "tap into" a method chain, in // order to perform operations on intermediate results within the chain. _.tap = function(obj, interceptor) { interceptor(obj); return obj; }; // Internal recursive comparison function for `isEqual`. var eq = function(a, b, aStack, bStack) { // Identical objects are equal. `0 === -0`, but they aren't identical. // See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal. if (a === b) return a !== 0 || 1 / a == 1 / b; // A strict comparison is necessary because `null == undefined`. if (a == null || b == null) return a === b; // Unwrap any wrapped objects. if (a instanceof _) a = a._wrapped; if (b instanceof _) b = b._wrapped; // Compare `[[Class]]` names. var className = toString.call(a); if (className != toString.call(b)) return false; switch (className) { // Strings, numbers, dates, and booleans are compared by value. case '[object String]': // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is // equivalent to `new String("5")`. return a == String(b); case '[object Number]': // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for // other numeric values. return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b); case '[object Date]': case '[object Boolean]': // Coerce dates and booleans to numeric primitive values. Dates are compared by their // millisecond representations. Note that invalid dates with millisecond representations // of `NaN` are not equivalent. return +a == +b; // RegExps are compared by their source patterns and flags. case '[object RegExp]': return a.source == b.source && a.global == b.global && a.multiline == b.multiline && a.ignoreCase == b.ignoreCase; } if (typeof a != 'object' || typeof b != 'object') return false; // Assume equality for cyclic structures. The algorithm for detecting cyclic // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. var length = aStack.length; while (length--) { // Linear search. Performance is inversely proportional to the number of // unique nested structures. if (aStack[length] == a) return bStack[length] == b; } // Add the first object to the stack of traversed objects. aStack.push(a); bStack.push(b); var size = 0, result = true; // Recursively compare objects and arrays. if (className == '[object Array]') { // Compare array lengths to determine if a deep comparison is necessary. size = a.length; result = size == b.length; if (result) { // Deep compare the contents, ignoring non-numeric properties. while (size--) { if (!(result = eq(a[size], b[size], aStack, bStack))) break; } } } else { // Objects with different constructors are not equivalent, but `Object`s // from different frames are. var aCtor = a.constructor, bCtor = b.constructor; if (aCtor !== bCtor && !(_.isFunction(aCtor) && (aCtor instanceof aCtor) && _.isFunction(bCtor) && (bCtor instanceof bCtor))) { return false; } // Deep compare objects. for (var key in a) { if (_.has(a, key)) { // Count the expected number of properties. size++; // Deep compare each member. if (!(result = _.has(b, key) && eq(a[key], b[key], aStack, bStack))) break; } } // Ensure that both objects contain the same number of properties. if (result) { for (key in b) { if (_.has(b, key) && !(size--)) break; } result = !size; } } // Remove the first object from the stack of traversed objects. aStack.pop(); bStack.pop(); return result; }; // Perform a deep comparison to check if two objects are equal. _.isEqual = function(a, b) { return eq(a, b, [], []); }; // Is a given array, string, or object empty? // An "empty" object has no enumerable own-properties. _.isEmpty = function(obj) { if (obj == null) return true; if (_.isArray(obj) || _.isString(obj)) return obj.length === 0; for (var key in obj) if (_.has(obj, key)) return false; return true; }; // Is a given value a DOM element? _.isElement = function(obj) { return !!(obj && obj.nodeType === 1); }; // Is a given value an array? // Delegates to ECMA5's native Array.isArray _.isArray = nativeIsArray || function(obj) { return toString.call(obj) == '[object Array]'; }; // Is a given variable an object? _.isObject = function(obj) { return obj === Object(obj); }; // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp. each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp'], function(name) { _['is' + name] = function(obj) { return toString.call(obj) == '[object ' + name + ']'; }; }); // Define a fallback version of the method in browsers (ahem, IE), where // there isn't any inspectable "Arguments" type. if (!_.isArguments(arguments)) { _.isArguments = function(obj) { return !!(obj && _.has(obj, 'callee')); }; } // Optimize `isFunction` if appropriate. if (typeof (/./) !== 'function') { _.isFunction = function(obj) { return typeof obj === 'function'; }; } // Is a given object a finite number? _.isFinite = function(obj) { return isFinite(obj) && !isNaN(parseFloat(obj)); }; // Is the given value `NaN`? (NaN is the only number which does not equal itself). _.isNaN = function(obj) { return _.isNumber(obj) && obj != +obj; }; // Is a given value a boolean? _.isBoolean = function(obj) { return obj === true || obj === false || toString.call(obj) == '[object Boolean]'; }; // Is a given value equal to null? _.isNull = function(obj) { return obj === null; }; // Is a given variable undefined? _.isUndefined = function(obj) { return obj === void 0; }; // Shortcut function for checking if an object has a given property directly // on itself (in other words, not on a prototype). _.has = function(obj, key) { return hasOwnProperty.call(obj, key); }; // Utility Functions // ----------------- // Run Underscore.js in *noConflict* mode, returning the `_` variable to its // previous owner. Returns a reference to the Underscore object. _.noConflict = function() { root._ = previousUnderscore; return this; }; // Keep the identity function around for default iterators. _.identity = function(value) { return value; }; // Run a function **n** times. _.times = function(n, iterator, context) { var accum = Array(n); for (var i = 0; i < n; i++) accum[i] = iterator.call(context, i); return accum; }; // Return a random integer between min and max (inclusive). _.random = function(min, max) { if (max == null) { max = min; min = 0; } return min + Math.floor(Math.random() * (max - min + 1)); }; // List of HTML entities for escaping. var entityMap = { escape: { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''', '/': '/' } }; entityMap.unescape = _.invert(entityMap.escape); // Regexes containing the keys and values listed immediately above. var entityRegexes = { escape: new RegExp('[' + _.keys(entityMap.escape).join('') + ']', 'g'), unescape: new RegExp('(' + _.keys(entityMap.unescape).join('|') + ')', 'g') }; // Functions for escaping and unescaping strings to/from HTML interpolation. _.each(['escape', 'unescape'], function(method) { _[method] = function(string) { if (string == null) return ''; return ('' + string).replace(entityRegexes[method], function(match) { return entityMap[method][match]; }); }; }); // If the value of the named property is a function then invoke it; // otherwise, return it. _.result = function(object, property) { if (object == null) return null; var value = object[property]; return _.isFunction(value) ? value.call(object) : value; }; // Add your own custom functions to the Underscore object. _.mixin = function(obj) { each(_.functions(obj), function(name){ var func = _[name] = obj[name]; _.prototype[name] = function() { var args = [this._wrapped]; push.apply(args, arguments); return result.call(this, func.apply(_, args)); }; }); }; // Generate a unique integer id (unique within the entire client session). // Useful for temporary DOM ids. var idCounter = 0; _.uniqueId = function(prefix) { var id = ++idCounter + ''; return prefix ? prefix + id : id; }; // By default, Underscore uses ERB-style template delimiters, change the // following template settings to use alternative delimiters. _.templateSettings = { evaluate : /<%([\s\S]+?)%>/g, interpolate : /<%=([\s\S]+?)%>/g, escape : /<%-([\s\S]+?)%>/g }; // When customizing `templateSettings`, if you don't want to define an // interpolation, evaluation or escaping regex, we need one that is // guaranteed not to match. var noMatch = /(.)^/; // Certain characters need to be escaped so that they can be put into a // string literal. var escapes = { "'": "'", '\\': '\\', '\r': 'r', '\n': 'n', '\t': 't', '\u2028': 'u2028', '\u2029': 'u2029' }; var escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g; // JavaScript micro-templating, similar to John Resig's implementation. // Underscore templating handles arbitrary delimiters, preserves whitespace, // and correctly escapes quotes within interpolated code. _.template = function(text, data, settings) { var render; settings = _.defaults({}, settings, _.templateSettings); // Combine delimiters into one regular expression via alternation. var matcher = new RegExp([ (settings.escape || noMatch).source, (settings.interpolate || noMatch).source, (settings.evaluate || noMatch).source ].join('|') + '|$', 'g'); // Compile the template source, escaping string literals appropriately. var index = 0; var source = "__p+='"; text.replace(matcher, function(match, escape, interpolate, evaluate, offset) { source += text.slice(index, offset) .replace(escaper, function(match) { return '\\' + escapes[match]; }); if (escape) { source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'"; } if (interpolate) { source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'"; } if (evaluate) { source += "';\n" + evaluate + "\n__p+='"; } index = offset + match.length; return match; }); source += "';\n"; // If a variable is not specified, place data values in local scope. if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n'; source = "var __t,__p='',__j=Array.prototype.join," + "print=function(){__p+=__j.call(arguments,'');};\n" + source + "return __p;\n"; try { render = new Function(settings.variable || 'obj', '_', source); } catch (e) { e.source = source; throw e; } if (data) return render(data, _); var template = function(data) { return render.call(this, data, _); }; // Provide the compiled function source as a convenience for precompilation. template.source = 'function(' + (settings.variable || 'obj') + '){\n' + source + '}'; return template; }; // Add a "chain" function, which will delegate to the wrapper. _.chain = function(obj) { return _(obj).chain(); }; // OOP // --------------- // If Underscore is called as a function, it returns a wrapped object that // can be used OO-style. This wrapper holds altered versions of all the // underscore functions. Wrapped objects may be chained. // Helper function to continue chaining intermediate results. var result = function(obj) { return this._chain ? _(obj).chain() : obj; }; // Add all of the Underscore functions to the wrapper object. _.mixin(_); // Add all mutator Array functions to the wrapper. each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) { var method = ArrayProto[name]; _.prototype[name] = function() { var obj = this._wrapped; method.apply(obj, arguments); if ((name == 'shift' || name == 'splice') && obj.length === 0) delete obj[0]; return result.call(this, obj); }; }); // Add all accessor Array functions to the wrapper. each(['concat', 'join', 'slice'], function(name) { var method = ArrayProto[name]; _.prototype[name] = function() { return result.call(this, method.apply(this._wrapped, arguments)); }; }); _.extend(_.prototype, { // Start chaining a wrapped Underscore object. chain: function() { this._chain = true; return this; }, // Extracts the result from a wrapped and chained object. value: function() { return this._wrapped; } }); }).call(this); varnish-3.0.5/doc/sphinx/=build/html/_static/file.png0000644000175000017500000000061012247037213017401 00000000000000‰PNG  IHDRóÿabKGDÿÿÿ ½§“ pHYs  šœtIMEÕ  )¶TIDAT8Ë­‘±JÄ@†¿Ir('[ "&xØÙYZ ‚Xø0‚!i|†_@±Ô÷•t§ÓDÄæÏ] ¹#¹Äxÿjv˜ùç› Y–ÐN‡ažE‘i«(ŠÌÄÉ™yž£µ@D¦£&±ˆ`Û6®ë–P¦Zk’$)5%"ôz½Ê.NñA#Aœba‘`Vsø¾_3ñc°,«™àä2m¼Ýñþjó [kŸìlv¹y|!IÕ´ðþyô;ÀðvÈé "Œß®°—a©?ŸAúðÄ7Œ`ô˜ñÇc^énôk?¸²Bg}»TЙ¹D#ÁÑÞ "R¹D1÷£çyüEŽRê*ŽãÝ6MJ©3þK_U«t8F~ÇIEND®B`‚varnish-3.0.5/doc/sphinx/=build/html/_static/down.png0000644000175000017500000000055312247037213017437 00000000000000‰PNG  IHDRóÿasRGB®ÎébKGDùC» pHYs × ×B(›xtIMEÚ"ÅíU{ëIDAT8ËÍÒ¡NCAÐóÚJ, ++@ ™4>‡¨â/ÐUü’¤^,†~T&Ô3M^^^ÛPÅM6ÙÙ¹sïÌî*¥ôí‰RJ¿‡a)e¼GñÃ*ƒœàñ¹¡èW¸Å<"®«Fò ‡øFgÜã78G…>q ƒ†ÁOI¨p‘«‰:s“õAÕjñ5GÙ†yDœ®ƒ^+y†U:ép_%G§@D|ašÕ­O“£s„Æ(ïy¡M,"â¨Íím˜sÔx:÷£.b§@D|`–V˜åÙŸÛ²”²ÜÆìиÜe²KàÅ¿Ç/êG!‚ ™IEND®B`‚varnish-3.0.5/doc/sphinx/=build/html/_static/default.css0000644000175000017500000000770412247037213020125 00000000000000/* * default.css_t * ~~~~~~~~~~~~~ * * Sphinx stylesheet -- default theme. * * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ @import url("basic.css"); /* -- page layout ----------------------------------------------------------- */ body { font-family: sans-serif; font-size: 100%; background-color: #11303d; color: #000; margin: 0; padding: 0; } div.document { background-color: #EEEEEE; } div.documentwrapper { float: left; width: 100%; } div.bodywrapper { margin: 0 0 0 230px; } div.body { background-color: white; color: #222222; padding: 0 20px 30px 20px; } div.footer { color: #ffffff; width: 100%; padding: 9px 0 9px 0; text-align: center; font-size: 75%; } div.footer a { color: #ffffff; text-decoration: underline; } div.related { background-color: #437EB2; line-height: 30px; color: white; } div.related a { color: #ffffff; } div.sphinxsidebar { } div.sphinxsidebar h3 { font-family: 'Trebuchet MS', sans-serif; color: #222222; font-size: 1.4em; font-weight: normal; margin: 0; padding: 0; } div.sphinxsidebar h3 a { color: #222222; } div.sphinxsidebar h4 { font-family: 'Trebuchet MS', sans-serif; color: #222222; font-size: 1.3em; font-weight: normal; margin: 5px 0 0 0; padding: 0; } div.sphinxsidebar p { color: #222222; } div.sphinxsidebar p.topless { margin: 5px 10px 10px 10px; } div.sphinxsidebar ul { margin: 10px; padding: 0; color: #222222; } div.sphinxsidebar a { color: #336590; } div.sphinxsidebar input { border: 1px solid #336590; font-family: sans-serif; font-size: 1em; } /* -- hyperlink styles ------------------------------------------------------ */ a { color: #336590; text-decoration: none; } a:visited { color: #355f7c; text-decoration: none; } a:hover { text-decoration: underline; } /* -- body styles ----------------------------------------------------------- */ div.body h1, div.body h2, div.body h3, div.body h4, div.body h5, div.body h6 { font-family: 'Trebuchet MS', sans-serif; background-color: #f2f2f2; font-weight: normal; color: #222222; border-bottom: 1px solid #ccc; margin: 20px -20px 10px -20px; padding: 3px 0 3px 10px; } div.body h1 { margin-top: 0; font-size: 200%; } div.body h2 { font-size: 160%; } div.body h3 { font-size: 140%; } div.body h4 { font-size: 120%; } div.body h5 { font-size: 110%; } div.body h6 { font-size: 100%; } a.headerlink { color: #336590; font-size: 0.8em; padding: 0 4px 0 4px; text-decoration: none; } a.headerlink:hover { background-color: #336590; color: white; } div.body p, div.body dd, div.body li { text-align: justify; line-height: 130%; } div.admonition p.admonition-title + p { display: inline; } div.admonition p { margin-bottom: 5px; } div.admonition pre { margin-bottom: 5px; } div.admonition ul, div.admonition ol { margin-bottom: 5px; } div.note { background-color: #eee; border: 1px solid #ccc; } div.seealso { background-color: #ffc; border: 1px solid #ff6; } div.topic { background-color: #eee; } div.warning { background-color: #ffe4e4; border: 1px solid #f66; } p.admonition-title { display: inline; } p.admonition-title:after { content: ":"; } pre { padding: 5px; background-color: #eeffcc; color: #222222; line-height: 120%; border: 1px solid #ac9; border-left: none; border-right: none; } tt { background-color: #ecf0f3; padding: 0 1px 0 1px; font-size: 0.95em; } th { background-color: #ede; } .warning tt { background: #efc2c2; } .note tt { background: #d6d6d6; } .viewcode-back { font-family: sans-serif; } div.viewcode-block:target { background-color: #f4debf; border-top: 1px solid #ac9; border-bottom: 1px solid #ac9; }varnish-3.0.5/doc/sphinx/=build/html/_static/plus.png0000644000175000017500000000030712247037213017450 00000000000000‰PNG  IHDR &Îàq pHYs  šœtIME× 1l9tEXtCommentöÌ–¿RIDATÓczô(BÅñãÇáÒpö¿ÿ¨èˆip»‘¹P÷îÝÃc· ¸ |¶IEND®B`‚varnish-3.0.5/doc/sphinx/=build/html/_static/ajax-loader.gif0000644000175000017500000000124112247037213020633 00000000000000GIF89aòÿÿÿU|ÆÖßN€U|l–®Š«¾™¶Æ!þCreated with ajaxload.info!ù !ÿ NETSCAPE2.0,3ºÜþ0ÊIkc:œN˜f E±1º™Á¶.`ÄÂqÐ-[9ݦ9 JkçH!ù ,4ºÜþNŒ! „ »°æŠDqBQT`1 `LE[¨|µußía€ ×â†C²%$*!ù ,6º2#+ÊAÈÌ”V/…côNñIBa˜«pð ̳½ƨ+YíüƒÃ2©dŸ¿!ù ,3ºb%+Ê2†‘ìœV_…‹¦ …! 1D‡aªF‚°ÑbR]ó=08,Ȥr9L!ù ,2ºr'+JçdðóL &vÃ`\bT”…„¹hYB)ÏÊ@é<Ã&,ȤR’!ù ,3º Â9ãtç¼Úž0Çà!.B¶ÊW¬¢1  sa»°5÷•0° ‰»Ÿm)J!ù ,2ºÜþð ÙœU]šîÚqp•`ˆÝaœÝ4–…AFÅ0`›¶ Â@›1€ÂÖΑ!ù ,2ºÜþ0ÊI«eBÔœ)×à ŽÇq10©Ê°®PÂaVÚ¥ ub‚ž[;varnish-3.0.5/doc/sphinx/=build/html/_static/basic.css0000644000175000017500000002041712247037213017556 00000000000000/* * basic.css * ~~~~~~~~~ * * Sphinx stylesheet -- basic theme. * * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ /* -- main layout ----------------------------------------------------------- */ div.clearer { clear: both; } /* -- relbar ---------------------------------------------------------------- */ div.related { width: 100%; font-size: 90%; } div.related h3 { display: none; } div.related ul { margin: 0; padding: 0 0 0 10px; list-style: none; } div.related li { display: inline; } div.related li.right { float: right; margin-right: 5px; } /* -- sidebar --------------------------------------------------------------- */ div.sphinxsidebarwrapper { padding: 10px 5px 0 10px; } div.sphinxsidebar { float: left; width: 230px; margin-left: -100%; font-size: 90%; } div.sphinxsidebar ul { list-style: none; } div.sphinxsidebar ul ul, div.sphinxsidebar ul.want-points { margin-left: 20px; list-style: square; } div.sphinxsidebar ul ul { margin-top: 0; margin-bottom: 0; } div.sphinxsidebar form { margin-top: 10px; } div.sphinxsidebar input { border: 1px solid #98dbcc; font-family: sans-serif; font-size: 1em; } div.sphinxsidebar #searchbox input[type="text"] { width: 170px; } div.sphinxsidebar #searchbox input[type="submit"] { width: 30px; } img { border: 0; } /* -- search page ----------------------------------------------------------- */ ul.search { margin: 10px 0 0 20px; padding: 0; } ul.search li { padding: 5px 0 5px 20px; background-image: url(file.png); background-repeat: no-repeat; background-position: 0 7px; } ul.search li a { font-weight: bold; } ul.search li div.context { color: #888; margin: 2px 0 0 30px; text-align: left; } ul.keywordmatches li.goodmatch a { font-weight: bold; } /* -- index page ------------------------------------------------------------ */ table.contentstable { width: 90%; } table.contentstable p.biglink { line-height: 150%; } a.biglink { font-size: 1.3em; } span.linkdescr { font-style: italic; padding-top: 5px; font-size: 90%; } /* -- general index --------------------------------------------------------- */ table.indextable { width: 100%; } table.indextable td { text-align: left; vertical-align: top; } table.indextable dl, table.indextable dd { margin-top: 0; margin-bottom: 0; } table.indextable tr.pcap { height: 10px; } table.indextable tr.cap { margin-top: 10px; background-color: #f2f2f2; } img.toggler { margin-right: 3px; margin-top: 3px; cursor: pointer; } div.modindex-jumpbox { border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; margin: 1em 0 1em 0; padding: 0.4em; } div.genindex-jumpbox { border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; margin: 1em 0 1em 0; padding: 0.4em; } /* -- general body styles --------------------------------------------------- */ a.headerlink { visibility: hidden; } h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, h4:hover > a.headerlink, h5:hover > a.headerlink, h6:hover > a.headerlink, dt:hover > a.headerlink { visibility: visible; } div.body p.caption { text-align: inherit; } div.body td { text-align: left; } .field-list ul { padding-left: 1em; } .first { margin-top: 0 !important; } p.rubric { margin-top: 30px; font-weight: bold; } img.align-left, .figure.align-left, object.align-left { clear: left; float: left; margin-right: 1em; } img.align-right, .figure.align-right, object.align-right { clear: right; float: right; margin-left: 1em; } img.align-center, .figure.align-center, object.align-center { display: block; margin-left: auto; margin-right: auto; } .align-left { text-align: left; } .align-center { text-align: center; } .align-right { text-align: right; } /* -- sidebars -------------------------------------------------------------- */ div.sidebar { margin: 0 0 0.5em 1em; border: 1px solid #ddb; padding: 7px 7px 0 7px; background-color: #ffe; width: 40%; float: right; } p.sidebar-title { font-weight: bold; } /* -- topics ---------------------------------------------------------------- */ div.topic { border: 1px solid #ccc; padding: 7px 7px 0 7px; margin: 10px 0 10px 0; } p.topic-title { font-size: 1.1em; font-weight: bold; margin-top: 10px; } /* -- admonitions ----------------------------------------------------------- */ div.admonition { margin-top: 10px; margin-bottom: 10px; padding: 7px; } div.admonition dt { font-weight: bold; } div.admonition dl { margin-bottom: 0; } p.admonition-title { margin: 0px 10px 5px 0px; font-weight: bold; } div.body p.centered { text-align: center; margin-top: 25px; } /* -- tables ---------------------------------------------------------------- */ table.docutils { border: 0; border-collapse: collapse; } table.docutils td, table.docutils th { padding: 1px 8px 1px 5px; border-top: 0; border-left: 0; border-right: 0; border-bottom: 1px solid #aaa; } table.field-list td, table.field-list th { border: 0 !important; } table.footnote td, table.footnote th { border: 0 !important; } th { text-align: left; padding-right: 5px; } table.citation { border-left: solid 1px gray; margin-left: 1px; } table.citation td { border-bottom: none; } /* -- other body styles ----------------------------------------------------- */ ol.arabic { list-style: decimal; } ol.loweralpha { list-style: lower-alpha; } ol.upperalpha { list-style: upper-alpha; } ol.lowerroman { list-style: lower-roman; } ol.upperroman { list-style: upper-roman; } dl { margin-bottom: 15px; } dd p { margin-top: 0px; } dd ul, dd table { margin-bottom: 10px; } dd { margin-top: 3px; margin-bottom: 10px; margin-left: 30px; } dt:target, .highlighted { background-color: #fbe54e; } dl.glossary dt { font-weight: bold; font-size: 1.1em; } .field-list ul { margin: 0; padding-left: 1em; } .field-list p { margin: 0; } .refcount { color: #060; } .optional { font-size: 1.3em; } .versionmodified { font-style: italic; } .system-message { background-color: #fda; padding: 5px; border: 3px solid red; } .footnote:target { background-color: #ffa; } .line-block { display: block; margin-top: 1em; margin-bottom: 1em; } .line-block .line-block { margin-top: 0; margin-bottom: 0; margin-left: 1.5em; } .guilabel, .menuselection { font-family: sans-serif; } .accelerator { text-decoration: underline; } .classifier { font-style: oblique; } abbr, acronym { border-bottom: dotted 1px; cursor: help; } /* -- code displays --------------------------------------------------------- */ pre { overflow: auto; overflow-y: hidden; /* fixes display issues on Chrome browsers */ } td.linenos pre { padding: 5px 0px; border: 0; background-color: transparent; color: #aaa; } table.highlighttable { margin-left: 0.5em; } table.highlighttable td { padding: 0 0.5em 0 0.5em; } tt.descname { background-color: transparent; font-weight: bold; font-size: 1.2em; } tt.descclassname { background-color: transparent; } tt.xref, a tt { background-color: transparent; font-weight: bold; } h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { background-color: transparent; } .viewcode-link { float: right; } .viewcode-back { float: right; font-family: sans-serif; } div.viewcode-block:target { margin: -1px -10px; padding: 0 10px; } /* -- math display ---------------------------------------------------------- */ img.math { vertical-align: middle; } div.body div.math p { text-align: center; } span.eqno { float: right; } /* -- printout stylesheet --------------------------------------------------- */ @media print { div.document, div.documentwrapper, div.bodywrapper { margin: 0 !important; width: 100%; } div.sphinxsidebar, div.related, div.footer, #top-link { display: none; } }varnish-3.0.5/doc/sphinx/=build/html/_static/up.png0000644000175000017500000000055312247037213017114 00000000000000‰PNG  IHDRóÿasRGB®ÎébKGDùC» pHYs × ×B(›xtIMEÚ!.<̓EëIDAT8ËÍ“±NA†¿õ®B‚P\EG{õ„ް³%<„ñ|éxcþþ ÀŠ cƒr6“@t×;bã$›ìü;óÿ3ø×&)—”ÿ†¹hÈ1ö“´¼!ÁÚ﫳Hzz@Ïý¨…Äç°=)p 3Ûµe°2/Üß´’ é(€úä¹ ¥%øÈ^ND^ ¼}3ûH1¨€ËDo‚Ǫ¨IS üF‹Ò±?,ð ìG`ÌÜß{¬vì±’–^ýX™Ù[b¼]พÍì&HC3{:sO&À ’²?,[öïeL#«¾éIEND®B`‚varnish-3.0.5/doc/sphinx/=build/html/_static/doctools.js0000644000175000017500000001527012247037213020150 00000000000000/* * doctools.js * ~~~~~~~~~~~ * * Sphinx JavaScript utilities for all documentation. * * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ /** * select a different prefix for underscore */ $u = _.noConflict(); /** * make the code below compatible with browsers without * an installed firebug like debugger if (!window.console || !console.firebug) { var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; window.console = {}; for (var i = 0; i < names.length; ++i) window.console[names[i]] = function() {}; } */ /** * small helper function to urldecode strings */ jQuery.urldecode = function(x) { return decodeURIComponent(x).replace(/\+/g, ' '); } /** * small helper function to urlencode strings */ jQuery.urlencode = encodeURIComponent; /** * This function returns the parsed url parameters of the * current request. Multiple values per key are supported, * it will always return arrays of strings for the value parts. */ jQuery.getQueryParameters = function(s) { if (typeof s == 'undefined') s = document.location.search; var parts = s.substr(s.indexOf('?') + 1).split('&'); var result = {}; for (var i = 0; i < parts.length; i++) { var tmp = parts[i].split('=', 2); var key = jQuery.urldecode(tmp[0]); var value = jQuery.urldecode(tmp[1]); if (key in result) result[key].push(value); else result[key] = [value]; } return result; }; /** * small function to check if an array contains * a given item. */ jQuery.contains = function(arr, item) { for (var i = 0; i < arr.length; i++) { if (arr[i] == item) return true; } return false; }; /** * highlight a given string on a jquery object by wrapping it in * span elements with the given class name. */ jQuery.fn.highlightText = function(text, className) { function highlight(node) { if (node.nodeType == 3) { var val = node.nodeValue; var pos = val.toLowerCase().indexOf(text); if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) { var span = document.createElement("span"); span.className = className; span.appendChild(document.createTextNode(val.substr(pos, text.length))); node.parentNode.insertBefore(span, node.parentNode.insertBefore( document.createTextNode(val.substr(pos + text.length)), node.nextSibling)); node.nodeValue = val.substr(0, pos); } } else if (!jQuery(node).is("button, select, textarea")) { jQuery.each(node.childNodes, function() { highlight(this); }); } } return this.each(function() { highlight(this); }); }; /** * Small JavaScript module for the documentation. */ var Documentation = { init : function() { this.fixFirefoxAnchorBug(); this.highlightSearchWords(); this.initIndexTable(); }, /** * i18n support */ TRANSLATIONS : {}, PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; }, LOCALE : 'unknown', // gettext and ngettext don't access this so that the functions // can safely bound to a different name (_ = Documentation.gettext) gettext : function(string) { var translated = Documentation.TRANSLATIONS[string]; if (typeof translated == 'undefined') return string; return (typeof translated == 'string') ? translated : translated[0]; }, ngettext : function(singular, plural, n) { var translated = Documentation.TRANSLATIONS[singular]; if (typeof translated == 'undefined') return (n == 1) ? singular : plural; return translated[Documentation.PLURALEXPR(n)]; }, addTranslations : function(catalog) { for (var key in catalog.messages) this.TRANSLATIONS[key] = catalog.messages[key]; this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); this.LOCALE = catalog.locale; }, /** * add context elements like header anchor links */ addContextElements : function() { $('div[id] > :header:first').each(function() { $('\u00B6'). attr('href', '#' + this.id). attr('title', _('Permalink to this headline')). appendTo(this); }); $('dt[id]').each(function() { $('\u00B6'). attr('href', '#' + this.id). attr('title', _('Permalink to this definition')). appendTo(this); }); }, /** * workaround a firefox stupidity */ fixFirefoxAnchorBug : function() { if (document.location.hash && $.browser.mozilla) window.setTimeout(function() { document.location.href += ''; }, 10); }, /** * highlight the search words provided in the url in the text */ highlightSearchWords : function() { var params = $.getQueryParameters(); var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; if (terms.length) { var body = $('div.body'); window.setTimeout(function() { $.each(terms, function() { body.highlightText(this.toLowerCase(), 'highlighted'); }); }, 10); $('') .appendTo($('#searchbox')); } }, /** * init the domain index toggle buttons */ initIndexTable : function() { var togglers = $('img.toggler').click(function() { var src = $(this).attr('src'); var idnum = $(this).attr('id').substr(7); $('tr.cg-' + idnum).toggle(); if (src.substr(-9) == 'minus.png') $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); else $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); }).css('display', ''); if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { togglers.click(); } }, /** * helper function to hide the search marks again */ hideSearchWords : function() { $('#searchbox .highlight-link').fadeOut(300); $('span.highlighted').removeClass('highlighted'); }, /** * make the url absolute */ makeURL : function(relativeURL) { return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; }, /** * get the current relative url */ getCurrentURL : function() { var path = document.location.pathname; var parts = path.split(/\//); $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { if (this == '..') parts.pop(); }); var url = parts.join('/'); return path.substring(url.lastIndexOf('/') + 1, path.length - 1); } }; // quick alias for translations _ = Documentation.gettext; $(document).ready(function() { Documentation.init(); }); varnish-3.0.5/doc/sphinx/=build/html/_static/comment-bright.png0000644000175000017500000000665412247037213021417 00000000000000‰PNG  IHDRóÿa OiCCPPhotoshop ICC profilexÚSgTSé=÷ÞôBKˆ€”KoR RB‹€‘&*! Jˆ!¡ÙQÁEEÈ ˆŽŽ€ŒQ, Š Øä!¢Žƒ£ˆŠÊûá{£kÖ¼÷æÍþµ×>ç¬ó³ÏÀ –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Ú 6 B©\<ÞIDAT8Ë…’Kh]e…¿½ÿs1mAÛÄÚ`j‚Ïh[-ˆE(FEŠÁaAœ! bI« àÈ*–BX‘"Ø4)NŠõUR‚Zˆ¹­!’×Mhj“›ssÎùÿíà–¨àãmØ‹Å^‹-\ggßÏ ÷ßì]o|ÑÑÒ¬[3±¶4§Á§6»”û©òèø¯×>zd‘¿ ]½#Œ»î8ÙþüáÇOݺ±t{5·uIÍXN!I=@Vf¾®Ÿ=v×ÀÞþ1ûº}e>;ØÉö×fvìénøvËÍÅxaÉHrÏʪJ’¦Fȹ`œÈðDò¹WZ®]ÀžSíýŸø%S)ÌWAÌœb¹ |0K=âSo7D†~\~qâÍ-ïÀËŸ\ùaóMÅ“Z,S'*æô™‘È} óF`—†ÎNnzæ674¸öËUÈ