Response with mixed file + generated contents
Adrian Perez de Castro
adrianperez at udc.es
Thu Sep 6 22:28:40 MSD 2007
El Thu, 06 Sep 2007 09:52:54 -0700
Evan Miller <emmiller at gmail.com> escribió:
> Adrian Perez de Castro wrote:
> > Hello to all,
> >
> > First of all, I will introduce myself: my name is Adrian and I work
> > for the Free Software Office of the University of A Coruña (Spain).
> > As part of our tasks here, we are maintaining a mirror of several
> > open source projects (http://ftp.udc.es, also by ftp and rsync),
> > which we are planning to migrate from Apache to Nginx.
> >
> > I am currently working on a replacement for the autoindex module
> > (currently named fancyindex) which outputs XHTML tables instead of a
> > big <pre> element. Also, it supports embedding a "readme" file
> > (currently using an <iframe>, which is useful to embed full HTML
> > documents inside the gerated indexes, but I am planning to add
> > inline support as well), and finally I would like to implement
> > configurable headers and footers for the listings.
> >
> > After a quick read on the server's code, I would like to know a bit
> > more about how the output chain gets sent to the client, because I
> > would like to do the following when custom header/footer are
> > enabled instead of the builtin ones:
> >
> > 1. Send custom header: Fill in a ngx_buf_t with the details of the
> > header file.
> >
> > 2. Generate XHTML table with file listing, in a memory buffer as
> > autoindex does (and as I am doing right now). Chain it as next
> > buffer of the one created in (1).
> >
> > 3. Send custom footer: Fill in a ngx_buf_t with the details of the
> > footer file. Chain it as next buffer of the one created (2).
> >
> > Currently, for the buffers created in steps (1) and (3) I am filling
> > "buffer->file" with the file info values, setting "buffer->last" to
> > the length of the file and "buffer->in_file" to 1.
>
> You probably want to do a subrequest to include #1 and #3 instead.
> Check out the
> addition_filter module:
>
> http://www.riceonfire.org/lxr/http/source/http/modules/ngx_http_addition_filter_module.c
>
> This way the header and footer can be a file on disk or on a remote
> server.
Nice, indeed!
> If you haven't come across it already, you might find my guide to
> Nginx module
> development useful:
>
> http://www.riceonfire.org/emiller/nginx-modules-guide.html
I found it some days ago following the links from the wiki, it helped
me a lot to get started with config directives, building the module and
some other bits I learnt from it. I think your tutorial is the kind of
document which makes people forget about their fear to something and
start tinkering with it.
> When you're finished with it, please be sure to add your module to
> the Nginx wiki:
>
> http://wiki.codemongers.com/NginxModules
I will do :D
> Good luck!
Thanks. All the comments and ideas are welcome,
--
Adrian Perez de Castro <adrianperez at udc.es>
Oficina de Software Libre http://softwarelibre.udc.es
Universidade da Coruña http://www.udc.es
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://nginx.org/pipermail/nginx/attachments/20070906/7198a861/attachment.pgp>
More information about the nginx
mailing list