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
62e111be
Commit
62e111be
authored
Jan 27, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tighten up the object fetch code a little bit.
parent
c5e69db8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
36 deletions
+20
-36
cache.h
bin/varnishd/cache.h
+1
-1
cache_center.c
bin/varnishd/cache_center.c
+18
-31
cache_fetch.c
bin/varnishd/cache_fetch.c
+1
-4
No files found.
bin/varnishd/cache.h
View file @
62e111be
...
@@ -631,7 +631,7 @@ int EXP_NukeOne(const struct sess *sp, const struct lru *lru);
...
@@ -631,7 +631,7 @@ int EXP_NukeOne(const struct sess *sp, const struct lru *lru);
/* cache_fetch.c */
/* cache_fetch.c */
struct
storage
*
FetchStorage
(
const
struct
sess
*
sp
,
ssize_t
sz
);
struct
storage
*
FetchStorage
(
const
struct
sess
*
sp
,
ssize_t
sz
);
int
FetchHdr
(
struct
sess
*
sp
);
int
FetchHdr
(
struct
sess
*
sp
);
int
FetchBody
(
struct
sess
*
sp
);
int
FetchBody
(
struct
sess
*
sp
,
struct
http
*
hp
);
int
FetchReqBody
(
struct
sess
*
sp
);
int
FetchReqBody
(
struct
sess
*
sp
);
void
Fetch_Init
(
void
);
void
Fetch_Init
(
void
);
...
...
bin/varnishd/cache_center.c
View file @
62e111be
...
@@ -573,22 +573,11 @@ cnt_fetch(struct sess *sp)
...
@@ -573,22 +573,11 @@ cnt_fetch(struct sess *sp)
* had one.
* had one.
*/
*/
if
(
sp
->
wrk
->
cacheable
)
{
CHECK_OBJ_NOTNULL
(
sp
->
objcore
,
OBJCORE_MAGIC
);
vary
=
VRY_Create
(
sp
,
sp
->
wrk
->
beresp
);
if
(
vary
!=
NULL
)
{
varyl
=
vsb_len
(
vary
);
assert
(
varyl
>
0
);
}
}
else
{
AZ
(
sp
->
objcore
);
}
AZ
(
sp
->
wrk
->
vfp
);
AZ
(
sp
->
wrk
->
vfp
);
/*
/*
* The VCL variables beresp.do_g[un]zip tells us how we want the
* The VCL variables beresp.do_g[un]zip tells us how we want the
* object stored.
* object
processed before it is
stored.
*
*
* The backend Content-Encoding header tells us what we are going
* The backend Content-Encoding header tells us what we are going
* to receive, which we classify in the following three classes:
* to receive, which we classify in the following three classes:
...
@@ -645,8 +634,16 @@ cnt_fetch(struct sess *sp)
...
@@ -645,8 +634,16 @@ cnt_fetch(struct sess *sp)
l
=
http_EstimateWS
(
sp
->
wrk
->
beresp
,
l
=
http_EstimateWS
(
sp
->
wrk
->
beresp
,
sp
->
pass
?
HTTPH_R_PASS
:
HTTPH_A_INS
,
&
nhttp
);
sp
->
pass
?
HTTPH_R_PASS
:
HTTPH_A_INS
,
&
nhttp
);
if
(
vary
!=
NULL
)
/* Create Vary instructions */
l
+=
varyl
;
if
(
sp
->
wrk
->
cacheable
)
{
CHECK_OBJ_NOTNULL
(
sp
->
objcore
,
OBJCORE_MAGIC
);
vary
=
VRY_Create
(
sp
,
sp
->
wrk
->
beresp
);
if
(
vary
!=
NULL
)
{
varyl
=
vsb_len
(
vary
);
assert
(
varyl
>
0
);
l
+=
varyl
;
}
}
/*
/*
* Space for producing a Content-Length: header including padding
* Space for producing a Content-Length: header including padding
...
@@ -654,10 +651,6 @@ cnt_fetch(struct sess *sp)
...
@@ -654,10 +651,6 @@ cnt_fetch(struct sess *sp)
*/
*/
l
+=
strlen
(
"Content-Encoding: XxxXxxXxxXxxXxxXxx"
+
sizeof
(
void
*
));
l
+=
strlen
(
"Content-Encoding: XxxXxxXxxXxxXxxXxx"
+
sizeof
(
void
*
));
/*
* XXX: VFP's may affect estimate
*/
sp
->
obj
=
STV_NewObject
(
sp
,
sp
->
wrk
->
storage_hint
,
l
,
sp
->
obj
=
STV_NewObject
(
sp
,
sp
->
wrk
->
storage_hint
,
l
,
sp
->
wrk
->
ttl
,
nhttp
);
sp
->
wrk
->
ttl
,
nhttp
);
CHECK_OBJ_NOTNULL
(
sp
->
obj
,
OBJECT_MAGIC
);
CHECK_OBJ_NOTNULL
(
sp
->
obj
,
OBJECT_MAGIC
);
...
@@ -700,7 +693,13 @@ cnt_fetch(struct sess *sp)
...
@@ -700,7 +693,13 @@ cnt_fetch(struct sess *sp)
else
else
sp
->
obj
->
last_modified
=
sp
->
wrk
->
entered
;
sp
->
obj
->
last_modified
=
sp
->
wrk
->
entered
;
i
=
FetchBody
(
sp
);
/* Use unmodified headers*/
i
=
FetchBody
(
sp
,
sp
->
wrk
->
beresp1
);
sp
->
wrk
->
bereq
=
NULL
;
sp
->
wrk
->
beresp
=
NULL
;
sp
->
wrk
->
beresp1
=
NULL
;
sp
->
wrk
->
vfp
=
NULL
;
sp
->
wrk
->
vfp
=
NULL
;
AZ
(
sp
->
wrk
->
wfd
);
AZ
(
sp
->
wrk
->
wfd
);
AZ
(
sp
->
vbc
);
AZ
(
sp
->
vbc
);
...
@@ -709,9 +708,6 @@ cnt_fetch(struct sess *sp)
...
@@ -709,9 +708,6 @@ cnt_fetch(struct sess *sp)
if
(
i
)
{
if
(
i
)
{
HSH_Drop
(
sp
);
HSH_Drop
(
sp
);
AZ
(
sp
->
obj
);
AZ
(
sp
->
obj
);
sp
->
wrk
->
bereq
=
NULL
;
sp
->
wrk
->
beresp
=
NULL
;
sp
->
wrk
->
beresp1
=
NULL
;
sp
->
err_code
=
503
;
sp
->
err_code
=
503
;
sp
->
step
=
STP_ERROR
;
sp
->
step
=
STP_ERROR
;
return
(
0
);
return
(
0
);
...
@@ -722,9 +718,6 @@ cnt_fetch(struct sess *sp)
...
@@ -722,9 +718,6 @@ cnt_fetch(struct sess *sp)
HSH_Drop
(
sp
);
HSH_Drop
(
sp
);
sp
->
director
=
NULL
;
sp
->
director
=
NULL
;
sp
->
restarts
++
;
sp
->
restarts
++
;
sp
->
wrk
->
bereq
=
NULL
;
sp
->
wrk
->
beresp
=
NULL
;
sp
->
wrk
->
beresp1
=
NULL
;
sp
->
step
=
STP_RECV
;
sp
->
step
=
STP_RECV
;
return
(
0
);
return
(
0
);
case
VCL_RET_PASS
:
case
VCL_RET_PASS
:
...
@@ -737,9 +730,6 @@ cnt_fetch(struct sess *sp)
...
@@ -737,9 +730,6 @@ cnt_fetch(struct sess *sp)
break
;
break
;
case
VCL_RET_ERROR
:
case
VCL_RET_ERROR
:
HSH_Drop
(
sp
);
HSH_Drop
(
sp
);
sp
->
wrk
->
bereq
=
NULL
;
sp
->
wrk
->
beresp
=
NULL
;
sp
->
wrk
->
beresp1
=
NULL
;
sp
->
step
=
STP_ERROR
;
sp
->
step
=
STP_ERROR
;
return
(
0
);
return
(
0
);
default:
default:
...
@@ -754,9 +744,6 @@ cnt_fetch(struct sess *sp)
...
@@ -754,9 +744,6 @@ cnt_fetch(struct sess *sp)
HSH_Unbusy
(
sp
);
HSH_Unbusy
(
sp
);
}
}
sp
->
acct_tmp
.
fetch
++
;
sp
->
acct_tmp
.
fetch
++
;
sp
->
wrk
->
bereq
=
NULL
;
sp
->
wrk
->
beresp
=
NULL
;
sp
->
wrk
->
beresp1
=
NULL
;
sp
->
step
=
STP_DELIVER
;
sp
->
step
=
STP_DELIVER
;
return
(
0
);
return
(
0
);
}
}
...
...
bin/varnishd/cache_fetch.c
View file @
62e111be
...
@@ -481,11 +481,10 @@ FetchHdr(struct sess *sp)
...
@@ -481,11 +481,10 @@ FetchHdr(struct sess *sp)
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
int
int
FetchBody
(
struct
sess
*
sp
)
FetchBody
(
struct
sess
*
sp
,
struct
http
*
hp
)
{
{
char
*
b
;
char
*
b
;
int
cls
;
int
cls
;
struct
http
*
hp
;
struct
storage
*
st
;
struct
storage
*
st
;
int
mklen
;
int
mklen
;
...
@@ -497,8 +496,6 @@ FetchBody(struct sess *sp)
...
@@ -497,8 +496,6 @@ FetchBody(struct sess *sp)
if
(
sp
->
wrk
->
vfp
==
NULL
)
if
(
sp
->
wrk
->
vfp
==
NULL
)
sp
->
wrk
->
vfp
=
&
vfp_nop
;
sp
->
wrk
->
vfp
=
&
vfp_nop
;
/* We use the unmodified headers */
hp
=
sp
->
wrk
->
beresp1
;
AN
(
sp
->
director
);
AN
(
sp
->
director
);
AssertObjPassOrBusy
(
sp
->
obj
);
AssertObjPassOrBusy
(
sp
->
obj
);
...
...
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