Welcome! Log In Create A New Profile

Advanced

Buffers of zero size and filter module

July 25, 2012 04:08PM
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
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Buffers of zero size and filter module

Hagrid 1688 July 25, 2012 04:08PM

Re: Buffers of zero size and filter module

Valentin V. Bartenev 627 July 25, 2012 05:30PM

Re: Buffers of zero size and filter module

Hagrid 939 July 27, 2012 02:54AM

Re: Buffers of zero size and filter module

Valentin V. Bartenev 688 July 27, 2012 10:02AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 119
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready