Mailing List Archive

[master] b5d8e5713 Move the V1L-based VDP to cache_http1_line.c
commit b5d8e57138c488efcc47df6f41a150063f1cf178
Author: Nils Goroll <nils.goroll@uplex.de>
Date: Wed Dec 27 10:16:06 2023 +0100

Move the V1L-based VDP to cache_http1_line.c

This is to prepare for reuse, but arguably the new home might actually
be the better place?

diff --git a/bin/varnishd/http1/cache_http1.h b/bin/varnishd/http1/cache_http1.h
index a9f905376..d6639f273 100644
--- a/bin/varnishd/http1/cache_http1.h
+++ b/bin/varnishd/http1/cache_http1.h
@@ -65,3 +65,4 @@ void V1L_Open(struct worker *, struct ws *, int *fd, struct vsl_log *,
stream_close_t V1L_Flush(const struct worker *w);
stream_close_t V1L_Close(struct worker *w, uint64_t *cnt);
size_t V1L_Write(const struct worker *w, const void *ptr, ssize_t len);
+extern const struct vdp * const v1l_vdp;
diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c
index 6bed2b08d..657ce9e24 100644
--- a/bin/varnishd/http1/cache_http1_deliver.c
+++ b/bin/varnishd/http1/cache_http1_deliver.c
@@ -39,31 +39,6 @@

/*--------------------------------------------------------------------*/

-static int v_matchproto_(vdp_bytes_f)
-v1d_bytes(struct vdp_ctx *vdc, enum vdp_action act, void **priv,
- const void *ptr, ssize_t len)
-{
- ssize_t wl = 0;
-
- CHECK_OBJ_NOTNULL(vdc, VDP_CTX_MAGIC);
- (void)priv;
-
- AZ(vdc->nxt); /* always at the bottom of the pile */
-
- if (len > 0)
- wl = V1L_Write(vdc->wrk, ptr, len);
- if (act > VDP_NULL && V1L_Flush(vdc->wrk) != SC_NULL)
- return (-1);
- if (len != wl)
- return (-1);
- return (0);
-}
-
-static const struct vdp v1d_vdp = {
- .name = "V1B",
- .bytes = v1d_bytes,
-};
-
static void
v1d_error(struct req *req, const char *msg)
{
@@ -122,7 +97,7 @@ V1D_Deliver(struct req *req, struct boc *boc, int sendbody)
}
INIT_OBJ(ctx, VRT_CTX_MAGIC);
VCL_Req2Ctx(ctx, req);
- if (VDP_Push(ctx, req->vdc, req->ws, &v1d_vdp, NULL)) {
+ if (VDP_Push(ctx, req->vdc, req->ws, v1l_vdp, NULL)) {
v1d_error(req, "Failure to push v1d processor");
return;
}
diff --git a/bin/varnishd/http1/cache_http1_line.c b/bin/varnishd/http1/cache_http1_line.c
index 8c6f53b16..9c13fb90d 100644
--- a/bin/varnishd/http1/cache_http1_line.c
+++ b/bin/varnishd/http1/cache_http1_line.c
@@ -43,6 +43,7 @@

#include <sys/uio.h>
#include "cache/cache_varnishd.h"
+#include "cache/cache_filter.h"

#include <stdio.h>

@@ -339,3 +340,32 @@ V1L_EndChunk(const struct worker *wrk)
v1l->cliov = 0;
(void)V1L_Write(wrk, "0\r\n\r\n", -1);
}
+
+/*--------------------------------------------------------------------
+ * VDP using V1L
+ */
+
+static int v_matchproto_(vdp_bytes_f)
+v1l_bytes(struct vdp_ctx *vdc, enum vdp_action act, void **priv,
+ const void *ptr, ssize_t len)
+{
+ ssize_t wl = 0;
+
+ CHECK_OBJ_NOTNULL(vdc, VDP_CTX_MAGIC);
+ (void)priv;
+
+ AZ(vdc->nxt); /* always at the bottom of the pile */
+
+ if (len > 0)
+ wl = V1L_Write(vdc->wrk, ptr, len);
+ if (act > VDP_NULL && V1L_Flush(vdc->wrk) != SC_NULL)
+ return (-1);
+ if (len != wl)
+ return (-1);
+ return (0);
+}
+
+const struct vdp * const v1l_vdp = &(struct vdp){
+ .name = "V1B",
+ .bytes = v1l_bytes,
+};
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit