[master] 2ea02cb Segregate HTTP1 protocol stuff in its own include file.
Poul-Henning Kamp
phk at FreeBSD.org
Wed Jun 24 22:45:12 CEST 2015
commit 2ea02cb47c42e977255279c8f793f1a1a034c5c5
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed Jun 24 18:32:32 2015 +0000
Segregate HTTP1 protocol stuff in its own include file.
diff --git a/bin/varnishd/Makefile.am b/bin/varnishd/Makefile.am
index e82770a..dc20242 100644
--- a/bin/varnishd/Makefile.am
+++ b/bin/varnishd/Makefile.am
@@ -103,6 +103,7 @@ noinst_HEADERS = \
cache/cache_pool.h \
common/heritage.h \
hash/hash_slinger.h \
+ http1/cache_http1.h \
mgt/mgt.h \
mgt/mgt_cli.h \
mgt/mgt_param.h \
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 490c11b..a9c04c9 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -707,27 +707,10 @@ ssize_t VBO_waitlen(struct worker *, struct busyobj *, ssize_t l);
void VBO_setstate(struct busyobj *bo, enum busyobj_state_e next);
void VBO_waitstate(struct busyobj *bo, enum busyobj_state_e want);
-
-/* cache_http1_fetch.c [V1F] */
-int V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, const char *def_host);
-void V1F_Setup_Fetch(struct vfp_ctx *vfc, struct http_conn *htc);
-
-/* cache_http1_fsm.c [HTTP1] */
-typedef int (req_body_iter_f)(struct req *, void *priv, void *ptr, size_t);
-void HTTP1_Session(struct worker *, struct req *);
-extern const int HTTP1_Req[3];
-extern const int HTTP1_Resp[3];
-
-/* cache_http1_deliver.c */
-vtr_deliver_f V1D_Deliver;
-
-/* cache_http1_pipe.c */
-void V1P_Init(void);
-void V1P_Process(struct req *, struct busyobj *, int fd, struct VSC_C_vbe *);
-
/* cache_req_body.c */
int VRB_Ignore(struct req *req);
ssize_t VRB_Cache(struct req *req, ssize_t maxsize);
+typedef int (req_body_iter_f)(struct req *, void *priv, void *ptr, size_t);
ssize_t VRB_Iterate(struct req *req, req_body_iter_f *func, void *priv);
void VRB_Free(struct req *req);
@@ -958,14 +941,6 @@ int Pool_TrySumstat(struct worker *wrk);
void Pool_PurgeStat(unsigned nobj);
int Pool_Task_Any(struct pool_task *task, enum task_how how);
-#define V1L_IsReleased(w) ((w)->v1l == NULL)
-void V1L_Chunked(const struct worker *w);
-void V1L_EndChunk(const struct worker *w);
-void V1L_Reserve(struct worker *, struct ws *, int *fd, struct vsl_log *, double t0);
-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;
diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c
index 7602155..46fe79c 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -41,6 +41,7 @@
#include "cache_director.h"
#include "cache_backend.h"
+#include "http1/cache_http1.h"
#define FIND_TMO(tmx, dst, bo, be) \
do { \
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index ce83b99..0d7ba9f 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -621,9 +621,6 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
return (F_STP_ERROR);
}
- assert(V1L_IsReleased(wrk));
-
-
if (bo->do_esi)
ObjSetFlag(bo->wrk, bo->fetch_objcore, OF_ESIPROC, 1);
@@ -916,7 +913,6 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
WRONG("Illegal fetch_step");
}
}
- assert(V1L_IsReleased(wrk));
assert(bo->director_state == DIR_S_NULL);
diff --git a/bin/varnishd/cache/cache_main.c b/bin/varnishd/cache/cache_main.c
index da9c297..cb5175a 100644
--- a/bin/varnishd/cache/cache_main.c
+++ b/bin/varnishd/cache/cache_main.c
@@ -33,6 +33,7 @@
#include <stdlib.h>
#include "cache.h"
+#include "http1/cache_http1.h"
#include "common/heritage.h"
#include "vcli_priv.h"
diff --git a/bin/varnishd/cache/cache_req_body.c b/bin/varnishd/cache/cache_req_body.c
index c3965ce..a353c81 100644
--- a/bin/varnishd/cache/cache_req_body.c
+++ b/bin/varnishd/cache/cache_req_body.c
@@ -33,6 +33,7 @@
#include <stdlib.h>
#include "cache.h"
+#include "http1/cache_http1.h"
#include "cache_filter.h"
#include "vtim.h"
#include "hash/hash_slinger.h"
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index e19c0b9..f3ab04a 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -47,6 +47,7 @@
#include "cache.h"
#include "cache_pool.h"
+#include "http1/cache_http1.h"
#include "vsa.h"
#include "vtcp.h"
diff --git a/bin/varnishd/http1/cache_http1.h b/bin/varnishd/http1/cache_http1.h
new file mode 100644
index 0000000..dcd4cb0
--- /dev/null
+++ b/bin/varnishd/http1/cache_http1.h
@@ -0,0 +1,54 @@
+/*-
+ * 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.
+ *
+ */
+
+/* cache_http1_fetch.c [V1F] */
+int V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, const char *def_host);
+void V1F_Setup_Fetch(struct vfp_ctx *vfc, struct http_conn *htc);
+
+/* cache_http1_fsm.c [HTTP1] */
+void HTTP1_Session(struct worker *, struct req *);
+extern const int HTTP1_Req[3];
+extern const int HTTP1_Resp[3];
+
+/* cache_http1_deliver.c */
+vtr_deliver_f V1D_Deliver;
+
+/* cache_http1_pipe.c */
+void V1P_Init(void);
+void V1P_Process(struct req *, struct busyobj *, int fd, struct VSC_C_vbe *);
+
+/* cache_http1_line.c */
+void V1L_Chunked(const struct worker *w);
+void V1L_EndChunk(const struct worker *w);
+void V1L_Reserve(struct worker *, struct ws *, int *fd, struct vsl_log *,
+ double t0);
+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);
+
diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c
index 710dee2..f0762df 100644
--- a/bin/varnishd/http1/cache_http1_deliver.c
+++ b/bin/varnishd/http1/cache_http1_deliver.c
@@ -31,6 +31,7 @@
#include "cache/cache.h"
#include "cache/cache_filter.h"
+#include "cache_http1.h"
/*--------------------------------------------------------------------*/
diff --git a/bin/varnishd/http1/cache_http1_fetch.c b/bin/varnishd/http1/cache_http1_fetch.c
index cc63d92..6223b15 100644
--- a/bin/varnishd/http1/cache_http1_fetch.c
+++ b/bin/varnishd/http1/cache_http1_fetch.c
@@ -44,6 +44,7 @@
#include "cache/cache_director.h"
#include "cache/cache_backend.h"
+#include "cache_http1.h"
/*--------------------------------------------------------------------
* Pass the request body to the backend
diff --git a/bin/varnishd/http1/cache_http1_fsm.c b/bin/varnishd/http1/cache_http1_fsm.c
index 8954061..103ba3b 100644
--- a/bin/varnishd/http1/cache_http1_fsm.c
+++ b/bin/varnishd/http1/cache_http1_fsm.c
@@ -38,6 +38,7 @@
#include <stdlib.h>
#include "cache/cache.h"
+#include "cache_http1.h"
#include "hash/hash_slinger.h"
#include "vtcp.h"
diff --git a/bin/varnishd/http1/cache_http1_line.c b/bin/varnishd/http1/cache_http1_line.c
index a71e163..2bcaf6e 100644
--- a/bin/varnishd/http1/cache_http1_line.c
+++ b/bin/varnishd/http1/cache_http1_line.c
@@ -41,6 +41,7 @@
#include <stdio.h>
#include "cache/cache.h"
+#include "cache_http1.h"
#include "vtim.h"
/*--------------------------------------------------------------------*/
diff --git a/bin/varnishd/http1/cache_http1_pipe.c b/bin/varnishd/http1/cache_http1_pipe.c
index 04ee8dd..b80141c 100644
--- a/bin/varnishd/http1/cache_http1_pipe.c
+++ b/bin/varnishd/http1/cache_http1_pipe.c
@@ -40,6 +40,7 @@
#include "vtcp.h"
#include "vtim.h"
+#include "cache_http1.h"
#include "cache/cache_director.h"
#include "cache/cache_backend.h"
diff --git a/bin/varnishd/http1/cache_http1_proto.c b/bin/varnishd/http1/cache_http1_proto.c
index fc20bae..933c232 100644
--- a/bin/varnishd/http1/cache_http1_proto.c
+++ b/bin/varnishd/http1/cache_http1_proto.c
@@ -46,6 +46,7 @@
#include "config.h"
#include "cache/cache.h"
+#include "cache_http1.h"
#include "vct.h"
diff --git a/bin/varnishd/http1/cache_http1_vfp.c b/bin/varnishd/http1/cache_http1_vfp.c
index f620937..c63716d 100644
--- a/bin/varnishd/http1/cache_http1_vfp.c
+++ b/bin/varnishd/http1/cache_http1_vfp.c
@@ -40,6 +40,7 @@
#include "cache/cache.h"
#include "cache/cache_filter.h"
+#include "cache_http1.h"
#include "vct.h"
More information about the varnish-commit
mailing list