Commit 0776128d authored by Lasse Karstensen's avatar Lasse Karstensen

Merge branch 'master' into 4.1

parents d0bdfb19 6ad2dd4d
......@@ -405,6 +405,18 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv,
}
}
/*
* Account body bytes on req
* Push bytes to preq
*/
static inline int
ved_bytes(struct req *req, struct req *preq, enum vdp_action act,
const void *ptr, ssize_t len)
{
req->acct.resp_bodybytes += len;
return (VDP_bytes(preq, act, ptr, len));
}
/*---------------------------------------------------------------------
* If a gzip'ed ESI object includes a ungzip'ed object, we need to make
* it looked like a gzip'ed data stream. The official way to do so would
......@@ -431,9 +443,11 @@ ved_pretend_gzip(struct req *req, enum vdp_action act, void **priv,
const uint8_t *p;
uint16_t lx;
struct ecx *ecx;
struct req *preq;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
CAST_OBJ_NOTNULL(ecx, *priv, ECX_MAGIC);
preq = ecx->preq;
(void)priv;
if (act == VDP_INIT)
......@@ -443,7 +457,7 @@ ved_pretend_gzip(struct req *req, enum vdp_action act, void **priv,
return (0);
}
if (l == 0)
return (VDP_bytes(ecx->preq, act, pv, l));
return (ved_bytes(req, ecx->preq, act, pv, l));
p = pv;
......@@ -460,23 +474,23 @@ ved_pretend_gzip(struct req *req, enum vdp_action act, void **priv,
while (l > 0) {
if (l >= 65535) {
lx = 65535;
if (VDP_bytes(ecx->preq, VDP_NULL, buf1, sizeof buf1))
if (ved_bytes(req, preq, VDP_NULL, buf1, sizeof buf1))
return (-1);
} else {
lx = (uint16_t)l;
buf2[0] = 0;
vle16enc(buf2 + 1, lx);
vle16enc(buf2 + 3, ~lx);
if (VDP_bytes(ecx->preq, VDP_NULL, buf2, sizeof buf2))
if (ved_bytes(req, preq, VDP_NULL, buf2, sizeof buf2))
return (-1);
}
if (VDP_bytes(ecx->preq, VDP_NULL, p, lx))
if (ved_bytes(req, preq, VDP_NULL, p, lx))
return (-1);
l -= lx;
p += lx;
}
/* buf2 is local, have to flush */
return (VDP_bytes(ecx->preq, VDP_FLUSH, NULL, 0));
return (ved_bytes(req, preq, VDP_FLUSH, NULL, 0));
}
/*---------------------------------------------------------------------
......@@ -515,10 +529,12 @@ ved_stripgzip(struct req *req, struct busyobj *bo)
void *sp;
ssize_t sl, ll, dl;
struct ecx *ecx;
struct req *preq;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC);
CAST_OBJ_NOTNULL(ecx, req->transport_priv, ECX_MAGIC);
preq = ecx->preq;
if (bo != NULL)
VBO_waitstate(bo, BOS_FINISHED);
......@@ -578,7 +594,7 @@ ved_stripgzip(struct req *req, struct busyobj *bo)
if (dl > 0) {
if (dl > sl)
dl = sl;
if (VDP_bytes(ecx->preq, VDP_NULL, pp, dl))
if (ved_bytes(req, preq, VDP_NULL, pp, dl))
break;
ll += dl;
sl -= dl;
......@@ -589,7 +605,7 @@ ved_stripgzip(struct req *req, struct busyobj *bo)
/* Remove the "LAST" bit */
dbits[0] = *pp;
dbits[0] &= ~(1U << (last & 7));
if (VDP_bytes(ecx->preq, VDP_NULL, dbits, 1))
if (ved_bytes(req, preq, VDP_NULL, dbits, 1))
break;
ll++;
sl--;
......@@ -601,7 +617,7 @@ ved_stripgzip(struct req *req, struct busyobj *bo)
if (dl > 0) {
if (dl > sl)
dl = sl;
if (VDP_bytes(ecx->preq, VDP_NULL, pp, dl))
if (ved_bytes(req, preq, VDP_NULL, pp, dl))
break;
ll += dl;
sl -= dl;
......@@ -663,7 +679,7 @@ ved_stripgzip(struct req *req, struct busyobj *bo)
default:
WRONG("compiler must be broken");
}
if (VDP_bytes(ecx->preq, VDP_NULL, dbits + 1, lpad))
if (ved_bytes(req, preq, VDP_NULL, dbits + 1, lpad))
break;
}
if (sl > 0) {
......@@ -686,7 +702,7 @@ ved_stripgzip(struct req *req, struct busyobj *bo)
}
} while (ois == OIS_DATA || ois == OIS_STREAM);
ObjIterEnd(req->objcore, &oi);
(void)VDP_bytes(ecx->preq, VDP_FLUSH, NULL, 0);
(void)ved_bytes(req, preq, VDP_FLUSH, NULL, 0);
icrc = vle32dec(tailbuf);
ilen = vle32dec(tailbuf + 4);
......@@ -711,8 +727,7 @@ ved_vdp_bytes(struct req *req, enum vdp_action act, void **priv,
return (0);
}
CAST_OBJ_NOTNULL(preq, *priv, REQ_MAGIC);
req->acct.resp_bodybytes += len;
return (VDP_bytes(preq, act, ptr, len));
return (ved_bytes(req, preq, act, ptr, len));
}
/*--------------------------------------------------------------------*/
......
......@@ -251,17 +251,21 @@ usage(void)
{
#define FMT " %-28s # %s\n"
fprintf(stderr, "usage: varnishstat "
"[-1lV] [-f field] "
"[-1lV] [-f field] [-t seconds|<off>] "
VSC_n_USAGE "\n");
fprintf(stderr, FMT, "-1", "Print the statistics to stdout.");
fprintf(stderr, FMT, "-f field", "Field inclusion glob");
fprintf(stderr, FMT, "",
"If it starts with '^' it is used as an exclusion list");
"If it starts with '^' it is used as an exclusion list.");
fprintf(stderr, FMT, "-l",
"Lists the available fields to use with the -f option");
"Lists the available fields to use with the -f option.");
fprintf(stderr, FMT, "-n varnish_name",
"The varnishd instance to get logs from");
fprintf(stderr, FMT, "-V", "Display the version number and exit");
"The varnishd instance to get logs from.");
fprintf(stderr, FMT, "-N filename",
"Filename of a stale VSM instance.");
fprintf(stderr, FMT, "-t seconds|<off>",
"Timeout before returning error on initial VSM connection.");
fprintf(stderr, FMT, "-V", "Display the version number and exit.");
fprintf(stderr, FMT, "-x",
"Print statistics to stdout as XML.");
fprintf(stderr, FMT, "-j",
......
......@@ -384,14 +384,14 @@ sample_points(void)
pt->t_cur = VTIM_mono();
if (pt->t_last)
pt->chg = ((intmax_t)pt->cur - (intmax_t)pt->last) /
pt->chg = ((int64_t)pt->cur - (int64_t)pt->last) /
(pt->t_cur - pt->t_last);
if (pt->semantics == 'g') {
pt->avg = 0.;
update_ma(&pt->ma_10, pt->cur);
update_ma(&pt->ma_100, pt->cur);
update_ma(&pt->ma_1000, pt->cur);
update_ma(&pt->ma_10, (int64_t)pt->cur);
update_ma(&pt->ma_100, (int64_t)pt->cur);
update_ma(&pt->ma_1000, (int64_t)pt->cur);
} else if (pt->semantics == 'c') {
if (VSC_C_main != NULL && VSC_C_main->uptime)
pt->avg = pt->cur / VSC_C_main->uptime;
......
......@@ -2,7 +2,7 @@ varnishtest "Check lack of response-string"
server s1 {
rxreq
send "HTTP/1.1 200 \r\n"
send "HTTP/1.0 200 \r\n"
send "Connection: close\r\n"
send "\r\n"
send "\r\n"
......@@ -20,7 +20,7 @@ client c1 {
server s1 {
rxreq
send "HTTP/1.1 200\r\n"
send "HTTP/1.0 200\r\n"
send "Connection: close\r\n"
send "\r\n"
send "\r\n"
......
varnishtest "C-L/T-E:chunked conflict"
server s1 {
non-fatal
rxreq
expect req.bodylen == 20
......@@ -20,6 +21,7 @@ varnish v1 -vcl+backend { } -start
client c1 {
non-fatal
send "PUT /1 HTTP/1.1\r\n"
send "Content-Length: 31\r\n"
send "Transfer-Encoding: chunked\r\n"
......@@ -35,7 +37,7 @@ client c1 {
} -run
client c1 {
fatal
send "PUT /2 HTTP/1.1\r\n"
send "Transfer-Encoding: chunked\r\n"
send "\r\n"
......
......@@ -165,11 +165,11 @@ process_thread(void *priv)
if (WIFEXITED(p->status) && WEXITSTATUS(p->status) == 0)
return (NULL);
#ifdef WCOREDUMP
vtc_log(p->vl, 2, "Bad exit code: %04x sig %x exit %x core %x",
vtc_log(p->vl, 2, "Bad exit code: %04x sig %d exit %d core %d",
p->status, WTERMSIG(p->status), WEXITSTATUS(p->status),
WCOREDUMP(p->status));
#else
vtc_log(p->vl, 2, "Bad exit code: %04x sig %x exit %x",
vtc_log(p->vl, 2, "Bad exit code: %04x sig %d exit %d",
p->status, WTERMSIG(p->status), WEXITSTATUS(p->status));
#endif
......@@ -202,7 +202,7 @@ process_start(struct process *p)
if (p->pid == 0) {
assert(dup2(p->fds[0], 0) == 0);
assert(dup2(out_fd, 1) == 1);
assert(dup2(out_fd, 2) == 2);
assert(dup2(err_fd, 2) == 2);
for (i = 3; i <getdtablesize(); i++)
(void)close(i);
AZ(execl("/bin/sh", "/bin/sh", "-c", VSB_data(cl), (char*)0));
......@@ -299,7 +299,7 @@ process_close(struct process *p)
if (!p->running || !p->pid)
vtc_log(p->vl, 0, "Cannot close on a non-running process");
AZ(close(p->fds[1]));
(void)close(p->fds[1]);
p->fds[1] = -1;
}
......
......@@ -15,7 +15,7 @@ Varnish Cache statistics
SYNOPSIS
========
varnishstat [-1] [-x] [-j] [-f field] [-l] [-n varnish_name] [-N filename] [-V]
varnishstat [-1] [-x] [-j] [-f field] [-l] [-n varnish_name] [-N filename] [-t seconds|<off>] [-V]
.. TODO: autogenerate this synopsis like the others.
......
......@@ -9,7 +9,7 @@ AM_CPPFLAGS = \
lib_LTLIBRARIES = libvarnishapi.la
libvarnishapi_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:0:0
libvarnishapi_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:4:0
libvarnishapi_la_SOURCES = \
vsm_api.h \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment