Mailing List Archive

r76 - trunk/varnish-cache/bin/varnishd
Author: phk
Date: 2006-03-27 13:22:29 +0200 (Mon, 27 Mar 2006)
New Revision: 76

Modified:
trunk/varnish-cache/bin/varnishd/Makefile.am
trunk/varnish-cache/bin/varnishd/cache_acceptor.c
trunk/varnish-cache/bin/varnishd/varnishd.c
Log:
Experimentally pull in VCL program



Modified: trunk/varnish-cache/bin/varnishd/Makefile.am
===================================================================
--- trunk/varnish-cache/bin/varnishd/Makefile.am 2006-03-27 11:21:58 UTC (rev 75)
+++ trunk/varnish-cache/bin/varnishd/Makefile.am 2006-03-27 11:22:29 UTC (rev 76)
@@ -14,8 +14,11 @@
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

Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-03-27 11:21:58 UTC (rev 75)
+++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-03-27 11:22:29 UTC (rev 76)
@@ -37,7 +37,6 @@
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 @@
sp->hdr_e = p;
event_del(sp->rd_e);
HttpdAnalyze(sp);
+
+ /* XXX: for now, pass everything */
+ sp->handling = HND_Pass;
}

static void

Modified: trunk/varnish-cache/bin/varnishd/varnishd.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/varnishd.c 2006-03-27 11:21:58 UTC (rev 75)
+++ trunk/varnish-cache/bin/varnishd/varnishd.c 2006-03-27 11:22:29 UTC (rev 76)
@@ -23,6 +23,7 @@
#include <cli.h>
#include <cli_priv.h>
#include <libvarnish.h>
+#include <libvcl.h>

#include "mgt.h"
#include "heritage.h"
@@ -204,7 +205,15 @@

/* for development purposes */
#include <printf.h>
+#include <err.h>

+#include <dlfcn.h>
+
+void
+VCL_count(unsigned u)
+{
+}
+
int
main(int argc, char *argv[])
{
@@ -213,7 +222,31 @@
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) {
case 'd':