quick start on writing a module?
mh at pixar.com
Wed Jun 16 13:29:43 MSD 2010
I'd like to convert an apache module I've written to work
under nginx. Can somebody loan me a clue for getting started?
The logic is pretty simple:
1. based on the input URI, determine what file will be
sent. this will possibly involved a (cached) db lookup.
2a. set these headers:
X-mod_asset-version: (my custom header)
2b. set mime type.
3. allow nginx to send the bytes of the file. Hopefully
it will handle these headers:
For 2b, this is the proper way?
r->headers_out.content_type.len = sizeof("image/gif") - 1;
r->headers_out.content_type.data = (u_char *) "image/gif";
Is there a special way to malloc the .data so that it
will be freed automatically when the request is complete?
For 3, should I be using X-Accel-Redirect?
If so, then I can simply set my headers and pass along to the next
Any simple example modules I can use as a starting point?
Pixar Animation Studios
More information about the nginx