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
7333dde2
Commit
7333dde2
authored
May 07, 2015
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pull the protocol-agnostic bits of VDP (esi, range, gunzip) out of V1D
and plunk it down in req_fsm for now.
parent
b86ffb93
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
63 deletions
+66
-63
cache.h
bin/varnishd/cache/cache.h
+2
-2
cache_esi_deliver.c
bin/varnishd/cache/cache_esi_deliver.c
+22
-4
cache_req_fsm.c
bin/varnishd/cache/cache_req_fsm.c
+41
-2
cache_http1_deliver.c
bin/varnishd/http1/cache_http1_deliver.c
+1
-55
No files found.
bin/varnishd/cache/cache.h
View file @
7333dde2
...
@@ -741,7 +741,7 @@ extern const int HTTP1_Req[3];
...
@@ -741,7 +741,7 @@ extern const int HTTP1_Req[3];
extern
const
int
HTTP1_Resp
[
3
];
extern
const
int
HTTP1_Resp
[
3
];
/* cache_http1_deliver.c */
/* cache_http1_deliver.c */
void
V1D_Deliver
(
struct
req
*
,
struct
busyobj
*
);
void
V1D_Deliver
(
struct
req
*
);
/* cache_http1_pipe.c */
/* cache_http1_pipe.c */
void
V1P_Init
(
void
);
void
V1P_Init
(
void
);
...
@@ -1107,7 +1107,7 @@ char *VRT_StringList(char *d, unsigned dl, const char *p, va_list ap);
...
@@ -1107,7 +1107,7 @@ char *VRT_StringList(char *d, unsigned dl, const char *p, va_list ap);
void
VRTPRIV_init
(
struct
vrt_privs
*
privs
);
void
VRTPRIV_init
(
struct
vrt_privs
*
privs
);
void
VRTPRIV_dynamic_kill
(
struct
vrt_privs
*
privs
,
uintptr_t
id
);
void
VRTPRIV_dynamic_kill
(
struct
vrt_privs
*
privs
,
uintptr_t
id
);
void
ESI_DeliverChild
(
struct
req
*
,
struct
busyobj
*
);
int
VED_Setup
(
struct
req
*
req
,
struct
busyobj
*
bo
);
/* cache_vrt_vmod.c */
/* cache_vrt_vmod.c */
void
VMOD_Init
(
void
);
void
VMOD_Init
(
void
);
...
...
bin/varnishd/cache/cache_esi_deliver.c
View file @
7333dde2
...
@@ -653,11 +653,30 @@ ved_stripgzip(struct req *req)
...
@@ -653,11 +653,30 @@ ved_stripgzip(struct req *req)
req
->
l_crc
+=
ilen
;
req
->
l_crc
+=
ilen
;
}
}
void
int
ESI_DeliverChild
(
struct
req
*
req
,
struct
busyobj
*
bo
)
VED_Setup
(
struct
req
*
req
,
struct
busyobj
*
bo
)
{
{
int
i
;
int
i
;
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
->
objcore
,
OBJCORE_MAGIC
);
/*
* Determine ESI status first. Not dependent on wantbody, because
* we want ESI to supress C-L in HEAD too.
*/
if
(
!
req
->
disable_esi
&&
ObjGetattr
(
req
->
wrk
,
req
->
objcore
,
OA_ESIDATA
,
NULL
)
!=
NULL
)
{
req
->
res_mode
|=
RES_ESI
;
RFC2616_Weaken_Etag
(
req
->
resp
);
req
->
resp_len
=
-
1
;
VDP_push
(
req
,
VDP_ESI
,
NULL
,
0
);
}
/* ESI-childen need special treatment */
if
(
req
->
esi_level
==
0
)
return
(
0
);
req
->
res_mode
|=
RES_ESI_CHILD
;
req
->
res_mode
|=
RES_ESI_CHILD
;
i
=
ObjCheckFlag
(
req
->
wrk
,
req
->
objcore
,
OF_GZIPED
);
i
=
ObjCheckFlag
(
req
->
wrk
,
req
->
objcore
,
OF_GZIPED
);
if
(
req
->
gzip_resp
&&
i
&&
!
(
req
->
res_mode
&
RES_ESI
))
{
if
(
req
->
gzip_resp
&&
i
&&
!
(
req
->
res_mode
&
RES_ESI
))
{
...
@@ -666,8 +685,6 @@ ESI_DeliverChild(struct req *req, struct busyobj *bo)
...
@@ -666,8 +685,6 @@ ESI_DeliverChild(struct req *req, struct busyobj *bo)
ved_stripgzip
(
req
);
ved_stripgzip
(
req
);
(
void
)
VDP_bytes
(
req
,
VDP_FLUSH
,
NULL
,
0
);
(
void
)
VDP_bytes
(
req
,
VDP_FLUSH
,
NULL
,
0
);
}
else
{
}
else
{
if
(
req
->
res_mode
&
RES_ESI
)
VDP_push
(
req
,
VDP_ESI
,
NULL
,
0
);
if
(
req
->
gzip_resp
&&
!
i
)
if
(
req
->
gzip_resp
&&
!
i
)
VDP_push
(
req
,
ved_pretend_gzip
,
NULL
,
0
);
VDP_push
(
req
,
ved_pretend_gzip
,
NULL
,
0
);
else
if
(
!
req
->
gzip_resp
&&
i
)
else
if
(
!
req
->
gzip_resp
&&
i
)
...
@@ -676,4 +693,5 @@ ESI_DeliverChild(struct req *req, struct busyobj *bo)
...
@@ -676,4 +693,5 @@ ESI_DeliverChild(struct req *req, struct busyobj *bo)
(
void
)
VDP_DeliverObj
(
req
);
(
void
)
VDP_DeliverObj
(
req
);
}
}
VDP_close
(
req
);
VDP_close
(
req
);
return
(
1
);
}
}
bin/varnishd/cache/cache_req_fsm.c
View file @
7333dde2
...
@@ -40,12 +40,49 @@
...
@@ -40,12 +40,49 @@
#include "cache.h"
#include "cache.h"
#include "cache_director.h"
#include "cache_director.h"
#include "cache_filter.h"
#include "hash/hash_slinger.h"
#include "hash/hash_slinger.h"
#include "vcl.h"
#include "vcl.h"
#include "vsha256.h"
#include "vsha256.h"
#include "vtim.h"
#include "vtim.h"
static
void
cnt_vdp
(
struct
req
*
req
,
struct
busyobj
*
bo
)
{
const
char
*
r
;
req
->
res_mode
=
0
;
if
(
bo
!=
NULL
)
req
->
resp_len
=
http_GetContentLength
(
bo
->
beresp
);
else
req
->
resp_len
=
ObjGetLen
(
req
->
wrk
,
req
->
objcore
);
if
(
VED_Setup
(
req
,
bo
))
return
;
if
(
cache_param
->
http_gzip_support
&&
ObjCheckFlag
(
req
->
wrk
,
req
->
objcore
,
OF_GZIPED
)
&&
!
RFC2616_Req_Gzip
(
req
->
http
))
{
req
->
res_mode
|=
RES_GUNZIP
;
VDP_push
(
req
,
VDP_gunzip
,
NULL
,
1
);
}
/*
* Range comes after the others and pushes on bottom because
* it can generate a correct C-L header.
*/
if
(
cache_param
->
http_range_support
&&
http_IsStatus
(
req
->
resp
,
200
))
{
http_SetHeader
(
req
->
resp
,
"Accept-Ranges: bytes"
);
if
(
req
->
wantbody
&&
http_GetHdr
(
req
->
http
,
H_Range
,
&
r
))
VRG_dorange
(
req
,
r
);
}
V1D_Deliver
(
req
);
}
/*--------------------------------------------------------------------
/*--------------------------------------------------------------------
* Deliver an object to client
* Deliver an object to client
*/
*/
...
@@ -144,7 +181,9 @@ cnt_deliver(struct worker *wrk, struct req *req)
...
@@ -144,7 +181,9 @@ cnt_deliver(struct worker *wrk, struct req *req)
VBO_DerefBusyObj
(
wrk
,
&
bo
);
VBO_DerefBusyObj
(
wrk
,
&
bo
);
}
}
}
}
V1D_Deliver
(
req
,
bo
);
cnt_vdp
(
req
,
bo
);
if
(
bo
!=
NULL
)
if
(
bo
!=
NULL
)
VBO_DerefBusyObj
(
wrk
,
&
bo
);
VBO_DerefBusyObj
(
wrk
,
&
bo
);
...
@@ -235,7 +274,7 @@ cnt_synth(struct worker *wrk, struct req *req)
...
@@ -235,7 +274,7 @@ cnt_synth(struct worker *wrk, struct req *req)
VSB_delete
(
req
->
synth_body
);
VSB_delete
(
req
->
synth_body
);
req
->
synth_body
=
NULL
;
req
->
synth_body
=
NULL
;
V1D_Deliver
(
req
,
NULL
);
cnt_vdp
(
req
,
NULL
);
(
void
)
HSH_DerefObjCore
(
wrk
,
&
req
->
objcore
);
(
void
)
HSH_DerefObjCore
(
wrk
,
&
req
->
objcore
);
}
}
...
...
bin/varnishd/http1/cache_http1_deliver.c
View file @
7333dde2
...
@@ -61,67 +61,13 @@ v1d_bytes(struct req *req, enum vdp_action act, void **priv,
...
@@ -61,67 +61,13 @@ v1d_bytes(struct req *req, enum vdp_action act, void **priv,
*/
*/
void
void
V1D_Deliver
(
struct
req
*
req
,
struct
busyobj
*
bo
)
V1D_Deliver
(
struct
req
*
req
)
{
{
const
char
*
r
;
enum
objiter_status
ois
;
enum
objiter_status
ois
;
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
->
objcore
,
OBJCORE_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
->
objcore
,
OBJCORE_MAGIC
);
req
->
res_mode
=
0
;
if
(
bo
!=
NULL
)
req
->
resp_len
=
http_GetContentLength
(
bo
->
beresp
);
else
req
->
resp_len
=
ObjGetLen
(
req
->
wrk
,
req
->
objcore
);
/*
* Determine ESI status first. Not dependent on wantbody, because
* we want ESI to supress C-L in HEAD too.
*/
if
(
!
req
->
disable_esi
&&
ObjGetattr
(
req
->
wrk
,
req
->
objcore
,
OA_ESIDATA
,
NULL
)
!=
NULL
)
req
->
res_mode
|=
RES_ESI
;
/*
* ESI-childen don't care about headers -> early escape
*/
if
(
req
->
esi_level
>
0
)
{
ESI_DeliverChild
(
req
,
bo
);
return
;
}
if
(
req
->
res_mode
&
RES_ESI
)
{
RFC2616_Weaken_Etag
(
req
->
resp
);
req
->
resp_len
=
-
1
;
VDP_push
(
req
,
VDP_ESI
,
NULL
,
0
);
}
if
(
cache_param
->
http_gzip_support
&&
ObjCheckFlag
(
req
->
wrk
,
req
->
objcore
,
OF_GZIPED
)
&&
!
RFC2616_Req_Gzip
(
req
->
http
))
{
/*
* We don't know what it uncompresses to
* XXX: we could cache that, but would still deliver
* XXX: with multiple writes because of the gunzip buffer
*/
req
->
res_mode
|=
RES_GUNZIP
;
VDP_push
(
req
,
VDP_gunzip
,
NULL
,
1
);
}
if
(
req
->
res_mode
&
RES_ESI
)
assert
(
req
->
resp_len
<
0
);
/*
* Range comes after the others and pushes on bottom because it
* can generate a correct C-L header.
*/
if
(
cache_param
->
http_range_support
&&
http_IsStatus
(
req
->
resp
,
200
))
{
http_SetHeader
(
req
->
resp
,
"Accept-Ranges: bytes"
);
if
(
req
->
wantbody
&&
http_GetHdr
(
req
->
http
,
H_Range
,
&
r
))
VRG_dorange
(
req
,
r
);
}
if
((
req
->
objcore
->
flags
&
OC_F_PRIVATE
)
&&
if
((
req
->
objcore
->
flags
&
OC_F_PRIVATE
)
&&
!
strcasecmp
(
http_GetMethod
(
req
->
http0
),
"HEAD"
))
{
!
strcasecmp
(
http_GetMethod
(
req
->
http0
),
"HEAD"
))
{
/* HEAD+pass is allowed to send the C-L through unmolested. */
/* HEAD+pass is allowed to send the C-L through unmolested. */
...
...
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