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)

    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);
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 *

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?

Thanks to all in advance


Reply via email to