[master] 1dbd3c7 Insert an empty place-holder for the PROXY protocol.
Poul-Henning Kamp
phk at FreeBSD.org
Mon Mar 23 14:41:46 CET 2015
commit 1dbd3c746b63153176af7dc503f29e795db909f4
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Mar 23 10:01:21 2015 +0000
Insert an empty place-holder for the PROXY protocol.
diff --git a/bin/varnishd/Makefile.am b/bin/varnishd/Makefile.am
index 94b6aa4..3f817bd 100644
--- a/bin/varnishd/Makefile.am
+++ b/bin/varnishd/Makefile.am
@@ -78,6 +78,7 @@ varnishd_SOURCES = \
mgt/mgt_shmem.c \
mgt/mgt_vcc.c \
mgt/mgt_vcl.c \
+ proxy/cache_proxy_proto.c \
storage/stevedore.c \
storage/stevedore_mgt.c \
storage/stevedore_utils.c \
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 8a3d759..c39edc6 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -977,6 +977,9 @@ unsigned V1L_Flush(const struct worker *w);
unsigned V1L_FlushRelease(struct worker *w);
size_t V1L_Write(const struct worker *w, const void *ptr, ssize_t len);
+/* cache_proxy.c [VPX] */
+task_func_t VPX_Proto_Sess;
+
/* cache_range.c [VRG] */
void VRG_dorange(struct req *req, struct busyobj *bo, const char *r);
@@ -990,7 +993,7 @@ void SES_DeletePool(struct sesspool *sp);
int SES_Reschedule_Req(struct req *);
struct req *SES_GetReq(const struct worker *, struct sess *);
void SES_ReleaseReq(struct req *);
-void SES_Proto_Sess(struct worker *wrk, void *arg);
+task_func_t SES_Proto_Sess;
#define SESS_ATTR(UP, low, typ, len) \
int SES_Get_##low(const struct sess *sp, typ *dst); \
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index 8dedfca..792964b 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -240,6 +240,9 @@ SES_Proto_Sess(struct worker *wrk, void *arg)
sp->sess_step = S_STP_H1NEWREQ;
wrk->task.func = ses_proto_req;
wrk->task.priv = req;
+ } else if (sp->sess_step < S_STP_PROXY_LAST) {
+ wrk->task.func = VPX_Proto_Sess;
+ wrk->task.priv = sp;
} else {
WRONG("Wrong session step");
}
diff --git a/bin/varnishd/flint.sh b/bin/varnishd/flint.sh
index 7a44dad..dfe59c2 100755
--- a/bin/varnishd/flint.sh
+++ b/bin/varnishd/flint.sh
@@ -20,11 +20,12 @@ flexelint \
-DVARNISH_VCL_DIR=\"foo\" \
cache/*.c \
common/*.c \
- storage/*.c \
- waiter/*.c \
hash/*.c \
http1/*.c \
mgt/*.c \
+ proxy/*.c \
+ storage/*.c \
+ waiter/*.c \
../../lib/libvarnish/*.c \
../../lib/libvarnishcompat/execinfo.c \
../../lib/libvcc/*.c \
diff --git a/bin/varnishd/mgt/mgt_acceptor.c b/bin/varnishd/mgt/mgt_acceptor.c
index 43e3430..404d3e7 100644
--- a/bin/varnishd/mgt/mgt_acceptor.c
+++ b/bin/varnishd/mgt/mgt_acceptor.c
@@ -183,6 +183,9 @@ MAC_Arg(const char *arg)
if (av[2] == NULL || !strcmp(av[2], "HTTP/1")) {
mh->first_step = S_STP_H1NEWSESS;
mh->proto_name = "HTTP/1";
+ } else if (!strcmp(av[2], "PROXY")) {
+ mh->first_step = S_STP_PROXYNEWSESS;
+ mh->proto_name = "PROXY";
} else {
ARGV_ERR("Unknown protocol '%s'\n", av[2]);
}
diff --git a/bin/varnishd/proxy/cache_proxy_proto.c b/bin/varnishd/proxy/cache_proxy_proto.c
new file mode 100644
index 0000000..9f5ca90
--- /dev/null
+++ b/bin/varnishd/proxy/cache_proxy_proto.c
@@ -0,0 +1,41 @@
+/*-
+ * Copyright (c) 2015 Varnish Software AS
+ * All rights reserved.
+ *
+ * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
+ *
+ * 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.
+ *
+ */
+
+#include "config.h"
+
+#include "../cache/cache.h"
+
+void __match_proto__(task_func_t)
+VPX_Proto_Sess(struct worker *wrk, void *priv)
+{
+
+ (void)wrk;
+ (void)priv;
+ INCOMPL();
+}
diff --git a/include/tbl/steps.h b/include/tbl/steps.h
index e9a1b3d..50896b3 100644
--- a/include/tbl/steps.h
+++ b/include/tbl/steps.h
@@ -35,6 +35,9 @@ SESS_STEP(h1newsess, H1NEWSESS)
SESS_STEP(h1newreq, H1NEWREQ)
SESS_STEP(h1working, H1WORKING)
SESS_STEP(h1_last, H1_LAST)
+
+SESS_STEP(proxynewsess, PROXYNEWSESS)
+SESS_STEP(proxy_last, PROXY_LAST)
#endif
#ifdef REQ_STEP
More information about the varnish-commit
mailing list