示例#1
0
void
VRT_synth_page(const struct sess *sp, unsigned flags, const char *str, ...)
{
	va_list ap;
	const char *p;
	struct vsb *vsb;

	(void)flags;
	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
	CHECK_OBJ_NOTNULL(sp->wrk->obj, OBJECT_MAGIC);
	vsb = SMS_Makesynth(sp->wrk->obj);
	AN(vsb);

	VSB_cat(vsb, str);
	va_start(ap, str);
	p = va_arg(ap, const char *);
	while (p != vrt_magic_string_end) {
		if (p == NULL)
			p = "(null)";
		VSB_cat(vsb, p);
		p = va_arg(ap, const char *);
	}
	va_end(ap);
	SMS_Finish(sp->wrk->obj);
	http_Unset(sp->wrk->obj->http, H_Content_Length);
	http_PrintfHeader(sp->wrk, sp->vsl_id, sp->wrk->obj->http,
	    "Content-Length: %zd", sp->wrk->obj->len);
}
示例#2
0
void
VRT_synth_page(const struct vrt_ctx *ctx, unsigned flags, const char *str, ...)
{
	va_list ap;
	const char *p;
	struct vsb *vsb;

	(void)flags;
	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
	CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC);
	CHECK_OBJ_NOTNULL(ctx->req->obj, OBJECT_MAGIC);
	vsb = SMS_Makesynth(ctx->req->obj);
	AN(vsb);

	va_start(ap, str);
	p = str;
	while (p != vrt_magic_string_end) {
		if (p == NULL)
			p = "(null)";
		VSB_cat(vsb, p);
		p = va_arg(ap, const char *);
	}
	va_end(ap);
	SMS_Finish(ctx->req->obj);
	http_Unset(ctx->req->obj->http, H_Content_Length);
}