« 2007年04月 | メイン | 2007年06月 »

2007年05月28日

正規表現 エスケープしなければいけない文字

正規表現 エスケープしなければいけない文字
. ^ $ [ ] * + ? | ( )

こんだけ

投稿者 muuming : 14:28 | コメント (0)

URLエンコード

「a~z」「A~Z」「0~9」「'」「.」「-」「*」「)」「(」「_」

 これらの文字は、エンコードが不要な文字である。これら以外の文字は、「%22」(「"」の場合)や「%e3%81%82」(「あ」の場合)*のように、その文字の文字コードを16進数文字列に変換し、2けたごとに「%」を付けた形式に変換される。ただし例外的に、半角スペースは「+」に変換される。

つまり エンコード後は
「a~z」「A~Z」「0~9」「'」「.」「-」「*」「)」「(」「_」「+」「%」
が使用される。

投稿者 muuming : 14:09 | コメント (0)

2007年05月15日

アパッチモジュールつくり

あぱっちのモジュールを作ってみよう!

1、テンプレートの出力
  #/usr/local/apache/bin/apxs -g -n hoge
Creating [DIR] hoge
Creating [FILE] hoge/Makefile
Creating [FILE] hoge/mod_hoge.c
2つのファイルが出来ます。

2、コンパイル
   コンパイルは 
    apxs -c mod_hoge.c
   にてOK

   コンパイルと同時に modules ディレクトリにコピー
     apxs -c -i mod_hoge.c

   自動的にhttpd.conf に組み込む場合は
   apxs -c -i -a mod_hoge.c

※ちなみに今回のテンプレートの中身は
-------------------------------------------------------------------
/* The sample content handler */
static int hoge_handler(request_rec *r)
{
r->content_type = "text/html";
ap_send_http_header(r);
if (!r->header_only)
ap_rputs("The sample page from mod_hoge.c\n", r);
return OK;
}

/* Dispatch list of content handlers */
static const handler_rec hoge_handlers[] = {
{ "hoge", hoge_handler },
{ NULL, NULL }
};
-----------------------------------------------------------------------------

となっており
.htaccess などで

   SetHandler hoge

などとして ハンドラ?に hogeをセットしてあげると
The sample page from mod_hoge.c がHTML表示されます。


static int uri_handler(request_rec *r)
{
r->content_type = "text/html";
ap_send_http_header(r);
if (r->header_only)
return OK;

ap_rputs("oo
",r);
ap_rprintf(r,"url: %s",r->uri);
return OK;

}

投稿者 muuming : 15:26 | コメント (0)