Gzip Gunzip: always flush busy bufs when the incoming chain is NULL.

Yichun Zhang (agentzh) agentzh at gmail.com
Mon Nov 10 22:25:12 UTC 2014


On Wed, Nov 5, 2014 at 5:08 PM, Yichun Zhang (agentzh) wrote:
> Sorry again, it actually checked "c->buffered &
> NGX_HTTP_LOWLEVEL_BUFFERED". This condition is indeed too strong and
> I've made it check its own busy bufs instead.

Hmm, the problem here is more complicated than I originally thought.
It seems that I still need to ensure that *all* the pending data has
been indeed flushed into the system send buffer in some special cases,
for example, in case of cosockets, I need to ensure that the response
header has indeed been flushed into the system send buffer
*completely* before proceeding to write to the socket directly.

The solution I end up with is like this: if the content handler has
its own busy bufs, then it uses NULL chain to flush the output
filters; otherwise construct a "special buf" with ->flush set to 1,
and feed it into the output filters. It seems to work quite well :)


More information about the nginx-devel mailing list