void VRT_SetHdr(VRT_CTX , const struct gethdr_s *hs, const char *p, ...) { struct http *hp; va_list ap; const char *b; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); AN(hs); AN(hs->what); hp = vrt_selecthttp(ctx, hs->where); CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); va_start(ap, p); if (p == vrt_magic_string_unset) { http_Unset(hp, hs->what); } else { b = VRT_String(hp->ws, hs->what + 1, p, ap); if (b == NULL) { VSLb(ctx->vsl, SLT_LostHeader, "%s", hs->what + 1); } else { http_Unset(hp, hs->what); http_SetHeader(hp, b); } } va_end(ap); }
char * VRT_GetHdr(const struct sess *sp, enum gethdr_e where, const char *n) { char *p; struct http *hp; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); hp = vrt_selecthttp(sp, where); if (!http_GetHdr(hp, n, &p)) return (NULL); return (p); }
char * VRT_GetHdr(const struct vrt_ctx *ctx, const struct gethdr_s *hs) { char *p; struct http *hp; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); hp = vrt_selecthttp(ctx, hs->where); CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); if (!http_GetHdr(hp, hs->what, &p)) return (NULL); return (p); }
const char * VRT_GetHdr(VRT_CTX, const struct gethdr_s *hs) { const char *p; struct http *hp; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); if (hs->where == HDR_OBJ) { CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); CHECK_OBJ_NOTNULL(ctx->req->objcore, OBJCORE_MAGIC); return(HTTP_GetHdrPack(ctx->req->wrk, ctx->req->objcore, hs->what)); } hp = vrt_selecthttp(ctx, hs->where); CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); if (!http_GetHdr(hp, hs->what, &p)) return (NULL); return (p); }
void VRT_SetHdr(const struct sess *sp , enum gethdr_e where, const char *hdr, const char *p, ...) { struct http *hp; va_list ap; char *b; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); hp = vrt_selecthttp(sp, where); va_start(ap, p); if (p == NULL) { http_Unset(hp, hdr); } else { b = VRT_String(hp->ws, hdr + 1, p, ap); if (b == NULL) { WSP(sp, SLT_LostHeader, "%s", hdr + 1); } else { http_Unset(hp, hdr); http_SetHeader(sp->wrk, sp->vsl_id, hp, b); } } va_end(ap); }