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
4763c778
Commit
4763c778
authored
Jan 13, 2020
by
Poul-Henning Kamp
Committed by
Reza Naghibi
May 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move the 304 logic into a separate function for clarity.
conflicts: bin/varnishd/cache/cache_fetch.c
parent
b9050923
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
29 deletions
+39
-29
cache_fetch.c
bin/varnishd/cache/cache_fetch.c
+39
-29
No files found.
bin/varnishd/cache/cache_fetch.c
View file @
4763c778
...
...
@@ -250,6 +250,43 @@ vbf_stp_retry(struct worker *wrk, struct busyobj *bo)
return
(
F_STP_STARTFETCH
);
}
/*--------------------------------------------------------------------
* 304 setup logic
*/
static
int
vbf_304_logic
(
struct
busyobj
*
bo
)
{
if
(
bo
->
stale_oc
!=
NULL
&&
ObjCheckFlag
(
bo
->
wrk
,
bo
->
stale_oc
,
OF_IMSCAND
))
{
AZ
(
bo
->
stale_oc
->
flags
&
(
OC_F_HFM
|
OC_F_PRIVATE
));
if
(
ObjCheckFlag
(
bo
->
wrk
,
bo
->
stale_oc
,
OF_CHGCE
))
{
/*
* If a VFP changed C-E in the stored
* object, then don't overwrite C-E from
* the IMS fetch, and we must weaken any
* new ETag we get.
*/
http_Unset
(
bo
->
beresp
,
H_Content_Encoding
);
RFC2616_Weaken_Etag
(
bo
->
beresp
);
}
http_Unset
(
bo
->
beresp
,
H_Content_Length
);
HTTP_Merge
(
bo
->
wrk
,
bo
->
stale_oc
,
bo
->
beresp
);
assert
(
http_IsStatus
(
bo
->
beresp
,
200
));
bo
->
was_304
=
1
;
}
else
if
(
!
bo
->
do_pass
)
{
/*
* Backend sent unallowed 304
*/
VSLb
(
bo
->
vsl
,
SLT_Error
,
"304 response but not conditional fetch"
);
bo
->
htc
->
doclose
=
SC_RX_BAD
;
VDI_Finish
(
bo
->
wrk
,
bo
);
return
(
-
1
);
}
return
(
1
);
}
/*--------------------------------------------------------------------
* Setup bereq from bereq0, run vcl_backend_fetch
*/
...
...
@@ -346,35 +383,8 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
AZ
(
bo
->
do_esi
);
AZ
(
bo
->
was_304
);
if
(
http_IsStatus
(
bo
->
beresp
,
304
))
{
if
(
bo
->
stale_oc
!=
NULL
&&
ObjCheckFlag
(
bo
->
wrk
,
bo
->
stale_oc
,
OF_IMSCAND
))
{
AZ
(
bo
->
stale_oc
->
flags
&
(
OC_F_HFM
|
OC_F_PRIVATE
));
if
(
ObjCheckFlag
(
bo
->
wrk
,
bo
->
stale_oc
,
OF_CHGCE
))
{
/*
* If a VFP changed C-E in the stored
* object, then don't overwrite C-E from
* the IMS fetch, and we must weaken any
* new ETag we get.
*/
http_Unset
(
bo
->
beresp
,
H_Content_Encoding
);
RFC2616_Weaken_Etag
(
bo
->
beresp
);
}
http_Unset
(
bo
->
beresp
,
H_Content_Length
);
HTTP_Merge
(
bo
->
wrk
,
bo
->
stale_oc
,
bo
->
beresp
);
assert
(
http_IsStatus
(
bo
->
beresp
,
200
));
bo
->
was_304
=
1
;
}
else
if
(
!
bo
->
do_pass
)
{
/*
* Backend sent unallowed 304
*/
VSLb
(
bo
->
vsl
,
SLT_Error
,
"304 response but not conditional fetch"
);
bo
->
htc
->
doclose
=
SC_RX_BAD
;
VDI_Finish
(
bo
->
wrk
,
bo
);
return
(
F_STP_ERROR
);
}
}
if
(
http_IsStatus
(
bo
->
beresp
,
304
)
&&
vbf_304_logic
(
bo
)
<
0
)
return
(
F_STP_ERROR
);
VCL_backend_response_method
(
bo
->
vcl
,
wrk
,
NULL
,
bo
,
NULL
);
...
...
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