Postings by eeadev dev

how to free memory allocated using apr_palloc() - C Apache module

As written in the subject, is there a way to deallocate memory which has
been allocated using apr_palloc() and what is the best practice to do that?

thank you

how to run one module before another

How can I decide the order of two module or at least having one always
running before another one?


header out working in local apache but not on development environment

I used this apache C function

* apr_table_addn(r->err_headers_out , "Remote-Proxy-User",
I can see the result in my chrome dev tool when I use it in an apache
running locally but It does not work in the development environment.
what could be the reason?
Thank you

Module per crypt/decrypt using base64 coding

HI all,

is there a module that does it? I want to see its source code?


how to include ssl lib when running apxs

I am compiling my apache c module using this

sudo apxs -i -a -c mod_ex.c

now I need to use the lib openssl

what should I use to include this lib,

I tried with adding this option:

-I /usr/include/openssl

but it still seems that it does find some function.

Please how shall I do to include it?

Where does ap_rprintf actually print out?

Writing an apache C module I tried this function:

<a href="" title=""></a>

but I dont know where it does print out. Does it in any specific file?

I called it this way:

ap_rprintf(r, "print out!");
and checked in the error.log nor in the access.log

how to exit a C Apache module

I tried with the C exit() but it returns a page with this content:

*The connection was resetThe connection to the server was reset while the
page was loading. The site could be temporarily unavailable or too busy.
Try again in a few moments. If you are unable to load any pages, check
your computer’s network connection. If your computer or network is
protected by a firewall or proxy, make sure that Firefox is permitted to
access the Web.*

What should I use instead for exiting my module without doing anything else?

thank you

how to deploy custom C modules on Apache

I created my custom module starting from an existing module source code;
now I need to deploy it in the development environment and later on the
test environment.

Please I need to know the steps to do that.

what should I do other than

1) launching this command:

/usr/bin/apxs2 -i -n mymod

2) configuring conf and load files and adding the proper <Location> tag

3) enable the module and restart apache

how to get the expiration date of a cookie

I cannot find a place where is written how to get the expiration date of
the cookie I set.
Please anyone knows how to do that?


how to simply set a cookie?

I tried with this function


but I am not seeing the cookie I set when querying my website in chrome dev
tool under application->storage->Cookies


how to externally redirect?

how can I redirect externally from my module?

for instance under certain condition I need to go to <a href="" title=""></a>

I saw this api
char *new_uri, request_rec

setting getting variable to be changed in production and read in my C module

I have to write a set of variable to be read from my C module. Those
variable could be change when the code is in production, similar to what u
would write in a java properties file.

What is the proper way to do it and which functions to use?

1. write the in the httpd.conf (what is the API for getting/setting a
var visible in all the apache web server)
2. write them in the [module].conf (what is the API for getting/setting
a var visible in all my module)

how to get apr_pool_t when need to call ap_md5

In my function I need to get the checksum using md5.

I saw that there is this function ap_md5(apr_pool_t *a, const unsigned char

but it needs apr_pool_t

how can I get it?

char key[] = "abc";

key_md5 = ap_md5(mem_pool, key);