Welcome! Log In Create A New Profile

Advanced

Module development question - Variables

Jan Algermissen
August 15, 2013 09:42AM
Hi,

been trying to understand variables for a couple of hours - but I jut don't get it.

Can anyone explain,


1) How and when the variable setter function is called?

2) Whether I should / can call it myelf to set the variable.

Use Case:

I write an access phase filter that extracts a bunch of information from the Authorization header (think OAuth-like: clientId, user, but maybe also debug info about cryptography performance, token expiry, acess ricghts -you get the idea).

I would like to store these per request values in a variable to use them in the access log module to log them.

E.g.:

log_format gzip '$remote_addr - $remote_user $my_module_client, $my_module_infoxy ...'

I think I understand what I have to do to create the variable (create in preconfiguartin handler, provide setter function)

But how is the setter called and how do I access the value to store in the variable?

Should I make the value a static bucket in the module data that is written per request and then copied to the variable in the variable setter???

Existing modules only help a little, as they mostly set variables to values that are part of the request struct anyway - which my values aren't.

Jan

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Module development question - Variables

Jan Algermissen August 15, 2013 09:42AM

Re: Module development question - Variables

Maxim Dounin August 16, 2013 11:32PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 117
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