Skip to content

Commit

Permalink
Squashed import from development repository.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lasse Karstensen committed Mar 4, 2016
1 parent 40e13c0 commit d592a08
Show file tree
Hide file tree
Showing 76 changed files with 6,409 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
**.o
**.in
**.in~
.deps
**.sw[op]
Makefile
/stamp-h1
/aclocal.m4
/compile
/missing
/config.log
/config.status
/config.h
/configure
/depcomp
/install-sh
/autom4te.cache
/hitch.8
Makefile.in
.deps/
.libs/
*.o
*.lo
*.la
*~
*.[1-9]
/aclocal.m4
/autom4te.cache/
/compile
/config.guess
/config.h
/config.h.in
/config.log
/config.status
/config.sub
/configure
/depcomp
/install-sh
/libtool
/ltmain.sh
/missing
/stamp-h1
/m4/
/src/vcc*if.[ch]
/docs/vmod_*.rst
14 changes: 14 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

AUTHORS
=======

This file summarises the original vmod authors.

All modules taken into this collection at creation time were copyright Varnish
Software and are 2-clause BSD licensed.

vmod-header was originally written by Kristian Lyngstøl.
vmod-cookie, vmod-softpurge and vmod-tcp were written by Lasse Karstensen.
vmod-vsthrottle and vmod-saintmode were written by Dag Haavi Finstad.
vmod-xkey was originally written by Martin Blix Grydeland.

17 changes: 17 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
This is a running log of changes to varnish-vmods.

varnish-vmods 0.9.1 (unreleased)
--------------------------------

Initial release. This package contains the source files extracted from
the following git repositories and commit identifiers:

* b772825 in libvmod-cookie.git
* 86da3be in libvmod-header.git
* d8658c9 in libvmod-saintmode.git
* e6c8ce1 in libvmod-softpurge.git
* 8add5f8 in libvmod-tcp.git
* c99cb30 in libvmod-var.git
* 52c5d64 in libvmod-xkey.git

This release is intended to work with Varnish Cache 4.1.2 and higher.
6 changes: 6 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Copyright (c) 2016 Varnish Software AS
...
See LICENSE for details.

You're free to use and distribute this under terms in the
LICENSE. Please add your relevant copyright statements.
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
26 changes: 26 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
ACLOCAL_AMFLAGS = -I m4 -I ${LIBVARNISHAPI_DATAROOTDIR}/aclocal

SUBDIRS = src

DISTCHECK_CONFIGURE_FLAGS = \
VMOD_DIR='$${libdir}/varnish/vmods'

EXTRA_DIST = README.rst LICENSE

doc_DATA = README.rst LICENSE

#dist_man_MANS = vmod_vsthrottle.3
#MAINTAINERCLEANFILES = $(dist_man_MANS)

#vmod_vsthrottle.3: README.rst

%.1 %.2 %.3 %.4 %.5 %.6 %.7 %.8 %.9:
if HAVE_RST2MAN
${RST2MAN} $< $@
else
@echo "========================================"
@echo "You need rst2man installed to make dist"
@echo "========================================"
@false
endif

99 changes: 99 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
Varnish modules by Varnish Software
===================================

This is a collection of modules ("vmods") extending Varnish VCL used for describing HTTP
request/response policies with additional capabilities.

Examples include:

* Simpler handling of HTTP cookies
* Variable support
* Request and bandwidth throttling
* Modify and change complex HTTP headers
* Advanced cache invalidations, and more.

This collection contains the following vmods (previously kept individually):
cookie, vsthrottle, header, saintmode, softpurge, tcp, var, xkey

Supported Varnish version is described in the `CHANGES.rst` file. Normally this
is the last public Varnish Cache release.


Installation
------------

Installation requires an installed version of Varnish Cache, including the
development files.

Source code is built with autotools::

apt-get install libvarnishapi-dev || yum install varnish-libs-devel
./bootstrap
./configure
make check
make install

The resulting loadable modules (``libvmod_foo*.so`` files) will be installed to the
Varnish module directory. (default `/var/lib/varnish/vmods/`)


Usage
-----


Each module has a different set of functions and usage, described in
separate documents in `docs/`. For completeness, here is a snippet from
`docs/cookie.rst`::

import cookie;

sub vcl_recv {
cookie.parse(req.http.cookie);
cookie.filter_except("SESSIONID,PHPSESSID");
set req.http.cookie = cookie.get_string();
# Only SESSIONID and PHPSESSID are left in req.http.cookie at this point.
}



