Commit 4f17a119 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

If the backend sends content-length header and streaming does

not gunzip, send content-length to client rather than chunked.

This makes progress-bars possible in browsers.
parent 4e7def9f
......@@ -166,7 +166,8 @@ cnt_prepresp(struct sess *sp)
sp->wrk->res_mode = 0;
if (!sp->wrk->do_stream)
if (!sp->wrk->do_stream ||
(sp->wrk->h_content_length != NULL && !sp->wrk->do_gunzip))
sp->wrk->res_mode |= RES_LEN;
if (!sp->disable_esi && sp->obj->esidata != NULL) {
......
......@@ -410,6 +410,11 @@ RES_StreamStart(struct sess *sp)
if (sp->wrk->res_mode & RES_GUNZIP)
http_Unset(sp->wrk->resp, H_Content_Encoding);
if (!(sp->wrk->res_mode & RES_CHUNKED) &&
sp->wrk->h_content_length != NULL)
http_PrintfHeader(sp->wrk, sp->fd, sp->wrk->resp,
"Content-Length: %s", sp->wrk->h_content_length);
sp->acct_tmp.hdrbytes +=
http_Write(sp->wrk, sp->wrk->resp, 1);
......
......@@ -36,6 +36,7 @@ varnish v1 -vcl+backend {
client c1 {
txreq -url /bar
rxresp
expect resp.http.content-length == 6
expect resp.bodylen == 6
txreq -url /bla
rxresp
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment