Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
unique-xids
Commits
35443881
Commit
35443881
authored
Feb 19, 2012
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More RFC2616 related argument cleanup
parent
66330133
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
44 deletions
+46
-44
cache.h
bin/varnishd/cache/cache.h
+2
-2
cache_center.c
bin/varnishd/cache/cache_center.c
+22
-20
cache_rfc2616.c
bin/varnishd/cache/cache_rfc2616.c
+21
-21
cache_vrt_var.c
bin/varnishd/cache/cache_vrt_var.c
+1
-1
No files found.
bin/varnishd/cache/cache.h
View file @
35443881
...
...
@@ -998,8 +998,8 @@ char *WS_Snapshot(struct ws *ws);
/* rfc2616.c */
void
RFC2616_Ttl
(
struct
busyobj
*
,
unsigned
xid
);
enum
body_status
RFC2616_Body
(
const
struct
sess
*
sp
);
unsigned
RFC2616_Req_Gzip
(
const
struct
sess
*
sp
);
enum
body_status
RFC2616_Body
(
struct
busyobj
*
,
struct
dstat
*
);
unsigned
RFC2616_Req_Gzip
(
const
struct
http
*
);
int
RFC2616_Do_Cond
(
const
struct
sess
*
sp
);
/* stevedore.c */
...
...
bin/varnishd/cache/cache_center.c
View file @
35443881
...
...
@@ -238,7 +238,7 @@ cnt_prepresp(struct sess *sp, struct worker *wrk, struct req *req)
}
if
(
cache_param
->
http_gzip_support
&&
req
->
obj
->
gziped
&&
!
RFC2616_Req_Gzip
(
s
p
))
{
!
RFC2616_Req_Gzip
(
req
->
htt
p
))
{
/*
* We don't know what it uncompresses to
* XXX: we could cache that
...
...
@@ -552,22 +552,24 @@ static int
cnt_fetch
(
struct
sess
*
sp
,
struct
worker
*
wrk
,
struct
req
*
req
)
{
int
i
,
need_host_hdr
;
struct
busyobj
*
bo
;
CHECK_OBJ_NOTNULL
(
sp
,
SESS_MAGIC
);
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
->
vcl
,
VCL_CONF_MAGIC
);
CHECK_OBJ_NOTNULL
(
wrk
->
busyobj
,
BUSYOBJ_MAGIC
);
bo
=
wrk
->
busyobj
;
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
AN
(
req
->
director
);
AZ
(
wrk
->
busyobj
->
vbc
);
AZ
(
wrk
->
busyobj
->
should_close
);
AZ
(
bo
->
vbc
);
AZ
(
bo
->
should_close
);
AZ
(
req
->
storage_hint
);
http_Setup
(
wrk
->
busyobj
->
beresp
,
wrk
->
busyobj
->
ws
,
wrk
->
busyobj
->
vsl
);
http_Setup
(
bo
->
beresp
,
bo
->
ws
,
bo
->
vsl
);
need_host_hdr
=
!
http_GetHdr
(
wrk
->
busyobj
->
bereq
,
H_Host
,
NULL
);
need_host_hdr
=
!
http_GetHdr
(
bo
->
bereq
,
H_Host
,
NULL
);
i
=
FetchHdr
(
sp
,
need_host_hdr
,
req
->
objcore
==
NULL
);
/*
...
...
@@ -589,35 +591,35 @@ cnt_fetch(struct sess *sp, struct worker *wrk, struct req *req)
* and we rely on their content outside of VCL, so collect them
* into one line here.
*/
http_CollectHdr
(
wrk
->
busyobj
->
beresp
,
H_Cache_Control
);
http_CollectHdr
(
wrk
->
busyobj
->
beresp
,
H_Vary
);
http_CollectHdr
(
bo
->
beresp
,
H_Cache_Control
);
http_CollectHdr
(
bo
->
beresp
,
H_Vary
);
/*
* Figure out how the fetch is supposed to happen, before the
* headers are adultered by VCL
* NB: Also sets other wrk variables
*/
wrk
->
busyobj
->
body_status
=
RFC2616_Body
(
sp
);
bo
->
body_status
=
RFC2616_Body
(
bo
,
&
wrk
->
stats
);
req
->
err_code
=
http_GetStatus
(
wrk
->
busyobj
->
beresp
);
req
->
err_code
=
http_GetStatus
(
bo
->
beresp
);
/*
* What does RFC2616 think about TTL ?
*/
EXP_Clr
(
&
wrk
->
busyobj
->
exp
);
wrk
->
busyobj
->
exp
.
entered
=
W_TIM_real
(
wrk
);
RFC2616_Ttl
(
wrk
->
busyobj
,
sp
->
req
->
xid
);
EXP_Clr
(
&
bo
->
exp
);
bo
->
exp
.
entered
=
W_TIM_real
(
wrk
);
RFC2616_Ttl
(
bo
,
sp
->
req
->
xid
);
/* pass from vclrecv{} has negative TTL */
if
(
req
->
objcore
==
NULL
)
wrk
->
busyobj
->
exp
.
ttl
=
-
1
.;
bo
->
exp
.
ttl
=
-
1
.;
AZ
(
wrk
->
busyobj
->
do_esi
);
AZ
(
wrk
->
busyobj
->
do_pass
);
AZ
(
bo
->
do_esi
);
AZ
(
bo
->
do_pass
);
VCL_fetch_method
(
sp
);
if
(
req
->
objcore
!=
NULL
&&
wrk
->
busyobj
->
do_pass
)
if
(
req
->
objcore
!=
NULL
&&
bo
->
do_pass
)
req
->
objcore
->
flags
|=
OC_F_PASS
;
switch
(
req
->
handling
)
{
...
...
@@ -630,11 +632,11 @@ cnt_fetch(struct sess *sp, struct worker *wrk, struct req *req)
}
/* We are not going to fetch the body, Close the connection */
VDI_CloseFd
(
wrk
,
&
wrk
->
busyobj
->
vbc
);
VDI_CloseFd
(
wrk
,
&
bo
->
vbc
);
}
/* Clean up partial fetch */
AZ
(
wrk
->
busyobj
->
vbc
);
AZ
(
bo
->
vbc
);
if
(
req
->
objcore
!=
NULL
)
{
CHECK_OBJ_NOTNULL
(
req
->
objcore
,
OBJCORE_MAGIC
);
...
...
@@ -1384,7 +1386,7 @@ cnt_recv(struct sess *sp, const struct worker *wrk, struct req *req)
if
(
cache_param
->
http_gzip_support
&&
(
recv_handling
!=
VCL_RET_PIPE
)
&&
(
recv_handling
!=
VCL_RET_PASS
))
{
if
(
RFC2616_Req_Gzip
(
s
p
))
{
if
(
RFC2616_Req_Gzip
(
req
->
htt
p
))
{
http_Unset
(
req
->
http
,
H_Accept_Encoding
);
http_SetHeader
(
req
->
http
,
"Accept-Encoding: gzip"
);
}
else
{
...
...
bin/varnishd/cache/cache_rfc2616.c
View file @
35443881
...
...
@@ -179,27 +179,27 @@ RFC2616_Ttl(struct busyobj *bo, unsigned xid)
*/
enum
body_status
RFC2616_Body
(
const
struct
sess
*
sp
)
RFC2616_Body
(
struct
busyobj
*
bo
,
struct
dstat
*
stats
)
{
struct
http
*
hp
;
char
*
b
;
hp
=
sp
->
wrk
->
busyobj
->
beresp
;
hp
=
bo
->
beresp
;
if
(
hp
->
protover
<
11
&&
!
http_HdrIs
(
hp
,
H_Connection
,
"keep-alive"
))
sp
->
wrk
->
busyobj
->
should_close
=
1
;
bo
->
should_close
=
1
;
else
if
(
http_HdrIs
(
hp
,
H_Connection
,
"close"
))
sp
->
wrk
->
busyobj
->
should_close
=
1
;
bo
->
should_close
=
1
;
else
sp
->
wrk
->
busyobj
->
should_close
=
0
;
bo
->
should_close
=
0
;
if
(
!
strcasecmp
(
http_GetReq
(
sp
->
wrk
->
busyobj
->
bereq
),
"head"
))
{
if
(
!
strcasecmp
(
http_GetReq
(
bo
->
bereq
),
"head"
))
{
/*
* A HEAD request can never have a body in the reply,
* no matter what the headers might say.
* [RFC2516 4.3 p33]
*/
s
p
->
wrk
->
stats
.
fetch_head
++
;
s
tats
->
fetch_head
++
;
return
(
BS_NONE
);
}
...
...
@@ -208,7 +208,7 @@ RFC2616_Body(const struct sess *sp)
* 1xx responses never have a body.
* [RFC2616 4.3 p33]
*/
s
p
->
wrk
->
stats
.
fetch_1xx
++
;
s
tats
->
fetch_1xx
++
;
return
(
BS_NONE
);
}
...
...
@@ -217,7 +217,7 @@ RFC2616_Body(const struct sess *sp)
* 204 is "No Content", obviously don't expect a body.
* [RFC2616 10.2.5 p60]
*/
s
p
->
wrk
->
stats
.
fetch_204
++
;
s
tats
->
fetch_204
++
;
return
(
BS_NONE
);
}
...
...
@@ -226,23 +226,23 @@ RFC2616_Body(const struct sess *sp)
* 304 is "Not Modified" it has no body.
* [RFC2616 10.3.5 p63]
*/
s
p
->
wrk
->
stats
.
fetch_304
++
;
s
tats
->
fetch_304
++
;
return
(
BS_NONE
);
}
if
(
http_HdrIs
(
hp
,
H_Transfer_Encoding
,
"chunked"
))
{
s
p
->
wrk
->
stats
.
fetch_chunked
++
;
s
tats
->
fetch_chunked
++
;
return
(
BS_CHUNKED
);
}
if
(
http_GetHdr
(
hp
,
H_Transfer_Encoding
,
&
b
))
{
s
p
->
wrk
->
stats
.
fetch_bad
++
;
s
tats
->
fetch_bad
++
;
return
(
BS_ERROR
);
}
if
(
http_GetHdr
(
hp
,
H_Content_Length
,
&
sp
->
wrk
->
busyobj
->
h_content_length
))
{
s
p
->
wrk
->
stats
.
fetch_length
++
;
&
bo
->
h_content_length
))
{
s
tats
->
fetch_length
++
;
return
(
BS_LENGTH
);
}
...
...
@@ -251,7 +251,7 @@ RFC2616_Body(const struct sess *sp)
* Keep alive with neither TE=Chunked or C-Len is impossible.
* We assume a zero length body.
*/
s
p
->
wrk
->
stats
.
fetch_zero
++
;
s
tats
->
fetch_zero
++
;
return
(
BS_ZERO
);
}
...
...
@@ -259,7 +259,7 @@ RFC2616_Body(const struct sess *sp)
/*
* In this case, it is safe to just read what comes.
*/
s
p
->
wrk
->
stats
.
fetch_close
++
;
s
tats
->
fetch_close
++
;
return
(
BS_EOF
);
}
...
...
@@ -267,14 +267,14 @@ RFC2616_Body(const struct sess *sp)
/*
* With no Connection header, assume EOF.
*/
s
p
->
wrk
->
stats
.
fetch_oldhttp
++
;
s
tats
->
fetch_oldhttp
++
;
return
(
BS_EOF
);
}
/*
* Fall back to EOF transfer.
*/
s
p
->
wrk
->
stats
.
fetch_eof
++
;
s
tats
->
fetch_eof
++
;
return
(
BS_EOF
);
}
...
...
@@ -283,7 +283,7 @@ RFC2616_Body(const struct sess *sp)
*/
unsigned
RFC2616_Req_Gzip
(
const
struct
sess
*
s
p
)
RFC2616_Req_Gzip
(
const
struct
http
*
h
p
)
{
...
...
@@ -292,7 +292,7 @@ RFC2616_Req_Gzip(const struct sess *sp)
* p104 says to not do q values for x-gzip, so we just test
* for its existence.
*/
if
(
http_GetHdrData
(
sp
->
req
->
htt
p
,
H_Accept_Encoding
,
"x-gzip"
,
NULL
))
if
(
http_GetHdrData
(
h
p
,
H_Accept_Encoding
,
"x-gzip"
,
NULL
))
return
(
1
);
/*
...
...
@@ -300,7 +300,7 @@ RFC2616_Req_Gzip(const struct sess *sp)
* We do not care a hoot if the client prefers some other
* compression more than gzip: Varnish only does gzip.
*/
if
(
http_GetHdrQ
(
sp
->
req
->
htt
p
,
H_Accept_Encoding
,
"gzip"
)
>
0
.)
if
(
http_GetHdrQ
(
h
p
,
H_Accept_Encoding
,
"gzip"
)
>
0
.)
return
(
1
);
/* Bad client, no gzip. */
...
...
bin/varnishd/cache/cache_vrt_var.c
View file @
35443881
...
...
@@ -355,7 +355,7 @@ VRT_r_req_can_gzip(struct sess *sp)
{
CHECK_OBJ_NOTNULL
(
sp
,
SESS_MAGIC
);
return
(
RFC2616_Req_Gzip
(
sp
));
return
(
RFC2616_Req_Gzip
(
sp
->
req
->
http
));
}
...
...
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