Commit 9f742a0a authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Let VPF's handle their own 206 policy.

parent 44ed24b6
......@@ -153,6 +153,11 @@ vfp_esi_gzip_init(struct vfp_ctx *vc, struct vfp_entry *vfe)
CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC);
CHECK_OBJ_NOTNULL(vc->req, HTTP_MAGIC);
CHECK_OBJ_NOTNULL(vfe, VFP_ENTRY_MAGIC);
if (http_GetStatus(vc->resp) == 206) {
VSLb(vc->wrk->vsl, SLT_VCL_Error,
"Attempted ESI on partial (206) response");
return (VFP_ERROR);
}
ALLOC_OBJ(vef, VEF_MAGIC);
if (vef == NULL)
return (VFP_ERROR);
......@@ -227,6 +232,11 @@ vfp_esi_init(struct vfp_ctx *vc, struct vfp_entry *vfe)
CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC);
CHECK_OBJ_NOTNULL(vc->req, HTTP_MAGIC);
if (http_GetStatus(vc->resp) == 206) {
VSLb(vc->wrk->vsl, SLT_VCL_Error,
"Attempted ESI on partial (206) response");
return (VFP_ERROR);
}
ALLOC_OBJ(vef, VEF_MAGIC);
if (vef == NULL)
return (VFP_ERROR);
......
......@@ -516,22 +516,8 @@ vbf_figure_out_vfp(struct busyobj *bo)
* no Content-Encoding --> object is not gzip'ed.
* anything else --> do nothing wrt gzip
*
* On partial responses (206 on pass), we fail if do_esi is
* requested because it could leak partial esi-directives, and
* ignore gzipery, because it makes no sense.
*
*/
if (http_GetStatus(bo->beresp) == 206) {
if (bo->do_esi) {
VSLb(bo->vsl, SLT_VCL_Error,
"beresp.do_esi on partial response");
return (-1);
}
bo->do_gzip = bo->do_gunzip = 0;
return (0);
}
/* No body -> done */
if (bo->htc->body_status == BS_NONE ||
bo->htc->content_length == 0) {
......
......@@ -442,6 +442,13 @@ vfp_gzip_init(struct vfp_ctx *vc, struct vfp_entry *vfe)
CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC);
CHECK_OBJ_NOTNULL(vfe, VFP_ENTRY_MAGIC);
/*
* G(un)zip makes no sence on partial responses, but since
* it is an pure 1:1 transform, we can just ignore it.
*/
if (http_GetStatus(vc->resp) == 206)
return (VFP_NULL);
if (vfe->vfp == &VFP_gzip) {
if (http_GetHdr(vc->resp, H_Content_Encoding, NULL))
return (VFP_NULL);
......
......@@ -102,7 +102,7 @@ THR_SetName(const char *name)
AZ(pthread_setspecific(name_key, name));
#if defined(HAVE_PTHREAD_SET_NAME_NP)
(void)pthread_set_name_np(pthread_self(), name);
pthread_set_name_np(pthread_self(), name);
#elif defined(HAVE_PTHREAD_SETNAME_NP)
#if defined(__APPLE__)
(void)pthread_setname_np(name);
......
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