Hi,
There is a way to do this, it would involve having the request variables changed
apr_table_set(rec->subprocess_env, "KEY_OF_MY_DATA", data);

where the second argument would be the key you intend to pass and thirdbeing 
its contents, you will also need to ensure APR_HOOK_MIDDLE is given to the 
passerand APR_HOOK_LAST is given to the recipient,
you can receive this in the same way using an apr_table_get/2

> Date: Sat, 9 May 2015 19:40:54 +0300
> Subject: Share data between apache modules
> From: eugene.tesle...@gmail.com
> To: modules-dev@httpd.apache.org
> 
> Hi!
> 
> I'm trying to pass data from one module to another within a single request.
> But after the first module writes data into r->notes table, the second one
> reads only (null) from it.
> Example.
> 
> mod_a (in the handler function):
> apr_table_setn(r->notes, "test-var", "test-string");
> ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "mod_a: r->notes[test-var]=%s",
> (char *)apr_table_get(r->notes,"test-var"));
> 
> mod_b (in the log_transaction function):
> ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "mod_b: r->notes[test-var]=%s",
> (char *)apr_table_get(r->notes,"test-var"));
> 
> And I got the following lines in the log:
> mod_a: r->notes[test-var]=test-string
> mod_b: r->notes[test-var]=(null)
> 
> Is there any way to pass it?
> 
> Thanks!
                                          

Reply via email to