Skip to content

Commit d592a08

Browse files
author
Lasse Karstensen
committed
Squashed import from development repository.
1 parent 40e13c0 commit d592a08

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+6409
-0
lines changed

.gitignore

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
**.o
2+
**.in
3+
**.in~
4+
.deps
5+
**.sw[op]
6+
Makefile
7+
/stamp-h1
8+
/aclocal.m4
9+
/compile
10+
/missing
11+
/config.log
12+
/config.status
13+
/config.h
14+
/configure
15+
/depcomp
16+
/install-sh
17+
/autom4te.cache
18+
/hitch.8
19+
Makefile.in
20+
.deps/
21+
.libs/
22+
*.o
23+
*.lo
24+
*.la
25+
*~
26+
*.[1-9]
27+
/aclocal.m4
28+
/autom4te.cache/
29+
/compile
30+
/config.guess
31+
/config.h
32+
/config.h.in
33+
/config.log
34+
/config.status
35+
/config.sub
36+
/configure
37+
/depcomp
38+
/install-sh
39+
/libtool
40+
/ltmain.sh
41+
/missing
42+
/stamp-h1
43+
/m4/
44+
/src/vcc*if.[ch]
45+
/docs/vmod_*.rst

AUTHORS

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
AUTHORS
3+
=======
4+
5+
This file summarises the original vmod authors.
6+
7+
All modules taken into this collection at creation time were copyright Varnish
8+
Software and are 2-clause BSD licensed.
9+
10+
vmod-header was originally written by Kristian Lyngstøl.
11+
vmod-cookie, vmod-softpurge and vmod-tcp were written by Lasse Karstensen.
12+
vmod-vsthrottle and vmod-saintmode were written by Dag Haavi Finstad.
13+
vmod-xkey was originally written by Martin Blix Grydeland.
14+

CHANGES.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
This is a running log of changes to varnish-vmods.
2+
3+
varnish-vmods 0.9.1 (unreleased)
4+
--------------------------------
5+
6+
Initial release. This package contains the source files extracted from
7+
the following git repositories and commit identifiers:
8+
9+
* b772825 in libvmod-cookie.git
10+
* 86da3be in libvmod-header.git
11+
* d8658c9 in libvmod-saintmode.git
12+
* e6c8ce1 in libvmod-softpurge.git
13+
* 8add5f8 in libvmod-tcp.git
14+
* c99cb30 in libvmod-var.git
15+
* 52c5d64 in libvmod-xkey.git
16+
17+
This release is intended to work with Varnish Cache 4.1.2 and higher.

COPYING

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Copyright (c) 2016 Varnish Software AS
2+
...
3+
See LICENSE for details.
4+
5+
You're free to use and distribute this under terms in the
6+
LICENSE. Please add your relevant copyright statements.

LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Redistribution and use in source and binary forms, with or without
2+
modification, are permitted provided that the following conditions
3+
are met:
4+
1. Redistributions of source code must retain the above copyright
5+
notice, this list of conditions and the following disclaimer.
6+
2. Redistributions in binary form must reproduce the above copyright
7+
notice, this list of conditions and the following disclaimer in the
8+
documentation and/or other materials provided with the distribution.
9+
10+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
11+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13+
ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
14+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
15+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
16+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
17+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
18+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
19+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
20+
SUCH DAMAGE.

Makefile.am

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
ACLOCAL_AMFLAGS = -I m4 -I ${LIBVARNISHAPI_DATAROOTDIR}/aclocal
2+
3+
SUBDIRS = src
4+
5+
DISTCHECK_CONFIGURE_FLAGS = \
6+
VMOD_DIR='$${libdir}/varnish/vmods'
7+
8+
EXTRA_DIST = README.rst LICENSE
9+
10+
doc_DATA = README.rst LICENSE
11+
12+
#dist_man_MANS = vmod_vsthrottle.3
13+
#MAINTAINERCLEANFILES = $(dist_man_MANS)
14+
15+
#vmod_vsthrottle.3: README.rst
16+
17+
%.1 %.2 %.3 %.4 %.5 %.6 %.7 %.8 %.9:
18+
if HAVE_RST2MAN
19+
${RST2MAN} $< $@
20+
else
21+
@echo "========================================"
22+
@echo "You need rst2man installed to make dist"
23+
@echo "========================================"
24+
@false
25+
endif
26+

