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
fdbb6f03
Commit
fdbb6f03
authored
May 02, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a stream_context structure to hold the state for streaming
when we need it.
parent
5d5c3453
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
10 deletions
+42
-10
cache.h
bin/varnishd/cache.h
+16
-2
cache_center.c
bin/varnishd/cache_center.c
+9
-0
cache_response.c
bin/varnishd/cache_response.c
+17
-8
No files found.
bin/varnishd/cache.h
View file @
fdbb6f03
...
...
@@ -247,7 +247,6 @@ struct exp {
/*--------------------------------------------------------------------*/
/* WRW related fields */
struct
wrw
{
int
*
wfd
;
unsigned
werr
;
/* valid after WRK_Flush() */
...
...
@@ -259,6 +258,21 @@ struct wrw {
unsigned
ciov
;
/* Chunked header marker */
};
/*--------------------------------------------------------------------*/
struct
stream_ctx
{
unsigned
magic
;
#define STREAM_CTX_MAGIC 0x8213728b
#if 0
struct vgz *vgz;
void *obuf;
ssize_t obuf_len;
ssize_t obuf_ptr;
#endif
ssize_t
stream_next
;
};
/*--------------------------------------------------------------------*/
struct
worker
{
unsigned
magic
;
#define WORKER_MAGIC 0x6391adcf
...
...
@@ -312,7 +326,7 @@ struct worker {
char
*
h_content_length
;
/* Stream state */
s
size_t
stream_next
;
s
truct
stream_ctx
*
sctx
;
/* ESI stuff */
struct
vep_state
*
vep
;
...
...
bin/varnishd/cache_center.c
View file @
fdbb6f03
...
...
@@ -839,6 +839,13 @@ static int
cnt_streambody
(
struct
sess
*
sp
)
{
int
i
;
struct
stream_ctx
sctx
;
memset
(
&
sctx
,
0
,
sizeof
sctx
);
sctx
.
magic
=
STREAM_CTX_MAGIC
;
AZ
(
sp
->
wrk
->
sctx
);
sp
->
wrk
->
sctx
=
&
sctx
;
RES_StreamStart
(
sp
);
...
...
@@ -854,6 +861,7 @@ cnt_streambody(struct sess *sp)
AN
(
sp
->
director
);
if
(
i
)
{
sp
->
wrk
->
sctx
=
NULL
;
HSH_Drop
(
sp
);
AZ
(
sp
->
obj
);
sp
->
err_code
=
503
;
...
...
@@ -873,6 +881,7 @@ cnt_streambody(struct sess *sp)
RES_StreamEnd
(
sp
);
sp
->
wrk
->
sctx
=
NULL
;
assert
(
WRW_IsReleased
(
sp
->
wrk
));
assert
(
sp
->
wrk
->
wrw
.
ciov
==
sp
->
wrk
->
wrw
.
siov
);
(
void
)
HSH_Deref
(
sp
->
wrk
,
NULL
,
&
sp
->
obj
);
...
...
bin/varnishd/cache_response.c
View file @
fdbb6f03
...
...
@@ -394,6 +394,10 @@ RES_WriteObj(struct sess *sp)
void
RES_StreamStart
(
struct
sess
*
sp
)
{
struct
stream_ctx
*
sctx
;
sctx
=
sp
->
wrk
->
sctx
;
CHECK_OBJ_NOTNULL
(
sctx
,
STREAM_CTX_MAGIC
);
AZ
(
sp
->
wrk
->
res_mode
&
RES_ESI_CHILD
);
AN
(
sp
->
wantbody
);
...
...
@@ -410,31 +414,32 @@ RES_StreamStart(struct sess *sp)
if
(
sp
->
wrk
->
res_mode
&
RES_CHUNKED
)
WRW_Chunked
(
sp
->
wrk
);
sp
->
wrk
->
stream_next
=
0
;
}
void
RES_StreamPoll
(
const
struct
sess
*
sp
)
{
struct
stream_ctx
*
sctx
;
struct
storage
*
st
;
ssize_t
l
,
l2
;
void
*
ptr
;
if
(
sp
->
obj
->
len
==
sp
->
wrk
->
stream_next
)
sctx
=
sp
->
wrk
->
sctx
;
CHECK_OBJ_NOTNULL
(
sctx
,
STREAM_CTX_MAGIC
);
if
(
sp
->
obj
->
len
==
sctx
->
stream_next
)
return
;
assert
(
sp
->
obj
->
len
>
s
p
->
wrk
->
stream_next
);
assert
(
sp
->
obj
->
len
>
s
ctx
->
stream_next
);
l
=
0
;
VTAILQ_FOREACH
(
st
,
&
sp
->
obj
->
store
,
list
)
{
if
(
st
->
len
+
l
<=
s
p
->
wrk
->
stream_next
)
{
if
(
st
->
len
+
l
<=
s
ctx
->
stream_next
)
{
l
+=
st
->
len
;
continue
;
}
l2
=
st
->
len
+
l
-
s
p
->
wrk
->
stream_next
;
ptr
=
st
->
ptr
+
(
s
p
->
wrk
->
stream_next
-
l
);
l2
=
st
->
len
+
l
-
s
ctx
->
stream_next
;
ptr
=
st
->
ptr
+
(
s
ctx
->
stream_next
-
l
);
(
void
)
WRW_Write
(
sp
->
wrk
,
ptr
,
l2
);
l
+=
st
->
len
;
s
p
->
wrk
->
stream_next
+=
l2
;
s
ctx
->
stream_next
+=
l2
;
}
(
void
)
WRW_Flush
(
sp
->
wrk
);
}
...
...
@@ -442,6 +447,10 @@ RES_StreamPoll(const struct sess *sp)
void
RES_StreamEnd
(
struct
sess
*
sp
)
{
struct
stream_ctx
*
sctx
;
sctx
=
sp
->
wrk
->
sctx
;
CHECK_OBJ_NOTNULL
(
sctx
,
STREAM_CTX_MAGIC
);
if
(
sp
->
wrk
->
res_mode
&
RES_GUNZIP
)
{
INCOMPL
();
...
...
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