On 02/11/2019 11.00, Ervin Hegedüs wrote:
Hi,
this is just a theoretical question: is there any way to test/use
an Apache module without Apache?n
Hello,
AFAIK no, but I didn't research it much.
There are however best practices that try to come as close as possible
to a "reasonable" degree of confidence in your code.
You can separate your code in an application-dependent,
apache-independent library on one hand and a generic,
application-independent, apache-dependent glue code on the other hand
and then you can test only the apache-independent library and "have
faith" in your glue code.
The apache-independent library must not refer to ap_* functions. So no
ap_hook_*, ap_register_*_filter, ap_get|pass_brigade, ap_log_*,
ap_rwrite, ap_rputs, ap_rprintf and many many other functions in your
application-specific and apache-independent lib.
Your application-specific lib may however use the data structures of
apache (request_rec, server_rec, ap_filter_t) and of libapr (apr_tables,
apr_pools etc). It's your responsibility however to initialize them in
your test code, outside your lib. You cannot rely on ap_read_request for
instance in order to initialize your request_rec structure.
HTH,
Sorin