Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnishevent3
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
varnishevent3
Commits
fe361cf2
Commit
fe361cf2
authored
May 02, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Complete support for gunzip'ing during streaming delivery.
parent
349269f1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
9 deletions
+65
-9
cache.h
bin/varnishd/cache.h
+1
-1
cache_center.c
bin/varnishd/cache_center.c
+2
-1
cache_gzip.c
bin/varnishd/cache_gzip.c
+2
-0
cache_response.c
bin/varnishd/cache_response.c
+11
-7
t00001.vtc
bin/varnishtest/tests/t00001.vtc
+49
-0
No files found.
bin/varnishd/cache.h
View file @
fe361cf2
...
@@ -878,7 +878,7 @@ void RES_BuildHttp(struct sess *sp);
...
@@ -878,7 +878,7 @@ void RES_BuildHttp(struct sess *sp);
void
RES_WriteObj
(
struct
sess
*
sp
);
void
RES_WriteObj
(
struct
sess
*
sp
);
void
RES_StreamStart
(
struct
sess
*
sp
);
void
RES_StreamStart
(
struct
sess
*
sp
);
void
RES_StreamEnd
(
struct
sess
*
sp
);
void
RES_StreamEnd
(
struct
sess
*
sp
);
void
RES_StreamPoll
(
const
struct
sess
*
sp
);
void
RES_StreamPoll
(
struct
sess
*
sp
);
/* cache_vary.c */
/* cache_vary.c */
struct
vsb
*
VRY_Create
(
const
struct
sess
*
sp
,
const
struct
http
*
hp
);
struct
vsb
*
VRY_Create
(
const
struct
sess
*
sp
,
const
struct
http
*
hp
);
...
...
bin/varnishd/cache_center.c
View file @
fe361cf2
...
@@ -857,7 +857,6 @@ cnt_streambody(struct sess *sp)
...
@@ -857,7 +857,6 @@ cnt_streambody(struct sess *sp)
RES_StreamStart
(
sp
);
RES_StreamStart
(
sp
);
/* Use unmodified headers*/
i
=
FetchBody
(
sp
);
i
=
FetchBody
(
sp
);
sp
->
wrk
->
h_content_length
=
NULL
;
sp
->
wrk
->
h_content_length
=
NULL
;
...
@@ -888,6 +887,8 @@ cnt_streambody(struct sess *sp)
...
@@ -888,6 +887,8 @@ cnt_streambody(struct sess *sp)
sp
->
restarts
=
0
;
sp
->
restarts
=
0
;
RES_StreamEnd
(
sp
);
RES_StreamEnd
(
sp
);
if
(
sp
->
wrk
->
res_mode
&
RES_GUNZIP
)
VGZ_Destroy
(
&
sctx
.
vgz
);
sp
->
wrk
->
sctx
=
NULL
;
sp
->
wrk
->
sctx
=
NULL
;
assert
(
WRW_IsReleased
(
sp
->
wrk
));
assert
(
WRW_IsReleased
(
sp
->
wrk
));
...
...
bin/varnishd/cache_gzip.c
View file @
fe361cf2
...
@@ -569,6 +569,8 @@ vfp_gzip_end(struct sess *sp)
...
@@ -569,6 +569,8 @@ vfp_gzip_end(struct sess *sp)
i
=
VGZ_Gzip
(
vg
,
&
dp
,
&
dl
,
VGZ_FINISH
);
i
=
VGZ_Gzip
(
vg
,
&
dp
,
&
dl
,
VGZ_FINISH
);
sp
->
obj
->
len
+=
dl
;
sp
->
obj
->
len
+=
dl
;
}
while
(
i
!=
Z_STREAM_END
);
}
while
(
i
!=
Z_STREAM_END
);
if
(
sp
->
wrk
->
do_stream
)
RES_StreamPoll
(
sp
);
VGZ_UpdateObj
(
vg
,
sp
->
obj
);
VGZ_UpdateObj
(
vg
,
sp
->
obj
);
VGZ_Destroy
(
&
vg
);
VGZ_Destroy
(
&
vg
);
return
(
0
);
return
(
0
);
...
...
bin/varnishd/cache_response.c
View file @
fe361cf2
...
@@ -418,7 +418,7 @@ RES_StreamStart(struct sess *sp)
...
@@ -418,7 +418,7 @@ RES_StreamStart(struct sess *sp)
}
}
void
void
RES_StreamPoll
(
const
struct
sess
*
sp
)
RES_StreamPoll
(
struct
sess
*
sp
)
{
{
struct
stream_ctx
*
sctx
;
struct
stream_ctx
*
sctx
;
struct
storage
*
st
;
struct
storage
*
st
;
...
@@ -438,11 +438,17 @@ RES_StreamPoll(const struct sess *sp)
...
@@ -438,11 +438,17 @@ RES_StreamPoll(const struct sess *sp)
}
}
l2
=
st
->
len
+
l
-
sctx
->
stream_next
;
l2
=
st
->
len
+
l
-
sctx
->
stream_next
;
ptr
=
st
->
ptr
+
(
sctx
->
stream_next
-
l
);
ptr
=
st
->
ptr
+
(
sctx
->
stream_next
-
l
);
(
void
)
WRW_Write
(
sp
->
wrk
,
ptr
,
l2
);
if
(
sp
->
wrk
->
res_mode
&
RES_GUNZIP
)
{
(
void
)
VGZ_WrwGunzip
(
sp
,
sctx
->
vgz
,
ptr
,
l2
,
sctx
->
obuf
,
sctx
->
obuf_len
,
&
sctx
->
obuf_ptr
);
}
else
{
(
void
)
WRW_Write
(
sp
->
wrk
,
ptr
,
l2
);
}
l
+=
st
->
len
;
l
+=
st
->
len
;
sctx
->
stream_next
+=
l2
;
sctx
->
stream_next
+=
l2
;
}
}
(
void
)
WRW_Flush
(
sp
->
wrk
);
if
(
!
(
sp
->
wrk
->
res_mode
&
RES_GUNZIP
))
(
void
)
WRW_Flush
(
sp
->
wrk
);
if
(
sp
->
objcore
==
NULL
||
(
sp
->
objcore
->
flags
&
OC_F_PASS
))
{
if
(
sp
->
objcore
==
NULL
||
(
sp
->
objcore
->
flags
&
OC_F_PASS
))
{
/*
/*
...
@@ -469,10 +475,8 @@ RES_StreamEnd(struct sess *sp)
...
@@ -469,10 +475,8 @@ RES_StreamEnd(struct sess *sp)
sctx
=
sp
->
wrk
->
sctx
;
sctx
=
sp
->
wrk
->
sctx
;
CHECK_OBJ_NOTNULL
(
sctx
,
STREAM_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
sctx
,
STREAM_CTX_MAGIC
);
if
(
sp
->
wrk
->
res_mode
&
RES_GUNZIP
)
{
if
(
sp
->
wrk
->
res_mode
&
RES_GUNZIP
&&
sctx
->
obuf_ptr
>
0
)
INCOMPL
();
(
void
)
WRW_Write
(
sp
->
wrk
,
sctx
->
obuf
,
sctx
->
obuf_ptr
);
res_WriteGunzipObj
(
sp
);
}
if
(
sp
->
wrk
->
res_mode
&
RES_CHUNKED
&&
if
(
sp
->
wrk
->
res_mode
&
RES_CHUNKED
&&
!
(
sp
->
wrk
->
res_mode
&
RES_ESI_CHILD
))
!
(
sp
->
wrk
->
res_mode
&
RES_ESI_CHILD
))
WRW_EndChunk
(
sp
->
wrk
);
WRW_EndChunk
(
sp
->
wrk
);
...
...
bin/varnishtest/tests/t00001.vtc
0 → 100644
View file @
fe361cf2
varnishtest "Test stream/gunzip"
server s1 {
rxreq
expect req.url == "/bar"
txresp -body "foobar"
rxreq
expect req.url == "/bla"
expect req.http.accept-encoding == "gzip"
txresp -gzipbody blablabla
rxreq
expect req.url == "/foo"
txresp -body "snafu"
rxreq
expect req.url == "/barf"
expect req.http.accept-encoding == "gzip"
txresp -gzipbody Iamoutofnonsensewords
} -start
varnish v1 -vcl+backend {
sub vcl_fetch {
if (req.url == "/foo") {
set beresp.do_gzip = true;
}
if (req.url == "/barf") {
set beresp.do_gunzip = true;
}
set beresp.do_stream = true;
}
} -start
client c1 {
txreq -url /bar
rxresp
expect resp.bodylen == 6
txreq -url /bla
rxresp
expect resp.bodylen == 9
txreq -url /foo
rxresp
expect resp.bodylen == 5
txreq -url /barf
rxresp
expect resp.bodylen == 21
} -run
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