Esempio n. 1
0
static int
vfp_esi_bytes_gu(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
{
	struct vgz *vg;
	ssize_t wl;
	uint8_t	ibuf[cache_param->gzip_stack_buffer];
	int i;
	size_t dl;
	const void *dp;

	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
	vg = wrk->busyobj->vgz_rx;

	while (bytes > 0) {
		if (VGZ_IbufEmpty(vg) && bytes > 0) {
			wl = vef_read(wrk, htc, ibuf, sizeof ibuf, bytes);
			if (wl <= 0)
				return (wl);
			VGZ_Ibuf(vg, ibuf, wl);
			bytes -= wl;
		}
		if (VGZ_ObufStorage(wrk, vg))
			return(-1);
		i = VGZ_Gunzip(vg, &dp, &dl);
		xxxassert(i == VGZ_OK || i == VGZ_END);
		VEP_Parse(wrk, dp, dl);
		wrk->busyobj->fetch_obj->len += dl;
	}
	return (1);
}
Esempio n. 2
0
static int
vfp_esi_bytes_gg(const struct busyobj *bo, struct vef_priv *vef,
    struct http_conn *htc, size_t bytes)
{
	ssize_t wl;
	size_t dl;
	const void *dp;
	enum vgzret_e vr;

	CHECK_OBJ_NOTNULL(vef, VEF_MAGIC);
	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);

	while (bytes > 0) {
		wl = vef_read(htc, vef->ibuf2, vef->ibuf2_sz, bytes);
		if (wl <= 0)
			return (wl);
		bytes -= wl;

		VGZ_Ibuf(bo->vgz_rx, vef->ibuf2, wl);
		do {
			wl = vef->ibuf_sz - (vef->ibuf_i - vef->ibuf);
			VGZ_Obuf(bo->vgz_rx, vef->ibuf_i, wl);
			vr = VGZ_Gunzip(bo->vgz_rx, &dp, &dl);
			if (vr < VGZ_OK)
				return (-1);
			if (dl > 0 && vfp_vep_inject(bo, vef, dl))
				return (-1);
		} while (!VGZ_IbufEmpty(bo->vgz_rx));
	}
	return (1);
}
Esempio n. 3
0
static int
vfp_esi_bytes_gu(struct busyobj *bo, const struct vef_priv *vef,
    struct http_conn *htc, ssize_t bytes)
{
	struct vgz *vg;
	ssize_t wl;
	enum vgzret_e vr;
	size_t dl;
	const void *dp;

	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
	CHECK_OBJ_NOTNULL(vef, VEF_MAGIC);
	vg = bo->vgz_rx;

