« Linux Kernel 2.6 Local Root Exploit | HOME | Apache API モジュールを作ろう »

Apacheのモジュール作成 API Module

Apache1.3でモジュールの作成に挑戦してみます。

かゆいところに手が届く物は、やっぱり自分で作らなくちゃね!!

と言うことで、NDSで鍛えた英語力でApacheAPIの英語DocumentをGET&なんとなく読む
http://httpd.apache.org/dev/apidoc/
http://httpd.apache.org/docs/2.0/developer/modules.html

http://gnug.nu/index.php?option=com_content&task=view&id=25&Itemid=5
サンプルを物色する。


Apache1.3は下記の場所(Apacheの状態)でフック(処理の横取り)することができる。

module cgi_module = {
STANDARD_MODULE_STUFF,
NULL, /* initializer */
NULL, /* dir config creator */
NULL, /* dir merger --- default is to override */
make_cgi_server_config, /* server config */
merge_cgi_server_config, /* merge server config */
cgi_cmds, /* command table */
cgi_handlers, /* handlers */
translate_scriptalias, /* filename translation */
NULL, /* check_user_id */
NULL, /* check auth */
NULL, /* check access */
type_scriptalias, /* type_checker */
NULL, /* fixups */
NULL, /* logger */
NULL /* header parser */
};

全ての場所で、

FILE *stream2;
stream2 = fopen(LOG_FILE, "ab+");
fwrite("child_exit\n", strlen((char *)"child_exit\n"), 1, stream2);
fclose(stream2);

こんな感じでLOGを吐き出すようにして、Apacheを一通り動かしてみると早く理解できます。

続く・・・・


 

ハワイ旅行| サトピの子連れグアム旅行記| グアム旅行の情報サイト| ガーデニング|

Copyright (C) 2009 Anne Corporation. All Rights Reserved.