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
27422d81
Commit
27422d81
authored
Mar 25, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unify code path for abandoning a fetch.
parent
285deaaf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
60 deletions
+45
-60
cache_center.c
bin/varnishd/cache_center.c
+45
-60
No files found.
bin/varnishd/cache_center.c
View file @
27422d81
...
...
@@ -470,6 +470,7 @@ cnt_fetch(struct sess *sp)
AZ
(
sp
->
vbc
);
AZ
(
sp
->
wrk
->
h_content_length
);
AZ
(
sp
->
wrk
->
do_close
);
AZ
(
sp
->
wrk
->
storage_hint
);
http_Setup
(
sp
->
wrk
->
beresp
,
sp
->
wrk
->
ws
);
...
...
@@ -485,77 +486,62 @@ cnt_fetch(struct sess *sp)
}
if
(
i
)
{
if
(
sp
->
objcore
!=
NULL
)
{
CHECK_OBJ_NOTNULL
(
sp
->
objcore
,
OBJCORE_MAGIC
);
AZ
(
HSH_Deref
(
sp
->
wrk
,
sp
->
objcore
,
NULL
));
sp
->
objcore
=
NULL
;
}
AZ
(
sp
->
obj
);
sp
->
wrk
->
do_close
=
0
;
sp
->
wrk
->
h_content_length
=
NULL
;
http_Setup
(
sp
->
wrk
->
bereq
,
NULL
);
http_Setup
(
sp
->
wrk
->
beresp
,
NULL
);
sp
->
handling
=
VCL_RET_ERROR
;
sp
->
err_code
=
503
;
sp
->
step
=
STP_ERROR
;
return
(
0
);
}
/*
* These two headers can be spread over multiple actual headers
* and we rely on their content outside of VCL, so collect them
* into one line here.
*/
http_CollectHdr
(
sp
->
wrk
->
beresp
,
H_Cache_Control
);
http_CollectHdr
(
sp
->
wrk
->
beresp
,
H_Vary
);
/*
* Figure out how the fetch is supposed to happen, before the
* headers are adultered by VCL
* Also sets other sp->wrk variables
*/
sp
->
wrk
->
body_status
=
RFC2616_Body
(
sp
);
sp
->
wrk
->
do_close
=
0
;
}
else
{
/*
* These two headers can be spread over multiple actual headers
* and we rely on their content outside of VCL, so collect them
* into one line here.
*/
http_CollectHdr
(
sp
->
wrk
->
beresp
,
H_Cache_Control
);
http_CollectHdr
(
sp
->
wrk
->
beresp
,
H_Vary
);
/*
* Figure out how the fetch is supposed to happen, before the
* headers are adultered by VCL
* NB: Also sets other sp->wrk variables
*/
sp
->
wrk
->
body_status
=
RFC2616_Body
(
sp
);
sp
->
err_code
=
http_GetStatus
(
sp
->
wrk
->
beresp
);
sp
->
err_code
=
http_GetStatus
(
sp
->
wrk
->
beresp
);
/*
* What does RFC2616 think about TTL ?
*/
sp
->
wrk
->
entered
=
TIM_real
();
sp
->
wrk
->
age
=
0
;
EXP_Clr
(
&
sp
->
wrk
->
exp
);
sp
->
wrk
->
exp
.
ttl
=
RFC2616_Ttl
(
sp
);
/* pass from vclrecv{} has negative TTL */
if
(
sp
->
objcore
==
NULL
)
sp
->
wrk
->
exp
.
ttl
=
-
1
.;
/*
* What does RFC2616 think about TTL ?
*/
sp
->
wrk
->
entered
=
TIM_real
();
sp
->
wrk
->
age
=
0
;
EXP_Clr
(
&
sp
->
wrk
->
exp
);
sp
->
wrk
->
exp
.
ttl
=
RFC2616_Ttl
(
sp
);
sp
->
wrk
->
do_esi
=
0
;
/* pass from vclrecv{} has negative TTL */
if
(
sp
->
objcore
==
NULL
)
sp
->
wrk
->
exp
.
ttl
=
-
1
.;
sp
->
wrk
->
do_esi
=
0
;
AZ
(
sp
->
wrk
->
storage_hint
);
VCL_fetch_method
(
sp
);
VCL_fetch_method
(
sp
);
switch
(
sp
->
handling
)
{
case
VCL_RET_HIT_FOR_PASS
:
if
(
sp
->
objcore
!=
NULL
)
sp
->
objcore
->
flags
|=
OC_F_PASS
;
sp
->
step
=
STP_FETCHBODY
;
return
(
0
);
case
VCL_RET_DELIVER
:
sp
->
step
=
STP_FETCHBODY
;
return
(
0
);
default:
break
;
}
switch
(
sp
->
handling
)
{
case
VCL_RET_HIT_FOR_PASS
:
if
(
sp
->
objcore
!=
NULL
)
sp
->
objcore
->
flags
|=
OC_F_PASS
;
sp
->
step
=
STP_FETCHBODY
;
return
(
0
);
case
VCL_RET_DELIVER
:
sp
->
step
=
STP_FETCHBODY
;
return
(
0
);
default:
break
;
/* We are not going to fetch the body, Close the connection */
VDI_CloseFd
(
sp
);
}
/*
* We are not going to fetch the body
* Close the connection and clean up...
*/
/* Clean up partial fetch */
VDI_CloseFd
(
sp
);
if
(
sp
->
objcore
!=
NULL
)
{
CHECK_OBJ_NOTNULL
(
sp
->
objcore
,
OBJCORE_MAGIC
);
AZ
(
HSH_Deref
(
sp
->
wrk
,
sp
->
objcore
,
NULL
));
...
...
@@ -717,7 +703,6 @@ cnt_fetchbody(struct sess *sp)
AN
(
sp
->
obj
->
vary
);
memcpy
(
sp
->
obj
->
vary
,
vsb_data
(
vary
),
varyl
);
vsb_delete
(
vary
);
vary
=
NULL
;
}
sp
->
obj
->
xid
=
sp
->
xid
;
...
...
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