Buffers of zero size and filter module
Daniel Fiala
danfiala at centrum.cz
Wed Jul 25 20:06:37 UTC 2012
Hi all.
I try to implement a bit more complicated filter module for Nginx.
Because of this I study source codes of existing http modules. I have to
allocate my own buffers for filtered data, I cannot change supplied buffers
in place.
I have been surprised, that it is necessary to handle buffers of zero size
in special way.
For example, in ngx_http_charset_filter_module.c is the following code:
if (ngx_buf_size(b) == 0) {
*ll = ngx_alloc_chain_link(r->pool);
if (*ll == NULL) {
return NGX_ERROR;
}
(*ll)->buf = b;
(*ll)->next = NULL;
ll = &(*ll)->next;
continue;
}
My questions are:
* Can such buffers of zero size really appear?
* Is the number of buffers of zero size small? As I understand, memory of
the chain-link is not recycled until the http request is not fully
processed.
Thanks.
Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20120725/ad358fb3/attachment.html>
More information about the nginx-devel
mailing list