static int hw_handle_req(request_rec* r)
{
    const char* ua;
    if(strcmp(r->handler, "hw") != 0)
        return DECLINED;
    ua = apr_table_get (r->headers_in, "User-Agent");
    if (!ua || !*ua) ua = "No User Agent.";
    r->content_type = "text/html";
    ap_rputs  (    "<HTML><HEAD><TITLE>Hi!</TITLE></HEAD><BODY>\n" , r );
    ap_rprintf( r, "<P>%s <br>Using Browser: %s</P>\n", greeting, ua );
    ap_rputs  (    "</BODY></HTML>\n", r );
    return OK;
}

Example 4: Apache 2.0 response handler.

Back to Article