Commit 82b39cf6 authored by Nils Goroll's avatar Nils Goroll

initial

parents
# build system
.deps/
.libs/
autom4te.cache/
build-aux/
m4/
*.la
*.lo
*.o
*.tar.gz
Makefile
Makefile.in
aclocal.m4
config.h
config.h.in
config.log
config.status
configure
libtool
stamp-h1
# test suite
*.log
*.trs
# vmodtool
vcc_*_if.[ch]
vmod_*.rst
# man
*.1
*_options.rst
*_synopsis.rst
vmod_*.3
ACLOCAL_AMFLAGS = -I m4 -I @VARNISHAPI_DATAROOTDIR@/aclocal
DISTCHECK_CONFIGURE_FLAGS = RST2MAN=:
SUBDIRS = src
#!/bin/sh
set -e
set -u
WORK_DIR=$(pwd)
ROOT_DIR=$(dirname "$0")
cd "$ROOT_DIR"
if ! command -v libtoolize >/dev/null
then
echo "libtoolize: command not found, falling back to glibtoolize" >&2
alias libtoolize=glibtoolize
fi
mkdir -p m4
aclocal
libtoolize --copy --force
autoheader
automake --add-missing --copy --foreign
autoconf
cd "$WORK_DIR"
"$ROOT_DIR"/configure "$@"
AC_PREREQ([2.68])
AC_INIT([libvmod-objesi], [0.1])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE([1.12 -Wall -Werror foreign parallel-tests])
AM_SILENT_RULES([yes])
AM_PROG_AR
LT_PREREQ([2.2.6])
LT_INIT([dlopen disable-static])
AC_ARG_WITH([rst2man],
AS_HELP_STRING(
[--with-rst2man=PATH],
[Location of rst2man (auto)]),
[RST2MAN="$withval"],
AC_CHECK_PROGS(RST2MAN, [rst2man rst2man.py], []))
VARNISH_PREREQ([6.0.0])
VARNISH_VMODS([objesi])
AC_CONFIG_FILES([
Makefile
src/Makefile
])
AC_OUTPUT
AS_ECHO("
==== $PACKAGE_STRING ====
varnish: $VARNISH_VERSION
prefix: $prefix
vmoddir: $vmoddir
vcldir: $vcldir
pkgvcldir: $pkgvcldir
compiler: $CC
cflags: $CFLAGS
ldflags: $LDFLAGS
")
AM_CFLAGS = $(VARNISHAPI_CFLAGS)
# Modules
vmod_LTLIBRARIES = \
libvmod_objesi.la
libvmod_objesi_la_LDFLAGS = $(VMOD_LDFLAGS)
libvmod_objesi_la_SOURCES = vmod_objesi.c
nodist_libvmod_objesi_la_SOURCES = \
vcc_objesi_if.c \
vcc_objesi_if.h
@BUILD_VMOD_OBJESI@
# Test suite
AM_TESTS_ENVIRONMENT = \
PATH="$(abs_builddir):$(VARNISH_TEST_PATH):$(PATH)" \
LD_LIBRARY_PATH="$(VARNISH_LIBRARY_PATH)"
TEST_EXTENSIONS = .vtc
VTC_LOG_COMPILER = varnishtest -v
AM_VTC_LOG_FLAGS = \
-p vcl_path="$(abs_top_srcdir)/vcl:$(VARNISHAPI_VCLDIR)" \
-p vmod_path="$(abs_builddir)/.libs:$(vmoddir):$(VARNISHAPI_VMODDIR)"
TESTS = \
vtc/vmod_objesi.vtc
# Documentation
dist_doc_DATA = \
vmod_objesi.vcc \
$(TESTS)
dist_man_MANS = \
vmod_objesi.3
.rst.1:
$(AM_V_GEN) $(RST2MAN) $< $@
#include "config.h"
#include <cache/cache.h>
#include "vcc_objesi_if.h"
//#include "vrt.h"
#include "vcl.h"
VCL_BOOL
vmod_is_esi(VRT_CTX)
{
struct req *req;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
if ((ctx->method & VCL_MET_DELIVER) == 0) {
VRT_fail(ctx, "objesi.is_esi may only be called from "
"vcl_deliver {}");
return (0);
}
req = ctx->req;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
if (!ctx->req->disable_esi &&
ObjGetLen(req->wrk, req->objcore) > 0 &&
ObjHasAttr(req->wrk, req->objcore, OA_ESIDATA))
return (1);
return (0);
}
$Module objesi 3 "Varnish objesi Module"
DESCRIPTION
===========
This vmod specifically adds a way to determine if ESI processing is
not only enabled, but actually active for delivery of an object. It
basically compensates for the issue documented in
https://github.com/varnishcache/varnish-cache/issues/3002
For ESI delivery to be active, ``beresp.do_esi`` must have been
enabled when the respective object went into the cache, it must have
been enabled for ESI processing (see, for example the
``esi_disable_xml_check`` feature flag) and ``resp.do_esi`` must be
true.
Example::
import objesi;
sub vcl_deliver {
if (objesi.is_esi) {
# ... do things to happen only for esi
}
}
$Function BOOL is_esi()
Return true if ESI processing is active.
May only be called from ``vcl_deliver {}``.
SEE ALSO
========vcl\(7),varnishd\(1)
varnishtest "test vmod-objesi"
server s1 {
rxreq
txresp -body "123"
# from e3.vtc
rxreq
expect req.url == "/esi"
txresp -body {
<html>
Before include
<esi:include src="/body" sr="foo"/>
After include
</html>
}
rxreq
expect req.url == "/body"
expect req.http.esi0 != "foo"
txresp -body {
Included file
}
} -start
varnish v1 -vcl+backend {
import objesi;
sub vcl_backend_response {
set beresp.do_esi = true;
}
sub vcl_deliver {
if (req.http.disable) {
set resp.do_esi = false;
}
set resp.http.is-esi = objesi.is_esi();
}
} -start
client c1 {
txreq
rxresp
expect resp.status == 200
expect resp.http.is-esi == "false"
txreq -url "/esi"
rxresp
expect resp.status == 200
expect resp.http.is-esi == "true"
txreq -url "/esi" -hdr "disable: 1"
rxresp
expect resp.status == 200
expect resp.http.is-esi == "false"
} -run
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment