Great! this fix the problem thanks for your help.
On Wed, Aug 15, 2012 at 10:47 PM, Ben Noordhuis <i...@bnoordhuis.nl> wrote: > On Wed, Aug 15, 2012 at 5:13 PM, nik600 <nik...@gmail.com> wrote: >> Dear all >> >> i'm having a problem with ap_md5, i just want to write a custom module >> that compute che md5 checksum of the requested url and give it back to >> the user. >> >> This is my code: >> ***************************************************************** >> ***************************************************************** >> static int kcache_handler(request_rec* r) >> { >> if (!r->handler || strcmp(r->handler, "kcache")) >> return DECLINED; >> >> if (r->method_number != M_GET) >> return HTTP_METHOD_NOT_ALLOWED; >> >> char* kcache_md5; >> kcache_md5 = (char *)ap_md5(r->pool,r->unparsed_uri); >> >> ap_set_content_type(r, "text/html;charset=ascii"); >> ap_rputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\">", r); >> ap_rputs("<html><head><title>K-Hello World!</title></head>", r); >> ap_rprintf(r,"<body><h1>K-Hello >> World!</h1><p>%s=%s</p></body></html>", r->unparsed_uri,kcache_md5); >> return OK; >> } >> ***************************************************************** >> ***************************************************************** >> >> i've got a warning during compilation: >> >> src/mod_kcache.c:18:15: warning: cast to pointer from integer of >> different size [-Wint-to-pointer-cast] >> >> Is quite strange to me that ap_md5 returns an int, as in the >> documentation it is reported to return a char * >> >> http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__MD5.html >> >> By the way, if i try to run it i get a segfault, if i comment the line >> that prints kcache_md5 with ap_rprintf the module doesn't segfault. >> >> So, where i'm wrong? > > It seems you don't include util_md5.h so the compiler defaults the > function prototype to `int ap_md5()`. Compile with -Wall -Wextra and > you'll get warnings about things like that. -- /*************/ nik600 http://www.kumbe.it