I want to have mod_cgi export stderr to specially-registered output filters.... (then if a cgi app writes to stderr, all stdout output could be replaced with a "cgibomb report" or do something else.)
My first guess to do this is to load stderr into a bucket brigade, copy it into a ctx record, then register the 3rd party module output filter with this special ctx structure. Lengthy description: 3rd party module calls a special OPTIONAL function: cgi_register_output_and_stderr_filter("myname", runme, NULL, AP_FTYPE_CONTENT); That in turn updates a linked list inside mod_cgi... (it adds "myname" and runme to it). When a cgi app is run in mod_cgi, mod_cgi puts stderr into a brigade. creates a ctx structure and copies the stderr brigade to this ctx. foreach name in the linked list, run ap_register_output_filter()...passing this special ctx structure and the other data the 3rd party module passed. Then at request-finish time, all ctx's and bucket_brigades will be freed by mod_cgi. Is this the correct way ?