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
2eae6679
Commit
2eae6679
authored
Apr 11, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make range-stuff 4GB+ compliant
Start streaming response code
parent
e6b43a53
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
6 deletions
+64
-6
cache.h
bin/varnishd/cache.h
+2
-0
cache_center.c
bin/varnishd/cache_center.c
+14
-1
cache_response.c
bin/varnishd/cache_response.c
+48
-5
No files found.
bin/varnishd/cache.h
View file @
2eae6679
...
...
@@ -856,6 +856,8 @@ void WSL_Flush(struct worker *w, int overflow);
/* cache_response.c */
void
RES_BuildHttp
(
struct
sess
*
sp
);
void
RES_WriteObj
(
struct
sess
*
sp
);
void
RES_StreamStart
(
struct
sess
*
sp
);
void
RES_StreamEnd
(
struct
sess
*
sp
);
/* cache_vary.c */
struct
vsb
*
VRY_Create
(
const
struct
sess
*
sp
,
const
struct
http
*
hp
);
...
...
bin/varnishd/cache_center.c
View file @
2eae6679
...
...
@@ -709,6 +709,8 @@ cnt_fetchbody(struct sess *sp)
if
(
sp
->
wrk
->
do_esi
)
sp
->
wrk
->
do_stream
=
0
;
if
(
!
sp
->
wantbody
)
sp
->
wrk
->
do_stream
=
0
;
l
=
http_EstimateWS
(
sp
->
wrk
->
beresp
,
pass
?
HTTPH_R_PASS
:
HTTPH_A_INS
,
&
nhttp
);
...
...
@@ -841,6 +843,8 @@ cnt_streambody(struct sess *sp)
{
int
i
;
RES_StreamStart
(
sp
);
/* Use unmodified headers*/
i
=
FetchBody
(
sp
);
...
...
@@ -867,7 +871,16 @@ cnt_streambody(struct sess *sp)
HSH_Unbusy
(
sp
);
}
sp
->
acct_tmp
.
fetch
++
;
sp
->
step
=
STP_DELIVER
;
sp
->
director
=
NULL
;
sp
->
restarts
=
0
;
RES_StreamEnd
(
sp
);
assert
(
WRW_IsReleased
(
sp
->
wrk
));
assert
(
sp
->
wrk
->
wrw
.
ciov
==
sp
->
wrk
->
wrw
.
siov
);
(
void
)
HSH_Deref
(
sp
->
wrk
,
NULL
,
&
sp
->
obj
);
http_Setup
(
sp
->
wrk
->
resp
,
NULL
);
sp
->
step
=
STP_DONE
;
return
(
0
);
}
...
...
bin/varnishd/cache_response.c
View file @
2eae6679
...
...
@@ -125,9 +125,9 @@ res_do_conds(struct sess *sp)
/*--------------------------------------------------------------------*/
static
void
res_dorange
(
struct
sess
*
sp
,
const
char
*
r
,
unsigned
*
plow
,
unsigned
*
phigh
)
res_dorange
(
struct
sess
*
sp
,
const
char
*
r
,
ssize_t
*
plow
,
ssize_t
*
phigh
)
{
unsigned
low
,
high
,
has_low
;
ssize_t
low
,
high
,
has_low
;
(
void
)
sp
;
if
(
strncmp
(
r
,
"bytes="
,
6
))
...
...
@@ -176,11 +176,12 @@ res_dorange(struct sess *sp, const char *r, unsigned *plow, unsigned *phigh)
return
;
http_PrintfHeader
(
sp
->
wrk
,
sp
->
fd
,
sp
->
wrk
->
resp
,
"Content-Range: bytes %u-%u/%u"
,
low
,
high
,
sp
->
obj
->
len
);
"Content-Range: bytes %jd-%jd/%jd"
,
(
intmax_t
)
low
,
(
intmax_t
)
high
,
(
intmax_t
)
sp
->
obj
->
len
);
http_Unset
(
sp
->
wrk
->
resp
,
H_Content_Length
);
assert
(
sp
->
wrk
->
res_mode
&
RES_LEN
);
http_PrintfHeader
(
sp
->
wrk
,
sp
->
fd
,
sp
->
wrk
->
resp
,
"Content-Length: %
u"
,
1
+
high
-
low
);
"Content-Length: %
jd"
,
(
intmax_t
)(
1
+
high
-
low
)
);
http_SetResp
(
sp
->
wrk
->
resp
,
"HTTP/1.1"
,
206
,
"Partial Content"
);
*
plow
=
low
;
...
...
@@ -337,7 +338,7 @@ void
RES_WriteObj
(
struct
sess
*
sp
)
{
char
*
r
;
unsigned
low
,
high
;
ssize_t
low
,
high
;
CHECK_OBJ_NOTNULL
(
sp
,
SESS_MAGIC
);
...
...
@@ -390,3 +391,45 @@ RES_WriteObj(struct sess *sp)
if
(
WRW_FlushRelease
(
sp
->
wrk
))
vca_close_session
(
sp
,
"remote closed"
);
}
/*--------------------------------------------------------------------*/
void
RES_StreamStart
(
struct
sess
*
sp
)
{
AZ
(
sp
->
wrk
->
res_mode
&
RES_ESI_CHILD
);
AN
(
sp
->
wantbody
);
WRW_Reserve
(
sp
->
wrk
,
&
sp
->
fd
);
/*
* Always remove C-E if client don't grok it
*/
if
(
sp
->
wrk
->
res_mode
&
RES_GUNZIP
)
http_Unset
(
sp
->
wrk
->
resp
,
H_Content_Encoding
);
sp
->
acct_tmp
.
hdrbytes
+=
http_Write
(
sp
->
wrk
,
sp
->
wrk
->
resp
,
1
);
if
(
sp
->
wrk
->
res_mode
&
RES_CHUNKED
)
WRW_Chunked
(
sp
->
wrk
);
}
void
RES_StreamEnd
(
struct
sess
*
sp
)
{
ssize_t
low
,
high
;
if
(
sp
->
wrk
->
res_mode
&
RES_GUNZIP
)
{
res_WriteGunzipObj
(
sp
);
}
else
{
low
=
0
;
high
=
sp
->
obj
->
len
-
1
;
res_WriteDirObj
(
sp
,
low
,
high
);
}
if
(
sp
->
wrk
->
res_mode
&
RES_CHUNKED
&&
!
(
sp
->
wrk
->
res_mode
&
RES_ESI_CHILD
))
WRW_EndChunk
(
sp
->
wrk
);
if
(
WRW_FlushRelease
(
sp
->
wrk
))
vca_close_session
(
sp
,
"remote closed"
);
}
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