Maxim Dounin
January 25, 2011 07:58AM
Hello!

On Tue, Jan 25, 2011 at 03:34:21AM -0500, michalkraus wrote:

> Thanks,
> I have already read this recommendation in another topic. But
> headers_more_module can modify header_in.headers and I wanted to do it

The fact that some third-party module does this doesn't mean that
it's correct.

> as well. I will just modify headers_out and I will provide the cookie as
> a variable and use proxy_set_header. So I will avoid SIGSEGV.
> One more question about reading value of a variable in my module. I have
> output as variable $ap_filter_gsid from my module and I need to get the
> value in another handler module.
>
> Code in my module seems like:
>
> { ngx_string("ap_filter_sessionid"),
> NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
> ngx_conf_set_str_slot,
> NGX_HTTP_LOC_CONF_OFFSET,
> offsetof(ngx_http_ap_filter_loc_conf_t, sessionid),
> NULL },
>
> There is string "$ap_filter_gsid" in the variable sessionid in
> ngx_http_ap_filter_loc_conf_t struct and not the read value of the
> variable. I need the same for reading $arg_u from query string. I went
> through some module codes and I found out that I should write my
> function instead of ngx_conf_set_str_slot directive. I tried to write
> it, but it has never worked. What should be in this function.

Yes, to allow variable expansion you should take care of it. For
single variable you may use ngx_http_get_variable_index() during
configuration and ngx_http_get_indexed_variable() at runtime.

If you want to allow arbitrary mix of static strings and variables -
you may want to use complex values instead. It's probably easiest
interface, too, as there is generic configuration handler
ngx_http_set_complex_value_slot available. At runtime use
ngx_http_complex_value() to obtain expanded value.

Maxim Dounin

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

Add new cookie into headers_in

michalkraus January 24, 2011 10:07AM

Re: Add new cookie into headers_in

Maxim Dounin January 24, 2011 10:40AM

Re: Add new cookie into headers_in

michalkraus January 25, 2011 03:34AM

Re: Add new cookie into headers_in

Maxim Dounin January 25, 2011 07:58AM

Re: Add new cookie into headers_in

agentzh January 25, 2011 11:38PM

Re: Add new cookie into headers_in

agentzh January 25, 2011 11:50PM

Re: Add new cookie into headers_in

agentzh January 25, 2011 11:56PM

Re: Add new cookie into headers_in

michalkraus January 26, 2011 02:08AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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