[master] dd40eaa Make WRW_WriteH() an internal http1_proto helper
Poul-Henning Kamp
phk at FreeBSD.org
Wed Oct 22 09:33:32 CEST 2014
commit dd40eaa800e0fe6cb9bdd4db6594817b6127d34c
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed Oct 22 07:33:19 2014 +0000
Make WRW_WriteH() an internal http1_proto helper
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 63fbcf4..0e9668e 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -959,7 +959,6 @@ void WRW_Reserve(struct worker *w, int *fd, struct vsl_log *, double t0);
unsigned WRW_Flush(const struct worker *w);
unsigned WRW_FlushRelease(struct worker *w, uint64_t *pacc);
unsigned WRW_Write(const struct worker *w, const void *ptr, int len);
-unsigned WRW_WriteH(const struct worker *w, const txt *hh, const char *suf);
/* cache_session.c [SES] */
void SES_Close(struct sess *sp, enum sess_close reason);
diff --git a/bin/varnishd/cache/cache_wrw.c b/bin/varnishd/cache/cache_wrw.c
index 948c562..2206ea7 100644
--- a/bin/varnishd/cache/cache_wrw.c
+++ b/bin/varnishd/cache/cache_wrw.c
@@ -224,23 +224,6 @@ WRW_FlushRelease(struct worker *wrk, uint64_t *pacc)
}
unsigned
-WRW_WriteH(const struct worker *wrk, const txt *hh, const char *suf)
-{
- unsigned u;
-
- CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
- AN(wrk->wrw->wfd);
- AN(wrk);
- AN(hh);
- AN(hh->b);
- AN(hh->e);
- u = WRW_Write(wrk, hh->b, hh->e - hh->b);
- if (suf != NULL)
- u += WRW_Write(wrk, suf, -1);
- return (u);
-}
-
-unsigned
WRW_Write(const struct worker *wrk, const void *ptr, int len)
{
struct wrw *wrw;
diff --git a/bin/varnishd/http1/cache_http1_proto.c b/bin/varnishd/http1/cache_http1_proto.c
index 8eac608..70a007e 100644
--- a/bin/varnishd/http1/cache_http1_proto.c
+++ b/bin/varnishd/http1/cache_http1_proto.c
@@ -519,6 +519,22 @@ HTTP1_DissectResponse(struct http *hp, struct http_conn *htc)
/*--------------------------------------------------------------------*/
+static unsigned
+http1_WrTxt(const struct worker *wrk, const txt *hh, const char *suf)
+{
+ unsigned u;
+
+ CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
+ AN(wrk);
+ AN(hh);
+ AN(hh->b);
+ AN(hh->e);
+ u = WRW_Write(wrk, hh->b, hh->e - hh->b);
+ if (suf != NULL)
+ u += WRW_Write(wrk, suf, -1);
+ return (u);
+}
+
unsigned
HTTP1_Write(const struct worker *w, const struct http *hp, const int *hf)
{
@@ -528,12 +544,12 @@ HTTP1_Write(const struct worker *w, const struct http *hp, const int *hf)
AN(hp->hd[hf[0]].b);
AN(hp->hd[hf[1]].b);
AN(hp->hd[hf[2]].b);
- l = WRW_WriteH(w, &hp->hd[hf[0]], " ");
- l += WRW_WriteH(w, &hp->hd[hf[1]], " ");
- l += WRW_WriteH(w, &hp->hd[hf[2]], "\r\n");
+ l = http1_WrTxt(w, &hp->hd[hf[0]], " ");
+ l += http1_WrTxt(w, &hp->hd[hf[1]], " ");
+ l += http1_WrTxt(w, &hp->hd[hf[2]], "\r\n");
for (u = HTTP_HDR_FIRST; u < hp->nhd; u++)
- l += WRW_WriteH(w, &hp->hd[u], "\r\n");
+ l += http1_WrTxt(w, &hp->hd[u], "\r\n");
l += WRW_Write(w, "\r\n", -1);
return (l);
}
More information about the varnish-commit
mailing list