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
8b1f8991
Commit
8b1f8991
authored
May 14, 2015
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make ESI delivery less magic.
parent
ca50ccd5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
33 deletions
+36
-33
cache.h
bin/varnishd/cache/cache.h
+2
-4
cache_esi_deliver.c
bin/varnishd/cache/cache_esi_deliver.c
+19
-25
cache_req_fsm.c
bin/varnishd/cache/cache_req_fsm.c
+13
-3
cache_http1_deliver.c
bin/varnishd/http1/cache_http1_deliver.c
+2
-1
No files found.
bin/varnishd/cache/cache.h
View file @
8b1f8991
...
...
@@ -684,7 +684,7 @@ struct sess {
* or may not, be talking a "real" HTTP protocol itself.
*/
typedef
void
vtr_deliver_f
(
struct
req
*
);
typedef
void
vtr_deliver_f
(
struct
req
*
,
struct
busyobj
*
);
struct
transport
{
unsigned
magic
;
...
...
@@ -746,7 +746,7 @@ extern const int HTTP1_Req[3];
extern
const
int
HTTP1_Resp
[
3
];
/* cache_http1_deliver.c */
v
oid
V1D_Deliver
(
struct
req
*
)
;
v
tr_deliver_f
V1D_Deliver
;
/* cache_http1_pipe.c */
void
V1P_Init
(
void
);
...
...
@@ -1113,8 +1113,6 @@ char *VRT_StringList(char *d, unsigned dl, const char *p, va_list ap);
void
VRTPRIV_init
(
struct
vrt_privs
*
privs
);
void
VRTPRIV_dynamic_kill
(
struct
vrt_privs
*
privs
,
uintptr_t
id
);
int
VED_Setup
(
struct
req
*
req
,
struct
busyobj
*
bo
);
/* cache_vrt_vmod.c */
void
VMOD_Init
(
void
);
...
...
bin/varnishd/cache/cache_esi_deliver.c
View file @
8b1f8991
...
...
@@ -41,6 +41,8 @@
#include "vend.h"
#include "vgz.h"
static
vtr_deliver_f
VED_Deliver
;
/*--------------------------------------------------------------------*/
static
int
__match_proto__
(
vdp_bytes
)
...
...
@@ -108,10 +110,18 @@ ved_include(struct req *preq, const char *src, const char *host)
http_ForceField
(
req
->
http0
,
HTTP_HDR_METHOD
,
"GET"
);
http_ForceField
(
req
->
http0
,
HTTP_HDR_PROTO
,
"HTTP/1.1"
);
/* Don't allow
Condition
s, we can't use a 304 */
/* Don't allow
conditionals
s, we can't use a 304 */
http_Unset
(
req
->
http0
,
H_If_Modified_Since
);
http_Unset
(
req
->
http0
,
H_If_None_Match
);
/* Don't allow Range */
http_Unset
(
req
->
http0
,
H_Range
);
/* Set Accept-Encoding according to what we want */
http_Unset
(
req
->
http0
,
H_Accept_Encoding
);
if
(
preq
->
gzip_resp
)
http_ForceHeader
(
req
->
http0
,
H_Accept_Encoding
,
"gzip"
);
/* Client content already taken care of */
http_Unset
(
req
->
http0
,
H_Content_Length
);
...
...
@@ -136,6 +146,7 @@ ved_include(struct req *preq, const char *src, const char *host)
req
->
l_crc
=
preq
->
l_crc
;
INIT_OBJ
(
&
xp
,
TRANSPORT_MAGIC
);
xp
.
deliver
=
VED_Deliver
;
req
->
transport
=
&
xp
;
req
->
transport_priv
=
preq
;
...
...
@@ -656,50 +667,33 @@ ved_stripgzip(struct req *req)
req
->
l_crc
+=
ilen
;
}
int
VED_
Setup
(
struct
req
*
req
,
struct
busyobj
*
bo
)
static
void
__match_proto__
(
vtr_deliver_f
)
VED_
Deliver
(
struct
req
*
req
,
struct
busyobj
*
bo
)
{
int
i
;
struct
req
*
preq
;
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
CHECK_OBJ_ORNULL
(
bo
,
BUSYOBJ_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
);
CAST_OBJ_NOTNULL
(
preq
,
req
->
transport_priv
,
REQ_MAGIC
);
VDP_push
(
req
,
ved_vdp_bytes
,
preq
,
1
);
req
->
res_mode
|=
RES_ESI_CHILD
;
i
=
ObjCheckFlag
(
req
->
wrk
,
req
->
objcore
,
OF_GZIPED
);
if
(
req
->
gzip_resp
&&
i
&&
!
(
req
->
res_mode
&
RES_ESI
))
{
VDP_push
(
req
,
ved_vdp_bytes
,
preq
,
1
);
if
(
bo
!=
NULL
)
VBO_waitstate
(
bo
,
BOS_FINISHED
);
ved_stripgzip
(
req
);
(
void
)
VDP_bytes
(
req
,
VDP_FLUSH
,
NULL
,
0
);
}
else
{
if
(
req
->
gzip_resp
&&
!
i
)
VDP_push
(
req
,
ved_pretend_gzip
,
NULL
,
0
);
else
if
(
!
req
->
gzip_resp
&&
i
)
VDP_push
(
req
,
VDP_gunzip
,
NULL
,
0
);
VDP_push
(
req
,
ved_pretend_gzip
,
NULL
,
1
);
VDP_push
(
req
,
ved_vdp_bytes
,
preq
,
1
);
(
void
)
VDP_DeliverObj
(
req
);
}
VDP_close
(
req
);
return
(
1
);
}
bin/varnishd/cache/cache_req_fsm.c
View file @
8b1f8991
...
...
@@ -58,8 +58,18 @@ cnt_vdp(struct req *req, struct busyobj *bo)
else
req
->
resp_len
=
ObjGetLen
(
req
->
wrk
,
req
->
objcore
);
if
(
VED_Setup
(
req
,
bo
))
return
;
/*
* 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
);
}
if
(
cache_param
->
http_gzip_support
&&
ObjCheckFlag
(
req
->
wrk
,
req
->
objcore
,
OF_GZIPED
)
&&
...
...
@@ -81,7 +91,7 @@ cnt_vdp(struct req *req, struct busyobj *bo)
}
CHECK_OBJ_NOTNULL
(
req
->
transport
,
TRANSPORT_MAGIC
);
req
->
transport
->
deliver
(
req
);
req
->
transport
->
deliver
(
req
,
bo
);
}
/*--------------------------------------------------------------------
...
...
bin/varnishd/http1/cache_http1_deliver.c
View file @
8b1f8991
...
...
@@ -61,11 +61,12 @@ v1d_bytes(struct req *req, enum vdp_action act, void **priv,
*/
void
__match_proto__
(
vtr_deliver_f
)
V1D_Deliver
(
struct
req
*
req
)
V1D_Deliver
(
struct
req
*
req
,
struct
busyobj
*
bo
)
{
enum
objiter_status
ois
;
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
CHECK_OBJ_ORNULL
(
bo
,
BUSYOBJ_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
->
objcore
,
OBJCORE_MAGIC
);
if
((
req
->
objcore
->
flags
&
OC_F_PRIVATE
)
&&
...
...
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