XSLT2 - new module, reviews and opinions needed :)

piotreek nginx-forum at nginx.us
Thu Oct 15 17:49:45 MSD 2009


Many thanks for your comments!

Ad 1. You're right. We changed the code style and now it should be consistent and similar to Nginx style. ;)

Ad 2. This is interesting. We've thought about using an upstream, what is more, we've tried to do it. ;) However, our module allows to download simultaneously a lot of files, when upstream allows to download only one per one request. Am I wrong? Is it possible to download simultaneously a few files using upstream?

When it comes to gethostbyname - ofc you're right again, we will think about this. ;) Any suggestions?

Ad 3.  Right, corrected.

Ad 4. This is interesting too. I’ve changed code by adding just “r->count++;”  and removing “r->buffered = 1;” and it seems to work. Independently of value returned from body_filter function. When it returns NGX_OK it works, when it returns NGX_DONE after last chain - it works too... What should be returned?

Furthermore, is it all about r->count? Just increment it and forget? Only way to learn that mechanism is reading source code of Nginx? Is it described anywhere? We’ve tried to look for information about asynchronous work of filters, but we haven’t found anything except existing modules and their source code. ;)

New version of code with r->count is available at sourceforge SVN: http://xxslt.svn.sourceforge.net/viewvc/xxslt/http/modules/xslt2/ngx_http_xslt2_filter_module.c?view=markup

5. One more thing – collecting data from incoming buffer chains. I’ve seen in other modules (for example in xslt) strange way to collect all buffers and process them after getting the last one. You have to copy the content, set in->buf->pos = in->buf->last (that isn’t intuitive  ;)) and return NGX_OK from body_filter for each buffer chain. Is it only way to do it? 

This has an important disadvantage – we can’t keep pointers to that buffers, because their content is changed by nginx later. We’ve tried to set some flags in buffers with no interesting result. ;)

We would like to collect pointers to buffers, don’t copy their content and in some cases – return original, unmodified buffer chains after obtaining the last buffer chain (= after reading whole incoming data). Can we do it without copying all of them?

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,13577,13971#msg-13971






More information about the nginx mailing list