README.rst

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
Varnish modules by Varnish Software
2+
===================================
3+
4+
This is a collection of modules ("vmods") extending Varnish VCL used for describing HTTP
5+
request/response policies with additional capabilities.
6+
7+
Examples include:
8+
9+
* Simpler handling of HTTP cookies
10+
* Variable support
11+
* Request and bandwidth throttling
12+
* Modify and change complex HTTP headers
13+
* Advanced cache invalidations, and more.
14+
15+
This collection contains the following vmods (previously kept individually):
16+
cookie, vsthrottle, header, saintmode, softpurge, tcp, var, xkey
17+
18+
Supported Varnish version is described in the `CHANGES.rst` file. Normally this
19+
is the last public Varnish Cache release.
20+
21+
22+
Installation
23+
------------
24+
25+
Installation requires an installed version of Varnish Cache, including the
26+
development files.
27+
28+
Source code is built with autotools::
29+
30+
apt-get install libvarnishapi-dev || yum install varnish-libs-devel
31+
./bootstrap
32+
./configure
33+
make check
34+
make install
35+
36+
The resulting loadable modules (``libvmod_foo*.so`` files) will be installed to the
37+
Varnish module directory. (default `/var/lib/varnish/vmods/`)
38+
39+
40+
Usage
41+
-----
42+
43+
44+
Each module has a different set of functions and usage, described in
45+
separate documents in `docs/`. For completeness, here is a snippet from
46+
`docs/cookie.rst`::
47+
48+
import cookie;
49+
50+
sub vcl_recv {
51+
cookie.parse(req.http.cookie);
52+
cookie.filter_except("SESSIONID,PHPSESSID");
53+
set req.http.cookie = cookie.get_string();
54+
# Only SESSIONID and PHPSESSID are left in req.http.cookie at this point.
55+
}
56+
57+
58+
59+
Development
60+
-----------
61+
62+
The source git tree lives on github: https://github.com/varnish/varnish-vmods
63+
64+
All source code is placed in the master git branch. Pull requests and issue
65+
reporting are appreciated.
66+
67+
68+
Administrativa
69+
--------------
70+
71+
The goals of this collection are:
72+
73+
* Simplify access to vmod code for Varnish users. One package to install, not 19.
74+
* Decrease the maintenance cost that comes with having 10 different git repos,
75+
each with autotools and (previously) package definition files.
76+
77+
Expressed non-goals are:
78+
79+
* Import vmods that require external libraries, like curl or geoip. This
80+
collection should be simple and maintenance free to run.
81+
* Support older releases of Varnish Cache.
82+
* Include every vmod under the sun. We'll add the important ones.
83+
84+
Addition of further vmods is decided on a case-by-case basis. Code quality and
85+
maintenance requirements will be important in this decision.
86+
87+
We encourage porting efforts to older Varnish Cache versions, if someone wants
88+
to do that. (and maintain it!)
89+
90+
91+
Contact
92+
-------
93+
94+
This code is maintained by Varnish Software. (https://www.varnish-software.com/)
95+
96+
Issues can be reported via the Github issue tracker.
97+
98+
Other inquires can be sent to opensource@__no_spam_please__varnish-software.com.
99+

bootstrap

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/sh
2+
3+
warn() {
4+
echo "WARNING: $@" 1>&2
5+
}
6+
7+
case `uname -s` in
8+
Darwin)
9+
LIBTOOLIZE=glibtoolize
10+
;;
11+
FreeBSD)
12+
LIBTOOLIZE=libtoolize
13+
;;
14+
Linux)
15+
LIBTOOLIZE=libtoolize
16+
;;
17+
SunOS)
18+
LIBTOOLIZE=libtoolize
19+
;;
20+
*)
21+
warn "unrecognized platform:" `uname -s`
22+
LIBTOOLIZE=libtoolize
23+
esac
24+
25+
automake_version=`automake --version | tr ' ' '\n' | egrep '^[0-9]\.[0-9a-z.-]+'`
26+
if [ -z "$automake_version" ] ; then
27+
warn "unable to determine automake version"
28+
else
29+
case $automake_version in
30+
0.*|1.[0-8]|1.[0-8][.-]*)
31+
warn "automake ($automake_version) detected; 1.9 or newer recommended"
32+
;;
33+
*)
34+
;;
35+
esac
36+
fi
37+
38+
# check for varnishapi.m4 in custom paths
39+
dataroot=$(pkg-config --variable=datarootdir varnishapi 2>/dev/null)
40+
if [ -z "$dataroot" ] ; then
41+
cat >&2 <<'EOF'
42+
Package varnishapi was not found in the pkg-config search path.
43+
Perhaps you should add the directory containing `varnishapi.pc'
44+
to the PKG_CONFIG_PATH environment variable
45+
EOF
46+
exit 1
47+
fi
48+
set -ex
49+
aclocal -I m4 -I ${dataroot}/aclocal
50+
$LIBTOOLIZE --copy --force
51+
autoheader
52+
automake --add-missing --copy --foreign
53+
autoconf

configure.ac

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
AC_PREREQ(2.59)
2+
AC_COPYRIGHT([Copyright (c) 2016 Varnish Software Group])
3+
AC_INIT([varnish-vmods], [0.9.1-dev])
4+
AC_CONFIG_MACRO_DIR([m4])
5+
m4_ifndef([VARNISH_VMOD_INCLUDES], AC_MSG_ERROR([Need varnish.m4 -- see README.rst]))
6+
AM_CONFIG_HEADER(config.h)
7+
8+
AC_CANONICAL_SYSTEM
9+
AC_LANG(C)
10+
11+
AM_INIT_AUTOMAKE([foreign])
12+
13+
AC_GNU_SOURCE
14+
AC_PROG_CC
15+
AC_PROG_CC_STDC
16+
if test "x$ac_cv_prog_cc_c99" = xno; then
17+
AC_MSG_ERROR([Could not find a C99 compatible compiler])
18+
fi
19+
AC_PROG_CPP
20+
21+
AC_PROG_INSTALL
22+
AC_PROG_LIBTOOL
23+
AC_PROG_MAKE_SET
24+
25+
# Check for rst utilities
26+
AC_CHECK_PROGS(RST2MAN, [rst2man rst2man.py], "no")
27+
if test "x$RST2MAN" = "xno"; then
28+
AC_MSG_WARN([rst2man not found - not building man pages])
29+
fi
30+
AM_CONDITIONAL(HAVE_RST2MAN, [test "x$RST2MAN" != "xno"])
31+
32+
# Checks for header files.
33+
AC_HEADER_STDC
34+
AC_CHECK_HEADERS([sys/stdlib.h])
35+
36+
# backwards compat with older pkg-config
37+
# - pull in AC_DEFUN from pkg.m4
38+
m4_ifndef([PKG_CHECK_VAR], [
39+
# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
40+
# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
41+
# -------------------------------------------
42+
# Retrieves the value of the pkg-config variable for the given module.
43+
AC_DEFUN([PKG_CHECK_VAR],
44+
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
45+
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
46+
47+
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
48+
AS_VAR_COPY([$1], [pkg_cv_][$1])
49+
50+
AS_VAR_IF([$1], [""], [$5], [$4])dnl
51+
])# PKG_CHECK_VAR
52+
])
53+
54+
PKG_CHECK_MODULES([libvarnishapi], [varnishapi])
55+
PKG_CHECK_VAR([LIBVARNISHAPI_DATAROOTDIR], [varnishapi], [datarootdir])
56+
PKG_CHECK_VAR([LIBVARNISHAPI_BINDIR], [varnishapi], [bindir])
57+
PKG_CHECK_VAR([LIBVARNISHAPI_SBINDIR], [varnishapi], [sbindir])
58+
AC_SUBST([LIBVARNISHAPI_DATAROOTDIR])
59+
60+
# Varnish include files tree
61+
VARNISH_VMOD_INCLUDES
62+
VARNISH_VMOD_DIR
63+
VARNISH_VMODTOOL
64+
65+
AC_PATH_PROG([VARNISHTEST], [varnishtest], [],
66+
[$LIBVARNISHAPI_BINDIR:$LIBVARNISHAPI_SBINDIR:$PATH])
67+
AC_PATH_PROG([VARNISHD], [varnishd], [],
68+
[$LIBVARNISHAPI_SBINDIR:$LIBVARNISHAPI_BINDIR:$PATH])
69+
70+
AC_CONFIG_FILES([
71+
Makefile
72+
src/Makefile
73+
])
74+
AC_OUTPUT

0 commit comments

Comments
 (0)