#include "httpd.h"    
#include "http_config.h"    
#include "http_request.h"    
#include "http_protocol.h"    
#include "http_core.h"    
#include "http_main.h"   
#include "http_log.h"    
 
/*   
 * C version of chapter 7's Apache::AnonProxy
 */   
  
/*   
 * configure like so:  
 *   
 * LoadModule anonproxy_module modules/mod_anonproxy.so  
 *
 */

static char *Remove[] = {
    "user-agent", "cookie", "from", "referer", NULL 
};

static int anonproxy_handler(request_rec *r)
{
    int i;

    if (!r->proxyreq) {
	return DECLINED;
    }

    for (i=0; Remove[i]; i++) {
	ap_table_unset(r->headers_in, Remove[i]);
    }

    return OK;
}

module MODULE_VAR_EXPORT anonproxy_module = {
    STANDARD_MODULE_STUFF, 
    NULL,                  /* module initializer                  */
    NULL,                  /* create per-dir    config structures */
    NULL,                  /* merge  per-dir    config structures */
    NULL,                  /* create per-server config structures */
    NULL,                  /* merge  per-server config structures */
    NULL,                  /* table of config file commands       */
    NULL,                  /* [#8] MIME-typed-dispatched handlers */
    NULL,                  /* [#1] URI to filename translation    */
    NULL,                  /* [#4] validate user id from request  */
    NULL,                  /* [#5] check if the user is ok _here_ */
    NULL,                  /* [#3] check access by host address   */
    NULL,                  /* [#6] determine MIME type            */
    NULL,                  /* [#7] pre-run fixups                 */
    NULL,                  /* [#9] log a transaction              */
    anonproxy_handler,     /* [#2] header parser                  */
    NULL,                  /* child_init                          */
    NULL,                  /* child_exit                          */
    NULL                   /* [#0] post read-request              */
};

