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
4b9ac086
Commit
4b9ac086
authored
Apr 11, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a "hole-through" path that does the trivial bit of streaming.
Now for all the hard bits...
parent
cf7c641f
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
96 additions
and
7 deletions
+96
-7
cache.h
bin/varnishd/cache.h
+4
-0
cache_fetch.c
bin/varnishd/cache_fetch.c
+2
-0
cache_gzip.c
bin/varnishd/cache_gzip.c
+6
-0
cache_response.c
bin/varnishd/cache_response.c
+29
-6
README
bin/varnishtest/tests/README
+5
-1
t00000.vtc
bin/varnishtest/tests/t00000.vtc
+50
-0
No files found.
bin/varnishd/cache.h
View file @
4b9ac086
...
@@ -312,6 +312,9 @@ struct worker {
...
@@ -312,6 +312,9 @@ struct worker {
unsigned
do_close
;
unsigned
do_close
;
char
*
h_content_length
;
char
*
h_content_length
;
/* Stream state */
ssize_t
stream_next
;
/* ESI stuff */
/* ESI stuff */
struct
vep_state
*
vep
;
struct
vep_state
*
vep
;
int
gzip_resp
;
int
gzip_resp
;
...
@@ -858,6 +861,7 @@ void RES_BuildHttp(struct sess *sp);
...
@@ -858,6 +861,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
);
/* 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_fetch.c
View file @
4b9ac086
...
@@ -102,6 +102,8 @@ vfp_nop_bytes(struct sess *sp, struct http_conn *htc, ssize_t bytes)
...
@@ -102,6 +102,8 @@ vfp_nop_bytes(struct sess *sp, struct http_conn *htc, ssize_t bytes)
st
->
len
+=
w
;
st
->
len
+=
w
;
sp
->
obj
->
len
+=
w
;
sp
->
obj
->
len
+=
w
;
bytes
-=
w
;
bytes
-=
w
;
if
(
sp
->
wrk
->
do_stream
)
RES_StreamPoll
(
sp
);
}
}
return
(
1
);
return
(
1
);
}
}
...
...
bin/varnishd/cache_gzip.c
View file @
4b9ac086
...
@@ -477,6 +477,8 @@ vfp_gunzip_bytes(struct sess *sp, struct http_conn *htc, ssize_t bytes)
...
@@ -477,6 +477,8 @@ vfp_gunzip_bytes(struct sess *sp, struct http_conn *htc, ssize_t bytes)
i
=
VGZ_Gunzip
(
vg
,
&
dp
,
&
dl
);
i
=
VGZ_Gunzip
(
vg
,
&
dp
,
&
dl
);
assert
(
i
==
VGZ_OK
||
i
==
VGZ_END
);
assert
(
i
==
VGZ_OK
||
i
==
VGZ_END
);
sp
->
obj
->
len
+=
dl
;
sp
->
obj
->
len
+=
dl
;
if
(
sp
->
wrk
->
do_stream
)
RES_StreamPoll
(
sp
);
}
}
if
(
i
==
Z_OK
||
i
==
Z_STREAM_END
)
if
(
i
==
Z_OK
||
i
==
Z_STREAM_END
)
return
(
1
);
return
(
1
);
...
@@ -547,6 +549,8 @@ vfp_gzip_bytes(struct sess *sp, struct http_conn *htc, ssize_t bytes)
...
@@ -547,6 +549,8 @@ vfp_gzip_bytes(struct sess *sp, struct http_conn *htc, ssize_t bytes)
i
=
VGZ_Gzip
(
vg
,
&
dp
,
&
dl
,
VGZ_NORMAL
);
i
=
VGZ_Gzip
(
vg
,
&
dp
,
&
dl
,
VGZ_NORMAL
);
assert
(
i
==
Z_OK
);
assert
(
i
==
Z_OK
);
sp
->
obj
->
len
+=
dl
;
sp
->
obj
->
len
+=
dl
;
if
(
sp
->
wrk
->
do_stream
)
RES_StreamPoll
(
sp
);
}
}
return
(
1
);
return
(
1
);
}
}
...
@@ -623,6 +627,8 @@ vfp_testgzip_bytes(struct sess *sp, struct http_conn *htc, ssize_t bytes)
...
@@ -623,6 +627,8 @@ vfp_testgzip_bytes(struct sess *sp, struct http_conn *htc, ssize_t bytes)
VGZ_Ibuf
(
vg
,
st
->
ptr
+
st
->
len
,
w
);
VGZ_Ibuf
(
vg
,
st
->
ptr
+
st
->
len
,
w
);
st
->
len
+=
w
;
st
->
len
+=
w
;
sp
->
obj
->
len
+=
w
;
sp
->
obj
->
len
+=
w
;
if
(
sp
->
wrk
->
do_stream
)
RES_StreamPoll
(
sp
);
while
(
!
VGZ_IbufEmpty
(
vg
))
{
while
(
!
VGZ_IbufEmpty
(
vg
))
{
VGZ_Obuf
(
vg
,
ibuf
,
sizeof
ibuf
);
VGZ_Obuf
(
vg
,
ibuf
,
sizeof
ibuf
);
...
...
bin/varnishd/cache_response.c
View file @
4b9ac086
...
@@ -270,7 +270,7 @@ res_WriteGunzipObj(struct sess *sp)
...
@@ -270,7 +270,7 @@ res_WriteGunzipObj(struct sess *sp)
}
}
if
(
obufl
)
{
if
(
obufl
)
{
(
void
)
WRW_Write
(
sp
->
wrk
,
obuf
,
obufl
);
(
void
)
WRW_Write
(
sp
->
wrk
,
obuf
,
obufl
);
WRW_Flush
(
sp
->
wrk
);
(
void
)
WRW_Flush
(
sp
->
wrk
);
}
}
VGZ_Destroy
(
&
vg
);
VGZ_Destroy
(
&
vg
);
assert
(
u
==
sp
->
obj
->
len
);
assert
(
u
==
sp
->
obj
->
len
);
...
@@ -413,19 +413,42 @@ RES_StreamStart(struct sess *sp)
...
@@ -413,19 +413,42 @@ RES_StreamStart(struct sess *sp)
if
(
sp
->
wrk
->
res_mode
&
RES_CHUNKED
)
if
(
sp
->
wrk
->
res_mode
&
RES_CHUNKED
)
WRW_Chunked
(
sp
->
wrk
);
WRW_Chunked
(
sp
->
wrk
);
sp
->
wrk
->
stream_next
=
0
;
}
void
RES_StreamPoll
(
const
struct
sess
*
sp
)
{
struct
storage
*
st
;
ssize_t
l
,
l2
;
void
*
ptr
;
if
(
sp
->
obj
->
len
==
sp
->
wrk
->
stream_next
)
return
;
assert
(
sp
->
obj
->
len
>
sp
->
wrk
->
stream_next
);
l
=
0
;
VTAILQ_FOREACH
(
st
,
&
sp
->
obj
->
store
,
list
)
{
if
(
st
->
len
+
l
<=
sp
->
wrk
->
stream_next
)
{
l
+=
st
->
len
;
continue
;
}
l2
=
st
->
len
+
l
-
sp
->
wrk
->
stream_next
;
ptr
=
st
->
ptr
+
(
sp
->
wrk
->
stream_next
-
l
);
(
void
)
WRW_Write
(
sp
->
wrk
,
ptr
,
l2
);
l
+=
st
->
len
;
sp
->
wrk
->
stream_next
+=
l2
;
}
(
void
)
WRW_Flush
(
sp
->
wrk
);
}
}
void
void
RES_StreamEnd
(
struct
sess
*
sp
)
RES_StreamEnd
(
struct
sess
*
sp
)
{
{
ssize_t
low
,
high
;
if
(
sp
->
wrk
->
res_mode
&
RES_GUNZIP
)
{
if
(
sp
->
wrk
->
res_mode
&
RES_GUNZIP
)
{
INCOMPL
();
res_WriteGunzipObj
(
sp
);
res_WriteGunzipObj
(
sp
);
}
else
{
low
=
0
;
high
=
sp
->
obj
->
len
-
1
;
res_WriteDirObj
(
sp
,
low
,
high
);
}
}
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
))
...
...
bin/varnishtest/tests/README
View file @
4b9ac086
...
@@ -15,10 +15,14 @@ Naming scheme
...
@@ -15,10 +15,14 @@ Naming scheme
[id]%05d.vtc
[id]%05d.vtc
id ~ [a] --> varnishtest
er
(1) tests
id ~ [a] --> varnishtest(1) tests
id ~ [b] --> Basic functionality tests
id ~ [b] --> Basic functionality tests
id ~ [c] --> Complex functionality tests
id ~ [c] --> Complex functionality tests
id ~ [e] --> ESI tests
id ~ [e] --> ESI tests
id ~ [g] --> GZIP tests
id ~ [m] --> VMOD tests
id ~ [p] --> Persistent tests
id ~ [r] --> Regression tests, same number as ticket
id ~ [r] --> Regression tests, same number as ticket
id ~ [s] --> Slow tests, expiry, grace etc.
id ~ [s] --> Slow tests, expiry, grace etc.
id ~ [t] --> sTreaming tests
id ~ [v] --> VCL tests: execute VRT functions
id ~ [v] --> VCL tests: execute VRT functions
bin/varnishtest/tests/t00000.vtc
0 → 100644
View file @
4b9ac086
# $Id$
test "Ticket #873"
server s1 {
rxreq
txresp -nolen -hdr "Transfer-encoding: chunked"
chunked "<1>------------------------<1>\n"
sema r1 sync 2
chunked "<2>------------------------<2>\n"
sema r2 sync 2
chunked "<3>------------------------<3>\n"
sema r1 sync 2
chunked "<4>------------------------<4>\n"
sema r2 sync 2
chunkedlen 0
} -start
varnish v1 -vcl+backend {
sub vcl_fetch {
set beresp.do_stream = true;
}
} -start
varnish v1 -cliok "param.set diag_bitmap 1"
client c1 {
txreq -hdr "foo: /foo"
rxresp -no_obj
rxchunk
expect resp.chunklen == 31
sema r1 sync 2
rxchunk
expect resp.chunklen == 31
sema r2 sync 2
rxchunk
expect resp.chunklen == 31
sema r1 sync 2
rxchunk
expect resp.chunklen == 31
sema r2 sync 2
rxchunk
expect resp.chunklen == 0
expect resp.bodylen == 124
} -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