	while (bytes > 0) {
		if (VGZ_IbufEmpty(vg) && bytes > 0) {
			wl = vef_read(htc, vef->ibuf, vef->ibuf_sz, bytes);
			if (wl <= 0)
				return (wl);
			VGZ_Ibuf(vg, vef->ibuf, wl);
			bytes -= wl;
		}
		if (VGZ_ObufStorage(bo, vg))
			return(-1);
		vr = VGZ_Gunzip(vg, &dp, &dl);
		if (vr < VGZ_OK)
			return (-1);
		if (dl > 0) {
			VEP_Parse(bo, dp, dl);
			VBO_extend(bo, dl);
		}
	}
	return (1);
}
Esempio n. 4
0
static int
vfp_esi_bytes_ug(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
{
	ssize_t wl;
	char ibuf[cache_param->gzip_stack_buffer];
	struct vef_priv *vef;

	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
	CHECK_OBJ_NOTNULL(wrk->busyobj, BUSYOBJ_MAGIC);
	vef = wrk->busyobj->vef_priv;
	CHECK_OBJ_NOTNULL(vef, VEF_MAGIC);

	while (bytes > 0) {
		wl = vef_read(wrk, htc, ibuf, sizeof ibuf, bytes);
		if (wl <= 0)
			return (wl);
		bytes -= wl;
		vef->bufp = ibuf;
		VEP_Parse(wrk, ibuf, wl);
		assert(vef->bufp >= ibuf && vef->bufp <= ibuf + wl);
		if (vef->error) {
			errno = vef->error;
			return (-1);
		}
		if (vef->bufp < ibuf + wl) {
			wl = (ibuf + wl) - vef->bufp;
			assert(wl + vef->npend < sizeof vef->pending);
			memmove(vef->pending + vef->npend, vef->bufp, wl);
			vef->npend += wl;
		}
	}
	return (1);
}
vfp_esi_bytes_gu(struct sess *sp, struct http_conn *htc, ssize_t bytes)
{
	struct vgz *vg;
	ssize_t w;
	uint8_t	ibuf[params->gzip_stack_buffer];
	int i;
	size_t dl;
	const void *dp;

	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
	vg = sp->wrk->vgz_rx;

	while (bytes > 0) {
		if (VGZ_IbufEmpty(vg) && bytes > 0) {
			w = vef_read(htc, ibuf, sizeof ibuf, bytes);
			if (w <= 0)
				return (w);
			VGZ_Ibuf(vg, ibuf, w);
			bytes -= w;
		}
		if (VGZ_ObufStorage(sp, vg))
			return (-1);
		i = VGZ_Gunzip(vg, &dp, &dl);
		xxxassert(i == VGZ_OK || i == VGZ_END);
		VEP_parse(sp, dp, dl);
		sp->obj->len += dl;
	}
	return (1);
}
vfp_esi_bytes_ug(struct sess *sp, struct http_conn *htc, ssize_t bytes)
{
	ssize_t w;
	char ibuf[params->gzip_stack_buffer];
	struct vef_priv *vef;

	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
	vef = sp->wrk->vef_priv;
	CHECK_OBJ_NOTNULL(vef, VEF_MAGIC);

	while (bytes > 0) {
		w = vef_read(htc, ibuf, sizeof ibuf, bytes);
		if (w <= 0)
			return (w);
		bytes -= w;
		vef->bufp = ibuf;
		VEP_parse(sp, ibuf, w);
		assert(vef->bufp >= ibuf && vef->bufp <= ibuf + w);
		if (vef->error) {
			errno = vef->error;
			return (-1);
		}
		if (vef->bufp < ibuf + w) {
			w = (ibuf + w) - vef->bufp;
			assert(w + vef->npend < sizeof vef->pending);
			memmove(vef->pending + vef->npend, vef->bufp, w);
			vef->npend += w;
		}
	}
	return (1);
}
Esempio n. 7
0
static int
vfp_esi_bytes_gg(struct worker *wrk, struct http_conn *htc, size_t bytes)
{
	ssize_t wl;
	char ibuf[cache_param->gzip_stack_buffer];
	char ibuf2[cache_param->gzip_stack_buffer];
	struct vef_priv *vef;
	size_t dl;
	const void *dp;
	int i;

	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
	CHECK_OBJ_NOTNULL(wrk->busyobj, BUSYOBJ_MAGIC);
	vef = wrk->busyobj->vef_priv;
	CHECK_OBJ_NOTNULL(vef, VEF_MAGIC);
	assert(sizeof ibuf >= 1024);
	ibuf2[0] = 0; /* For Flexelint */

	while (bytes > 0) {
		wl = vef_read(wrk, htc, ibuf, sizeof ibuf, bytes);
		if (wl <= 0)
			return (wl);
		bytes -= wl;

		vef->bufp = ibuf;
		VGZ_Ibuf(wrk->busyobj->vgz_rx, ibuf, wl);
		do {
			VGZ_Obuf(wrk->busyobj->vgz_rx, ibuf2, sizeof ibuf2);
			i = VGZ_Gunzip(wrk->busyobj->vgz_rx, &dp, &dl);
			/* XXX: check i */
			assert(i >= VGZ_OK);
			vef->bufp = ibuf2;
			if (dl > 0)
				VEP_Parse(wrk, ibuf2, dl);
			if (vef->error) {
				errno = vef->error;
				return (-1);
			}
			if (vef->bufp < ibuf2 + dl) {
				dl = (ibuf2 + dl) - vef->bufp;
				assert(dl + vef->npend < sizeof vef->pending);
				memmove(vef->pending + vef->npend,
				    vef->bufp, dl);
				vef->npend += dl;
			}
		} while (!VGZ_IbufEmpty(wrk->busyobj->vgz_rx));
	}
	return (1);
}
vfp_esi_bytes_gg(struct sess *sp, struct http_conn *htc, size_t bytes)
{
	ssize_t w;
	char ibuf[params->gzip_stack_buffer];
	char ibuf2[params->gzip_stack_buffer];
	struct vef_priv *vef;
	size_t dl;
	const void *dp;
	int i;

	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
	vef = sp->wrk->vef_priv;
	CHECK_OBJ_NOTNULL(vef, VEF_MAGIC);
	assert(sizeof ibuf >= 1024);
	ibuf2[0] = 0; /* For Flexelint */

	while (bytes > 0) {
		w = vef_read(htc, ibuf, sizeof ibuf, bytes);
		if (w <= 0)
			return (w);
		bytes -= w;

		vef->bufp = ibuf;
		VGZ_Ibuf(sp->wrk->vgz_rx, ibuf, w);
		do {
			VGZ_Obuf(sp->wrk->vgz_rx, ibuf2, sizeof ibuf2);
			i = VGZ_Gunzip(sp->wrk->vgz_rx, &dp, &dl);
			/* XXX: check i */
			assert(i >= VGZ_OK);
			vef->bufp = ibuf2;
			if (dl > 0)
				VEP_parse(sp, ibuf2, dl);
			if (vef->error) {
				errno = vef->error;
				return (-1);
			}
			if (vef->bufp < ibuf2 + dl) {
				dl = (ibuf2 + dl) - vef->bufp;
				assert(dl + vef->npend < sizeof vef->pending);
				memmove(vef->pending + vef->npend,
				    vef->bufp, dl);
				vef->npend += dl;
			}
		} while (!VGZ_IbufEmpty(sp->wrk->vgz_rx));
	}
	return (1);
}
Esempio n. 9
0
static int
vfp_esi_bytes_ug(const struct busyobj *bo, struct vef_priv *vef,
    struct http_conn *htc, ssize_t bytes)
{
	ssize_t wl;

	CHECK_OBJ_NOTNULL(vef, VEF_MAGIC);
	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);

	while (bytes > 0) {
		wl = vef->ibuf_sz - (vef->ibuf_i - vef->ibuf);
		wl = vef_read(htc, vef->ibuf_i, wl, bytes);
		if (wl <= 0)
			return (wl);
		bytes -= wl;
		if (vfp_vep_inject(bo, vef, wl))
			return (-1);
	}
	return (1);
}
vfp_esi_bytes_uu(struct sess *sp, struct http_conn *htc, ssize_t bytes)
{
	ssize_t w;
	struct storage *st;

	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);

	while (bytes > 0) {
		st = FetchStorage(sp, 0);
		if (st == NULL)
			return (-1);
		w = vef_read(htc,
		    st->ptr + st->len, st->space - st->len, bytes);
		if (w <= 0)
			return (w);
		VEP_parse(sp, (const char *)st->ptr + st->len, w);
		st->len += w;
		sp->obj->len += w;
		bytes -= w;
	}
	return (1);
}
Esempio n. 11
0
static int
vfp_esi_bytes_uu(struct worker *wrk, struct http_conn *htc, ssize_t bytes)
{
	ssize_t wl;
	struct storage *st;

	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);

	while (bytes > 0) {
		st = FetchStorage(wrk, 0);
		if (st == NULL)
			return (-1);
		wl = vef_read(wrk, htc,
		    st->ptr + st->len, st->space - st->len, bytes);
		if (wl <= 0)
			return (wl);
		VEP_Parse(wrk, (const char *)st->ptr + st->len, wl);
		st->len += wl;
		wrk->busyobj->fetch_obj->len += wl;
		bytes -= wl;
	}
	return (1);
}
Esempio n. 12
0
static int
vfp_esi_bytes_uu(struct busyobj *bo, const struct vef_priv *vef,
    struct http_conn *htc, ssize_t bytes)
{
	ssize_t wl;
	struct storage *st;

	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
	CHECK_OBJ_NOTNULL(vef, VEF_MAGIC);

	while (bytes > 0) {
		st = VFP_GetStorage(bo, 0);
		if (st == NULL)
			return (-1);
		wl = vef_read(htc,
		    st->ptr + st->len, st->space - st->len, bytes);
		if (wl <= 0)
			return (wl);
		VEP_Parse(bo, (const char *)st->ptr + st->len, wl);
		VBO_extend(bo, wl);
		bytes -= wl;
	}
	return (1);
}