From 937eddff7c375ca748a5962f0394d02c3eaa960e Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 27 Mar 2006 11:22:29 +0000 Subject: [PATCH] Experimentally pull in VCL program git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@76 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/Makefile.am | 3 ++ varnish-cache/bin/varnishd/cache_acceptor.c | 4 ++- varnish-cache/bin/varnishd/varnishd.c | 33 +++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/varnish-cache/bin/varnishd/Makefile.am b/varnish-cache/bin/varnishd/Makefile.am index ef009320..34828a61 100644 --- a/varnish-cache/bin/varnishd/Makefile.am +++ b/varnish-cache/bin/varnishd/Makefile.am @@ -14,8 +14,11 @@ varnishd_SOURCES = \ tcp.c \ varnishd.c +varnishd_LDFLAGS = -export-dynamic + varnishd_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libsbuf/libsbuf.la \ + $(top_builddir)/lib/libvcl/libvcl.la \ $(top_builddir)/contrib/libevent/libevent.la \ -lpthread diff --git a/varnish-cache/bin/varnishd/cache_acceptor.c b/varnish-cache/bin/varnishd/cache_acceptor.c index 7df59c41..ae46f4f6 100644 --- a/varnish-cache/bin/varnishd/cache_acceptor.c +++ b/varnish-cache/bin/varnishd/cache_acceptor.c @@ -37,7 +37,6 @@ http_read_f(int fd, short event, void *arg) const char *p; int i; - printf("%s(%d, %d, ...)\n", __func__, fd, event); assert(VCA_RXBUFSIZE - sp->rcv_len > 0); i = read(fd, sp->rcv + sp->rcv_len, VCA_RXBUFSIZE - sp->rcv_len); if (i <= 0) { @@ -67,6 +66,9 @@ http_read_f(int fd, short event, void *arg) sp->hdr_e = p; event_del(sp->rd_e); HttpdAnalyze(sp); + + /* XXX: for now, pass everything */ + sp->handling = HND_Pass; } static void diff --git a/varnish-cache/bin/varnishd/varnishd.c b/varnish-cache/bin/varnishd/varnishd.c index 3957a607..7e7a0734 100644 --- a/varnish-cache/bin/varnishd/varnishd.c +++ b/varnish-cache/bin/varnishd/varnishd.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "mgt.h" #include "heritage.h" @@ -204,6 +205,14 @@ init_vsl(const char *fn, unsigned size) /* for development purposes */ #include +#include + +#include + +void +VCL_count(unsigned u) +{ +} int main(int argc, char *argv[]) @@ -213,6 +222,30 @@ main(int argc, char *argv[]) unsigned dflag = 1; /* XXX: debug=on for now */ register_printf_render_std((const unsigned char *)"HVQ"); + + { + struct sbuf *sb; + + VCL_InitCompile(); + sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); + assert(sb != NULL); + VCL_Compile(sb, + "backend default { set backend.ip = 10.0.0.1; } ", + NULL); + sbuf_finish(sb); + fprintf(stderr, "Result: %s\n", sbuf_data(sb)); + + { + void *dlhandle; + + dlhandle = dlopen("/tmp/_.so.1", + RTLD_NOW | RTLD_LOCAL ); + if (dlhandle == NULL) + err(1, "dlopen %s", dlerror()); + + } + exit (0); + } while ((o = getopt(argc, argv, "dp:")) != -1) switch (o) { -- 2.39.5