Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
2d494dc7
Unverified
Commit
2d494dc7
authored
Feb 28, 2024
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
In transport delivery functions, close VDPs always
Part 1 of the fix for #4067
parent
a73e6a5b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
16 deletions
+30
-16
cache_esi_deliver.c
bin/varnishd/cache/cache_esi_deliver.c
+23
-11
cache_http1_deliver.c
bin/varnishd/http1/cache_http1_deliver.c
+7
-5
No files found.
bin/varnishd/cache/cache_esi_deliver.c
View file @
2d494dc7
...
...
@@ -850,6 +850,17 @@ static const struct vdp ved_ved = {
.
fini
=
ved_vdp_fini
,
};
static
void
ved_close
(
struct
req
*
req
,
struct
boc
*
boc
,
int
error
)
{
req
->
acct
.
resp_bodybytes
+=
VDP_Close
(
req
->
vdc
,
req
->
objcore
,
boc
);
if
(
!
error
)
return
;
req
->
top
->
topreq
->
vdc
->
retval
=
-
1
;
req
->
top
->
topreq
->
doclose
=
req
->
doclose
;
}
/*--------------------------------------------------------------------*/
static
void
v_matchproto_
(
vtr_deliver_f
)
...
...
@@ -868,19 +879,22 @@ ved_deliver(struct req *req, struct boc *boc, int wantbody)
CAST_OBJ_NOTNULL
(
ecx
,
req
->
transport_priv
,
ECX_MAGIC
);
if
(
wantbody
==
0
)
if
(
wantbody
==
0
)
{
ved_close
(
req
,
boc
,
0
);
return
;
}
status
=
req
->
resp
->
status
%
1000
;
if
(
!
ecx
->
incl_cont
&&
status
!=
200
&&
status
!=
204
)
{
req
->
top
->
topreq
->
vdc
->
retval
=
-
1
;
req
->
top
->
topreq
->
doclose
=
req
->
doclose
;
ved_close
(
req
,
boc
,
1
);
return
;
}
if
(
boc
==
NULL
&&
ObjGetLen
(
req
->
wrk
,
req
->
objcore
)
==
0
)
if
(
boc
==
NULL
&&
ObjGetLen
(
req
->
wrk
,
req
->
objcore
)
==
0
)
{
ved_close
(
req
,
boc
,
0
);
return
;
}
if
(
http_GetHdr
(
req
->
resp
,
H_Content_Encoding
,
&
p
))
i
=
http_coding_eq
(
p
,
gzip
);
...
...
@@ -899,7 +913,10 @@ ved_deliver(struct req *req, struct boc *boc, int wantbody)
if
(
req
->
objcore
->
flags
&
OC_F_FAILED
)
{
/* No way of signalling errors in the middle of
the ESI body. Omit this ESI fragment. */
* the ESI body. Omit this ESI fragment.
* XXX change error argument to 1
*/
ved_close
(
req
,
boc
,
0
);
return
;
}
...
...
@@ -926,10 +943,5 @@ ved_deliver(struct req *req, struct boc *boc, int wantbody)
if
(
i
&&
req
->
doclose
==
SC_NULL
)
req
->
doclose
=
SC_REM_CLOSE
;
req
->
acct
.
resp_bodybytes
+=
VDP_Close
(
req
->
vdc
,
req
->
objcore
,
boc
);
if
(
i
&&
!
ecx
->
incl_cont
)
{
req
->
top
->
topreq
->
vdc
->
retval
=
-
1
;
req
->
top
->
topreq
->
doclose
=
req
->
doclose
;
}
ved_close
(
req
,
boc
,
i
&&
!
ecx
->
incl_cont
);
}
bin/varnishd/http1/cache_http1_deliver.c
View file @
2d494dc7
...
...
@@ -40,7 +40,7 @@
/*--------------------------------------------------------------------*/
static
void
v1d_error
(
struct
req
*
req
,
const
char
*
msg
)
v1d_error
(
struct
req
*
req
,
struct
boc
*
boc
,
const
char
*
msg
)
{
static
const
char
r_500
[]
=
"HTTP/1.1 500 Internal Server Error
\r\n
"
...
...
@@ -57,6 +57,8 @@ v1d_error(struct req *req, const char *msg)
req
->
wrk
->
stats
->
client_resp_500
++
;
VTCP_Assert
(
write
(
req
->
sp
->
fd
,
r_500
,
sizeof
r_500
-
1
));
req
->
doclose
=
SC_TX_EOF
;
req
->
acct
.
resp_bodybytes
+=
VDP_Close
(
req
->
vdc
,
req
->
objcore
,
boc
);
}
/*--------------------------------------------------------------------
...
...
@@ -98,18 +100,18 @@ V1D_Deliver(struct req *req, struct boc *boc, int sendbody)
INIT_OBJ
(
ctx
,
VRT_CTX_MAGIC
);
VCL_Req2Ctx
(
ctx
,
req
);
if
(
VDP_Push
(
ctx
,
req
->
vdc
,
req
->
ws
,
VDP_v1l
,
NULL
))
{
v1d_error
(
req
,
"Failure to push v1d processor"
);
v1d_error
(
req
,
boc
,
"Failure to push v1d processor"
);
return
;
}
}
if
(
WS_Overflowed
(
req
->
ws
))
{
v1d_error
(
req
,
"workspace_client overflow"
);
v1d_error
(
req
,
boc
,
"workspace_client overflow"
);
return
;
}
if
(
WS_Overflowed
(
req
->
sp
->
ws
))
{
v1d_error
(
req
,
"workspace_session overflow"
);
v1d_error
(
req
,
boc
,
"workspace_session overflow"
);
return
;
}
...
...
@@ -118,7 +120,7 @@ V1D_Deliver(struct req *req, struct boc *boc, int sendbody)
cache_param
->
http1_iovs
);
if
(
WS_Overflowed
(
req
->
wrk
->
aws
))
{
v1d_error
(
req
,
"workspace_thread overflow"
);
v1d_error
(
req
,
boc
,
"workspace_thread overflow"
);
return
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment