一个最最简单的apache moudle,给初学着看

 

一个最最简单的apache moudle,给初学着看


/*-------------------------------------------------------------------------------------------------
file: mod_stock.c
author: wyezl
2006.2.10
---------------------------------------------------------------------------------------------------*/

#include "httpd.h"
#include "http_config.h"
#include "http_core.h"
#include "http_log.h"
#include "http_protocol.h"


module MODULE_VAR_EXPORT counter_module;

static void counter_init(server_rec *s, pool *p)
{
    printf("module init........./n");

}


static int counter_handler(request_rec *r)
{
    //ap_rputs("<BODY>/n", r);
    //ap_rprintf(r, "<H1>Hello %s</H1>/n", hostname);
    //r->content_type = "text/html";

    ap_send_http_header(r);
    ap_rputs("key=yang data=jian/n", r);

    return OK;
}

static handler_rec counter_handlers[] =
{
{"counter-handler", counter_handler},
{NULL}
};

module MODULE_VAR_EXPORT counter_module =
{
  STANDARD_MODULE_STUFF,
  counter_init,           /* initializer */
  NULL,               /* dir config creater */
  NULL,               /* dir merger --- default is to override */
  NULL,               /* server config */
  NULL,               /* merge server config */
  NULL,               /* command table */
  counter_handlers,         /* handlers */
  NULL,               /* filename translation */
  NULL,               /* check_user_id */
  NULL,               /* check auth */
  NULL,               /* check access */
  NULL,               /* type_checker */
  NULL,               /* fixups */
  NULL,               /* logger */
  NULL,               /* header parser */
  NULL,               /* child_init */
  NULL,               /* child_exit */
  NULL                 /* post read-request */
};


你可能感兴趣的:(apache,server,header,Module,null,translation)