Development
-----------

The source git tree lives on github: https://github.com/varnish/varnish-vmods

All source code is placed in the master git branch. Pull requests and issue
reporting are appreciated.


Administrativa
--------------

The goals of this collection are:

* Simplify access to vmod code for Varnish users. One package to install, not 19.
* Decrease the maintenance cost that comes with having 10 different git repos,
each with autotools and (previously) package definition files.

Expressed non-goals are:

* Import vmods that require external libraries, like curl or geoip. This
collection should be simple and maintenance free to run.
* Support older releases of Varnish Cache.
* Include every vmod under the sun. We'll add the important ones.

Addition of further vmods is decided on a case-by-case basis. Code quality and
maintenance requirements will be important in this decision.

We encourage porting efforts to older Varnish Cache versions, if someone wants
to do that. (and maintain it!)


Contact
-------

This code is maintained by Varnish Software. (https://www.varnish-software.com/)

Issues can be reported via the Github issue tracker.

Other inquires can be sent to opensource@__no_spam_please__varnish-software.com.

53 changes: 53 additions & 0 deletions bootstrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/sh

warn() {
echo "WARNING: $@" 1>&2
}

case `uname -s` in
Darwin)
LIBTOOLIZE=glibtoolize
;;
FreeBSD)
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

# check for varnishapi.m4 in custom paths
dataroot=$(pkg-config --variable=datarootdir varnishapi 2>/dev/null)
if [ -z "$dataroot" ] ; then
cat >&2 <<'EOF'
Package varnishapi was not found in the pkg-config search path.
Perhaps you should add the directory containing `varnishapi.pc'
to the PKG_CONFIG_PATH environment variable
EOF
exit 1
fi
set -ex
aclocal -I m4 -I ${dataroot}/aclocal
$LIBTOOLIZE --copy --force
autoheader
automake --add-missing --copy --foreign
autoconf
74 changes: 74 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
AC_PREREQ(2.59)
AC_COPYRIGHT([Copyright (c) 2016 Varnish Software Group])
AC_INIT([varnish-vmods], [0.9.1-dev])
AC_CONFIG_MACRO_DIR([m4])
m4_ifndef([VARNISH_VMOD_INCLUDES], AC_MSG_ERROR([Need varnish.m4 -- see README.rst]))
AM_CONFIG_HEADER(config.h)

AC_CANONICAL_SYSTEM
AC_LANG(C)

AM_INIT_AUTOMAKE([foreign])

AC_GNU_SOURCE
AC_PROG_CC
AC_PROG_CC_STDC
if test "x$ac_cv_prog_cc_c99" = xno; then
AC_MSG_ERROR([Could not find a C99 compatible compiler])
fi
AC_PROG_CPP

AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PROG_MAKE_SET

# Check for rst utilities
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"])

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([sys/stdlib.h])

# backwards compat with older pkg-config
# - pull in AC_DEFUN from pkg.m4
m4_ifndef([PKG_CHECK_VAR], [
# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# -------------------------------------------
# Retrieves the value of the pkg-config variable for the given module.
AC_DEFUN([PKG_CHECK_VAR],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$5], [$4])dnl
])# PKG_CHECK_VAR
])

PKG_CHECK_MODULES([libvarnishapi], [varnishapi])
PKG_CHECK_VAR([LIBVARNISHAPI_DATAROOTDIR], [varnishapi], [datarootdir])
PKG_CHECK_VAR([LIBVARNISHAPI_BINDIR], [varnishapi], [bindir])
PKG_CHECK_VAR([LIBVARNISHAPI_SBINDIR], [varnishapi], [sbindir])
AC_SUBST([LIBVARNISHAPI_DATAROOTDIR])

# Varnish include files tree
VARNISH_VMOD_INCLUDES
VARNISH_VMOD_DIR
VARNISH_VMODTOOL

AC_PATH_PROG([VARNISHTEST], [varnishtest], [],
[$LIBVARNISHAPI_BINDIR:$LIBVARNISHAPI_SBINDIR:$PATH])
AC_PATH_PROG([VARNISHD], [varnishd], [],
[$LIBVARNISHAPI_SBINDIR:$LIBVARNISHAPI_BINDIR:$PATH])

AC_CONFIG_FILES([
Makefile
src/Makefile
])
AC_OUTPUT
Loading

0 comments on commit d592a08

Please sign in to comment.