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
4f435cef
Commit
4f435cef
authored
Sep 05, 2013
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
e44815ad
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
25 deletions
+24
-25
cache.h
bin/varnishd/cache/cache.h
+8
-3
cache_gzip.c
bin/varnishd/cache/cache_gzip.c
+6
-6
cache_http1_deliver.c
bin/varnishd/cache/cache_http1_deliver.c
+10
-16
No files found.
bin/varnishd/cache/cache.h
View file @
4f435cef
...
@@ -278,7 +278,12 @@ extern struct vfp vfp_esi;
...
@@ -278,7 +278,12 @@ extern struct vfp vfp_esi;
/* Deliver processors ------------------------------------------------*/
/* Deliver processors ------------------------------------------------*/
typedef
int
vdp_bytes
(
struct
req
*
,
int
flush
,
void
*
ptr
,
ssize_t
len
);
enum
vdp_action
{
VDP_NULL
,
VDP_FLUSH
,
VDP_FINISH
,
};
typedef
int
vdp_bytes
(
struct
req
*
,
enum
vdp_action
,
void
*
ptr
,
ssize_t
len
);
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
...
@@ -837,7 +842,7 @@ int HTTP1_IterateReqBody(struct req *req, req_body_iter_f *func, void *priv);
...
@@ -837,7 +842,7 @@ int HTTP1_IterateReqBody(struct req *req, req_body_iter_f *func, void *priv);
void
V1D_Deliver
(
struct
req
*
);
void
V1D_Deliver
(
struct
req
*
);
static
inline
int
static
inline
int
VDP_bytes
(
struct
req
*
req
,
int
flush
,
void
*
ptr
,
ssize_t
len
)
VDP_bytes
(
struct
req
*
req
,
enum
vdp_action
act
,
void
*
ptr
,
ssize_t
len
)
{
{
int
i
,
retval
;
int
i
,
retval
;
...
@@ -846,7 +851,7 @@ VDP_bytes(struct req *req, int flush, void *ptr, ssize_t len)
...
@@ -846,7 +851,7 @@ VDP_bytes(struct req *req, int flush, void *ptr, ssize_t len)
/* Call the present layer, while pointing to the next layer down */
/* Call the present layer, while pointing to the next layer down */
i
=
req
->
vdp_nxt
--
;
i
=
req
->
vdp_nxt
--
;
assert
(
i
>=
0
&&
i
<
N_VDPS
);
assert
(
i
>=
0
&&
i
<
N_VDPS
);
retval
=
req
->
vdps
[
i
](
req
,
flush
,
ptr
,
len
);
retval
=
req
->
vdps
[
i
](
req
,
act
,
ptr
,
len
);
req
->
vdp_nxt
++
;
req
->
vdp_nxt
++
;
return
(
retval
);
return
(
retval
);
}
}
...
...
bin/varnishd/cache/cache_gzip.c
View file @
4f435cef
...
@@ -315,7 +315,7 @@ VGZ_WrwInit(struct vgz *vg)
...
@@ -315,7 +315,7 @@ VGZ_WrwInit(struct vgz *vg)
*/
*/
int
__match_proto__
(
vdp_bytes
)
int
__match_proto__
(
vdp_bytes
)
VDP_gunzip
(
struct
req
*
req
,
int
flush
,
void
*
ptr
,
ssize_t
len
)
VDP_gunzip
(
struct
req
*
req
,
enum
vdp_action
act
,
void
*
ptr
,
ssize_t
len
)
{
{
enum
vgzret_e
vr
;
enum
vgzret_e
vr
;
size_t
dl
;
size_t
dl
;
...
@@ -331,8 +331,8 @@ VDP_gunzip(struct req *req, int flush, void *ptr, ssize_t len)
...
@@ -331,8 +331,8 @@ VDP_gunzip(struct req *req, int flush, void *ptr, ssize_t len)
AN
(
vg
->
m_buf
);
AN
(
vg
->
m_buf
);
if
(
len
==
0
)
{
if
(
len
==
0
)
{
AN
(
flush
);
AN
(
act
>
VDP_NULL
);
return
(
VDP_bytes
(
req
,
1
,
vg
->
m_buf
,
vg
->
m_len
));
return
(
VDP_bytes
(
req
,
act
,
vg
->
m_buf
,
vg
->
m_len
));
}
}
VGZ_Ibuf
(
vg
,
ptr
,
len
);
VGZ_Ibuf
(
vg
,
ptr
,
len
);
...
@@ -346,7 +346,7 @@ VDP_gunzip(struct req *req, int flush, void *ptr, ssize_t len)
...
@@ -346,7 +346,7 @@ VDP_gunzip(struct req *req, int flush, void *ptr, ssize_t len)
if
(
vr
<
VGZ_OK
)
if
(
vr
<
VGZ_OK
)
return
(
-
1
);
return
(
-
1
);
if
(
vg
->
m_len
==
vg
->
m_sz
||
vr
==
VGZ_STUCK
)
{
if
(
vg
->
m_len
==
vg
->
m_sz
||
vr
==
VGZ_STUCK
)
{
if
(
VDP_bytes
(
req
,
1
,
vg
->
m_buf
,
vg
->
m_len
))
if
(
VDP_bytes
(
req
,
VDP_FLUSH
,
vg
->
m_buf
,
vg
->
m_len
))
return
(
-
1
);
return
(
-
1
);
vg
->
m_len
=
0
;
vg
->
m_len
=
0
;
VGZ_Obuf
(
vg
,
vg
->
m_buf
,
vg
->
m_sz
);
VGZ_Obuf
(
vg
,
vg
->
m_buf
,
vg
->
m_sz
);
...
@@ -389,7 +389,7 @@ VGZ_WrwGunzip(struct req *req, struct vgz *vg, const void *ibuf,
...
@@ -389,7 +389,7 @@ VGZ_WrwGunzip(struct req *req, struct vgz *vg, const void *ibuf,
if
(
vr
<
VGZ_OK
)
if
(
vr
<
VGZ_OK
)
return
(
vr
);
return
(
vr
);
if
(
vg
->
m_len
==
vg
->
m_sz
||
vr
==
VGZ_STUCK
)
{
if
(
vg
->
m_len
==
vg
->
m_sz
||
vr
==
VGZ_STUCK
)
{
(
void
)
VDP_bytes
(
req
,
1
,
vg
->
m_buf
,
vg
->
m_len
);
(
void
)
VDP_bytes
(
req
,
VDP_FLUSH
,
vg
->
m_buf
,
vg
->
m_len
);
vg
->
m_len
=
0
;
vg
->
m_len
=
0
;
VGZ_Obuf
(
vg
,
vg
->
m_buf
,
vg
->
m_sz
);
VGZ_Obuf
(
vg
,
vg
->
m_buf
,
vg
->
m_sz
);
}
}
...
@@ -414,7 +414,7 @@ VGZ_WrwFlush(struct req *req, struct vgz *vg)
...
@@ -414,7 +414,7 @@ VGZ_WrwFlush(struct req *req, struct vgz *vg)
if
(
vg
->
m_len
==
0
)
if
(
vg
->
m_len
==
0
)
return
;
return
;
(
void
)
VDP_bytes
(
req
,
1
,
vg
->
m_buf
,
vg
->
m_len
);
(
void
)
VDP_bytes
(
req
,
VDP_FLUSH
,
vg
->
m_buf
,
vg
->
m_len
);
vg
->
m_len
=
0
;
vg
->
m_len
=
0
;
VGZ_Obuf
(
vg
,
vg
->
m_buf
,
vg
->
m_sz
);
VGZ_Obuf
(
vg
,
vg
->
m_buf
,
vg
->
m_sz
);
}
}
...
...
bin/varnishd/cache/cache_http1_deliver.c
View file @
4f435cef
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
static
int
__match_proto__
(
vdp_bytes
)
static
int
__match_proto__
(
vdp_bytes
)
v1d_bytes
(
struct
req
*
req
,
int
flush
,
void
*
ptr
,
ssize_t
len
)
v1d_bytes
(
struct
req
*
req
,
enum
vdp_action
act
,
void
*
ptr
,
ssize_t
len
)
{
{
ssize_t
wl
=
0
;
ssize_t
wl
=
0
;
...
@@ -48,7 +48,7 @@ v1d_bytes(struct req *req, int flush, void *ptr, ssize_t len)
...
@@ -48,7 +48,7 @@ v1d_bytes(struct req *req, int flush, void *ptr, ssize_t len)
wl
=
WRW_Write
(
req
->
wrk
,
ptr
,
len
);
wl
=
WRW_Write
(
req
->
wrk
,
ptr
,
len
);
if
(
wl
>
0
)
if
(
wl
>
0
)
req
->
acct_req
.
bodybytes
+=
wl
;
req
->
acct_req
.
bodybytes
+=
wl
;
if
(
flush
&&
WRW_Flush
(
req
->
wrk
))
if
(
act
>
VDP_NULL
&&
WRW_Flush
(
req
->
wrk
))
return
(
-
1
);
return
(
-
1
);
if
(
len
!=
wl
)
if
(
len
!=
wl
)
return
(
-
1
);
return
(
-
1
);
...
@@ -58,7 +58,7 @@ v1d_bytes(struct req *req, int flush, void *ptr, ssize_t len)
...
@@ -58,7 +58,7 @@ v1d_bytes(struct req *req, int flush, void *ptr, ssize_t len)
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
static
int
__match_proto__
(
vdp_bytes
)
static
int
__match_proto__
(
vdp_bytes
)
v1d_range_bytes
(
struct
req
*
req
,
int
flush
,
void
*
ptr
,
ssize_t
len
)
v1d_range_bytes
(
struct
req
*
req
,
enum
vdp_action
act
,
void
*
ptr
,
ssize_t
len
)
{
{
int
retval
=
0
;
int
retval
=
0
;
ssize_t
l
;
ssize_t
l
;
...
@@ -76,8 +76,8 @@ v1d_range_bytes(struct req *req, int flush, void *ptr, ssize_t len)
...
@@ -76,8 +76,8 @@ v1d_range_bytes(struct req *req, int flush, void *ptr, ssize_t len)
l
=
req
->
range_high
-
req
->
range_off
;
l
=
req
->
range_high
-
req
->
range_off
;
if
(
l
>
len
)
if
(
l
>
len
)
l
=
len
;
l
=
len
;
if
(
flush
||
l
>
0
)
if
(
act
>
VDP_NULL
||
l
>
0
)
retval
=
VDP_bytes
(
req
,
flush
,
p
,
l
);
retval
=
VDP_bytes
(
req
,
act
,
p
,
l
);
req
->
range_off
+=
len
;
req
->
range_off
+=
len
;
return
(
retval
);
return
(
retval
);
}
}
...
@@ -165,10 +165,10 @@ v1d_WriteDirObj(struct req *req)
...
@@ -165,10 +165,10 @@ v1d_WriteDirObj(struct req *req)
XXXAN
(
oi
);
XXXAN
(
oi
);
while
(
ObjIter
(
oi
,
&
ptr
,
&
len
))
{
while
(
ObjIter
(
oi
,
&
ptr
,
&
len
))
{
if
(
VDP_bytes
(
req
,
0
,
ptr
,
len
))
if
(
VDP_bytes
(
req
,
VDP_NULL
,
ptr
,
len
))
break
;
break
;
}
}
(
void
)
VDP_bytes
(
req
,
1
,
NULL
,
0
);
(
void
)
VDP_bytes
(
req
,
VDP_FINISH
,
NULL
,
0
);
ObjIterEnd
(
&
oi
);
ObjIterEnd
(
&
oi
);
}
}
...
@@ -290,15 +290,9 @@ V1D_Deliver(struct req *req)
...
@@ -290,15 +290,9 @@ V1D_Deliver(struct req *req)
ESI_Deliver
(
req
);
ESI_Deliver
(
req
);
}
else
if
(
req
->
res_mode
&
RES_ESI_CHILD
&&
req
->
gzip_resp
)
{
}
else
if
(
req
->
res_mode
&
RES_ESI_CHILD
&&
req
->
gzip_resp
)
{
ESI_DeliverChild
(
req
);
ESI_DeliverChild
(
req
);
}
else
if
(
req
->
res_mode
&
RES_ESI_CHILD
&&
}
else
if
(
req
->
res_mode
&
RES_GUNZIP
||
!
req
->
gzip_resp
&&
req
->
obj
->
gziped
)
{
(
req
->
res_mode
&
RES_ESI_CHILD
&&
VDP_push
(
req
,
VDP_gunzip
);
!
req
->
gzip_resp
&&
req
->
obj
->
gziped
))
{
req
->
vgz
=
VGZ_NewUngzip
(
req
->
vsl
,
"U D -"
);
AZ
(
VGZ_WrwInit
(
req
->
vgz
));
v1d_WriteDirObj
(
req
);
(
void
)
VGZ_Destroy
(
&
req
->
vgz
);
VDP_pop
(
req
,
VDP_gunzip
);
}
else
if
(
req
->
res_mode
&
RES_GUNZIP
)
{
VDP_push
(
req
,
VDP_gunzip
);
VDP_push
(
req
,
VDP_gunzip
);
req
->
vgz
=
VGZ_NewUngzip
(
req
->
vsl
,
"U D -"
);
req
->
vgz
=
VGZ_NewUngzip
(
req
->
vsl
,
"U D -"
);
AZ
(
VGZ_WrwInit
(
req
->
vgz
));
AZ
(
VGZ_WrwInit
(
req
->
vgz
));
...
...
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