apache module 小例
来源:互联网 发布:lhgdialog.js 编辑:程序博客网 时间:2024/06/05 18:55
/** * 编译后 * 在 httpd.conf 文件中添加 * * * LoadModule access_ctl_module modules/libmod_access_ctl.so * * * * */#include <assert.h>#include "apr_getopt.h"#include <unistd.h>#include <stdlib.h>#include <stdio.h>#include <string.h>#include <errno.h>#include <sys/types.h>#include <sys/ipc.h>#include <sys/shm.h>#include <openssl/ssl.h>#include <openssl/x509.h>#include <openssl/ossl_typ.h>#include <openssl/asn1.h>#include "httpd.h"#include "http_config.h"#include "http_request.h"#include "http_protocol.h"#include "http_core.h"#include "mod_ssl.h"#include "util_md5.h"#include "scoreboard.h"#define FORB_ERROR_PAGE "http://www.zggo.com/"/** * void ap_send_response() * request_rec *r:请求 * char *str_url: 错误页面URL * */static void ap_send_response(request_rec *r, char *str_url){apr_table_setn(r->headers_out, "Http", "302");apr_table_setn(r->headers_out, "Location", str_url); r->status = HTTP_TEMPORARY_REDIRECT; ap_send_error_response(r, 0);ap_update_child_status(r->connection->sbh, SERVER_IDLE_KILL, r);ap_run_log_transaction(r);r->connection->aborted= 0; }static void goto_error(request_rec *r){ if (r->main)r->main->connection->aborted=0; ap_send_response(r, FORB_ERROR_PAGE); }static int mod_access_ctl_method_handler (request_rec *r){ goto_error(r); //fflush(stderr); return DECLINED;}/* * This function is a callback and it declares what other functions * should be called for request processing and configuration requests. * This callback function declares the Handlers for other events. */static void mod_access_ctl_register_hooks (apr_pool_t *p){// I think this is the call to make to register a handler for method calls (GET PUT et. al.).// We will ask to be last so that the comment has a higher tendency to// go at the end.ap_hook_handler(mod_access_ctl_method_handler, NULL, NULL, APR_HOOK_REALLY_FIRST);}/* * Declare and populate the module's data structure. The * name of this structure ('tut1_module') is important - it * must match the name of the module. This structure is the * only "glue" between the httpd core and the module. */module AP_MODULE_DECLARE_DATA access_ctl_module ={// Only one callback function is provided. Real// modules will need to declare callback functions for// server/directory configuration, configuration merging// and other tasks.STANDARD20_MODULE_STUFF,NULL,NULL,NULL,NULL,NULL,mod_access_ctl_register_hooks,/* callback for registering hooks */};
保存为 mod_access_ctl.c 编译apxs -c -i -a mod_access_ctl.c
-c 编译 -i 复制文件到apache的modules目录 -a 添加LoadModule到httpd,conf
- apache module 小例
- Apache Module简单一例
- Apache Module: CustomLog
- Apache module limitipconn2
- apache module list
- svn + apache module 备忘
- apache httpd module 笔记
- About module struct in Apache
- apache及其module的调试
- apache url_rewrite module 安装/配置
- Apache Module编程总结1
- apache module rewrite 参数详解
- c apache module 开发入门
- APACHE MPM Multi process module
- Fastdfs-apache-module结合使用
- install mod_auth_digest module in apache
- Install Apache with URL rewrite module
- PHP5 Installation: Installing as an Apache module
- Amoeba:分布式数据库Proxy解决方案
- 招蚊子
- UltraEdit脚本小例
- 微软中文版开发工具座谈会散记
- dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem. E: _cache->open() failed, please repo
- apache module 小例
- rect
- 敏捷软件开发模型--SCRUM
- tree
- 汉字编码转换&#38738;
- 做企业是一个系统工程,不是一点论
- php 文件列表打包小工具
- 什么是dojo
- 蓄势,以求日后惊天之举