Apache HTTP Server Version 2.5
¼³¸í: | ÀÀ´ä ³»¿ëÀ» ¿ÜºÎ ÇÁ·Î±×·¥À¸·Î ó¸®ÇÑ ÈÄ Å¬¶óÀ̾ðÆ®·Î º¸³½´Ù |
---|---|
»óÅÂ: | Extension |
¸ðµâ¸í: | ext_filter_module |
¼Ò½ºÆÄÀÏ: | mod_ext_filter.c |
mod_ext_filter
¸¦ »ç¿ëÇÏ¸é °£´ÜÇÏ°í Àͼ÷ÇÑ
¹æ¹ýÀ¸·Î ÇÊÅ͸¦ ¸¸µé ¼ö ÀÖ´Ù.
Ç¥ÁØÀԷ¿¡¼ Àаí Ç¥ÁØÃâ·Â¿¡ ¾²´Â ÇÁ·Î±×·¥(Áï, À¯´Ð½º½Ä
ÇÊÅÍ ¸í·É¾î)À» ¾ÆÆÄÄ¡ ÇÊÅÍ·Î »ç¿ëÇÒ ¼ö ÀÖ´Ù. ÀÌ·± ÇÊÅÍ´Â
¾ÆÆÄÄ¡ API·Î ¾²¿©Áö°í ¾ÆÆÄÄ¡ ¼¹ö ÇÁ·Î¼¼½º ¾È¿¡¼ ½ÇÇàµÇ´Â
ÇÊÅÍ¿¡ ºñÇØ ¸Å¿ì ´À¸®Áö¸¸, ´ÙÀ½°ú °°Àº ÀåÁ¡ÀÌ ÀÖ´Ù:
½ÇÁ¦ »ç¿ëÇϱ⿡´Â ¼º´ÉÀÌ ¶³¾îÁöÁö¸¸,
mod_ext_filter
¸¦ »ç¿ëÇÏ¿© ÇÊÅ͸¦ »¡¸® ¸¸µé¾îº¼
¼ö ÀÖ´Ù.
# mod_ext_filter Áö½Ã¾î¸¦ °¡Áö°í
# ¿ÜºÎ ÇÁ·Î±×·¥ /usr/bin/enscript¸¦ »ç¿ëÇÏ¿©
# ¹®¼ÆÄÀÏ°ú text/c ÆÄÀÏÀ» HTML·Î ¸¸µé°í °á°úÀÇ
# typeÀ» text/html·Î º¯°æÇÏ´Â ÇÊÅ͸¦ Á¤ÀÇÇÑ´Ù
ExtFilterDefine c-to-html mode=output \
intype=text/c outtype=text/html \
cmd="/usr/bin/enscript --color -W html -Ec -o - -"
<Directory "/export/home/trawick/apacheinst/htdocs/c">
# Ãâ·Â¿¡ »õ·Î¿î ÇÊÅ͸¦ ½ÇÇàÇÏ´Â core Áö½Ã¾î
SetOutputFilter c-to-html
# .c ÆÄÀÏÀÇ typeÀ» text/c·Î ¸¸µå´Â mod_mime
# Áö½Ã¾î
AddType text/c .c
# µð¹ö±× ¼öÁØÀ» ³ô¿©¼ ¿äû¸¶´Ù ÇöÀç ¼³Á¤À»
# ¾Ë·ÁÁÖ´Â ·Î±×¹®À» ±â·ÏÇÏ´Â mod_ext_filter
# Áö½Ã¾î
ExtFilterOptions DebugLevel=1
</Directory>
Note: ¾Æ·¡ gzip ¿¹Á¦´Â ´ÜÁö ¼³¸íÀ» ¿¹·Î µç °ÍÀÌ´Ù.
½ÇÁ¦ ¼ºñ½º¿¡ »ç¿ëÇÏ·Á¸é mod_deflate
¸¦
Âü°íÇÏ±æ ¹Ù¶õ´Ù.
# ¿ÜºÎ ÇÊÅ͸¦ Á¤ÀÇÇÏ´Â mod_ext_filter Áö½Ã¾î
ExtFilterDefine gzip mode=output cmd=/bin/gzip
<Location /gzipped>
# Ãâ·ÂÇÒ¶§ gzip ÇÊÅ͸¦ ½ÇÇàÇÏ´Â core Áö½Ã¾î
SetOutputFilter gzip
# "Content-Encoding: gzip" Çì´õ¸¦ Ãß°¡ÇÏ´Â
# mod_header Áö½Ã¾î
Header set Content-Encoding gzip
</Location>
# catÀ¸·Î ¸ðµç ³»¿ëÀ» Åë°úÇÏ´Â ÇÊÅ͸¦ Á¤ÀÇÇÏ´Â
# mod_ext_filter Áö½Ã¾î; catÀº ¾Æ¹«°Íµµ ¼öÁ¤ÇÏÁö
# ¾Ê´Â´Ù; ´ÜÁö 󸮰æ·Î¸¦ ±æ°Ô ÇÏ¿© ÀÚ¿øÀ» ´õ ¼Ò¸ðÇÑ´Ù
ExtFilterDefine slowdown mode=output cmd=/bin/cat \
preservescontentlength
<Location />
# Ãâ·ÂÇÒ¶§ slowdown ÇÊÅ͸¦ ¿©·¯¹ø ½ÇÇàÇÏ´Â core Áö½Ã¾î
#
SetOutputFilter slowdown;slowdown;slowdown
</Location>
# ÀÀ´ä¿¡¼ ±ÛÀ» ´ëüÇÏ´Â ÇÊÅ͸¦ Á¤ÀÇÇÏ´Â
# mod_ext_filter Áö½Ã¾î
#
ExtFilterDefine fixtext mode=output intype=text/html \
cmd="/bin/sed s/verdana/arial/g"
<Location />
# Ãâ·ÂÇÒ¶§ fixtext ÇÊÅ͸¦ ½ÇÇàÇÏ´Â core Áö½Ã¾î
SetOutputFilter fixtext
</Location>
# ¾ÐÃà ¹®Á¦°¡ Àִ ƯÁ¤ Ŭ¶óÀ̾ðÆ®(IP 192.168.1.31)¿¡
# ´ëÇØ mod_deflate°¡ ÀÐ°í ¾²´Â ÀڷḦ ÃßÀûÇÑ´Ù.
# ÀÌ ÇÊÅÍ´Â mod_deflate·Î º¸³»±â Àü ÀڷḦ ÃßÀûÇÑ´Ù.
ExtFilterDefine tracebefore \
cmd="/bin/tracefilter.pl /tmp/tracebefore" \
EnableEnv=trace_this_client
# ÀÌ ÇÊÅÍ´Â mod_deflate¿¡¼ ³ª¿À´Â ÀڷḦ ÃßÀûÇÑ´Ù.
# ftype ÆĶó¹ÌÅ͸¦ »ç¿ëÇÏÁö¾Ê´Â °æ¿ì, ±âº» ÇÊÅÍÇü
# AP_FTYPE_RESOURCE´Â ÇÊÅÍ ¼ø¼¸¦ mod_deflate *ÀÌÀü¿¡*
# µÐ´Ù. AP_FTYPE_CONTENT_SET º¸´Ù Á¶±Ý ³ôÀº ¼ýÀÚ°ªÀ»
# ÁöÁ¤Çϸé mod_deflate ÀÌÈÄ¿¡ ½ÇÇàÇÑ´Ù.
ExtFilterDefine traceafter \
cmd="/bin/tracefilter.pl /tmp/traceafter" \
EnableEnv=trace_this_client ftype=21
<Directory /usr/local/docs>
SetEnvIf Remote_Addr 192.168.1.31 trace_this_client
SetOutputFilter tracebefore;deflate;traceafter
</Directory>
#!/usr/local/bin/perl -w
use strict;
open(SAVE, ">$ARGV[0]")
or die "can't open $ARGV[0]: $?";
while (<STDIN>) {
print SAVE $_;
print $_;
}
close(SAVE);
¼³¸í: | ¿ÜºÎ ÇÊÅ͸¦ Á¤ÀÇÇÑ´Ù |
---|---|
¹®¹ý: | ExtFilterDefine filtername parameters |
»ç¿ëÀå¼Ò: | ÁÖ¼¹ö¼³Á¤ |
»óÅÂ: | Extension |
¸ðµâ: | mod_ext_filter |
ExtFilterDefine
Áö½Ã¾î´Â ¿ÜºÎ
ÇÊÅÍÀÇ ¼ºÁú°ú ½ÇÇàÇÒ ÇÁ·Î±×·¥, ¾Æ±Ô¸ÕÆ®¸¦ Á¤ÀÇÇÑ´Ù.
filternameÀº Á¤ÀÇÇÒ ÇÊÅÍ À̸§À» ÁöÁ¤ÇÑ´Ù. ÀÌ À̸§À» SetOutputFilter Áö½Ã¾î¿¡¼ »ç¿ëÇÑ´Ù. µî·ÏÇÑ ¸ðµç ÇÊÅ͵鰣¿¡ À̸§ÀÌ °ãÄ¡¸é ¾ÈµÈ´Ù. ÇöÀç ÇÊÅ͵î·Ï API´Â ¿À·ù¸¦ º¸°íÇÏÁö ¾Ê´Â´Ù. ±×·¡¼ »ç¿ëÀÚ´Â À̸§ÀÌ °ãÄ¡´Â ¹®Á¦¸¦ ¾ËÁö ¸øÇÑ´Ù.
½ÇÇàÇÒ ¿ÜºÎ ¸í·É¾î¿Í ´Ù¸¥ ¼ºÁúÀ» Á¤ÀÇÇÏ´Â ³ª¸ÓÁö ¾Æ±Ô¸ÕÆ®´Â
¾î¶² ¼ø¼·Î ³ª¿Íµµ °¡´ÉÇÏ´Ù. ´Ü, cmd=
ÆĶó¹ÌÅÍ´Â
¹Ýµå½Ã ÇÊ¿äÇÏ´Ù. »ç¿ëÇÒ ¼ö ÀÖ´Â ÆĶó¹ÌÅÍ´Â ´ÙÀ½°ú °°´Ù:
cmd=cmdline
cmd=
Å°¿öµå´Â ½ÇÇàÇÒ ¿ÜºÎ ¸í·É¾î¸¦ ÁöÁ¤ÇÑ´Ù.
ÇÁ·Î±×·¥¸í µÚ¿¡ ¾Æ±Ô¸ÕÆ®°¡ ÀÖ´Ù¸é ¸í·ÉÇàÀ» ½Öµû¿ÈÇ¥·Î
¹¾î¾ß ÇÑ´Ù (¿¹¸¦ µé¾î,
cmd="/bin/mypgm arg1
arg2"
). ½©À» °ÅÄ¡Áö¾Ê°í Á÷Á¢ ÇÁ·Î±×·¥À»
½ÇÇàÇϱ⶧¹®¿¡ ÀϹÝÀûÀÎ ½© µû¿ÈÇ¥´Â ÇÊ¿ä¾ø´Ù. ÇÁ·Î±×·¥
¾Æ±Ô¸ÕÆ®µéÀº °ø¹éÀ¸·Î ±¸ºÐÇÑ´Ù. ÇÁ·Î±×·¥ ¾Æ±Ô¸ÕÆ®¿¡ °ø¹éÀÌ
ÀÖ´Ù¸é °ø¹é ¾Õ¿¡ ¹é½½·¡½¬·Î »ç¿ëÇØ¾ß ÇÑ´Ù. ¹é½½·¡½¬°¡
¾Æ±Ô¸ÕÆ®ÀÇ ÀϺζó¸é ¹é½½·¡½¬¸¦ µÎ¹ø »ç¿ëÇØ¾ß ÇÑ´Ù. ÇÁ·Î±×·¥À»
½ÇÇàÇÒ¶§ Ç¥ÁØ CGI ȯ°æº¯¼ö¿Í Ãß°¡·Î DOCUMENT_URI,
DOCUMENT_PATH_INFO, QUERY_STRING_UNESCAPED º¯¼ö¸¦ ¼³Á¤ÇÑ´Ù.mode=mode
mode=output
À»
»ç¿ëÇÑ´Ù. ¿äûÀ» ó¸®ÇÏ´Â ÇÊÅÍ´Â mode=input
À»
»ç¿ëÇÑ´Ù. mode=input
Àº ¾ÆÆÄÄ¡ 2.1¿¡ Ãß°¡µÇ¾ú´Ù.intype=imt
intype=
À» ÁöÁ¤Çϸé
´Ù¸¥ typeÀÇ ¹®¼´Â ÇÊÅͷΠó¸®ÇÏÁö ¾Ê´Â´Ù.outtype=imt
PreservesContentLength
PreservesContentLength
Å°¿öµå´Â ÇÊÅÍ°¡
content length¸¦ À¯ÁöÇϵµ·Ï ÇÑ´Ù. ´ëºÎºÐÀÇ ÇÊÅÍ°¡ content
length¸¦ º¯°æÇϹǷΠÀÌ Å°¿öµå´Â ±âº»°ªÀÌ ¾Æ´Ï´Ù. ÇÊÅÍ°¡
±æÀ̸¦ À¯ÁöÇÒ¶§¸¸ ÀÌ Å°¿öµå¸¦ »ç¿ëÇØ¾ß ÇÑ´Ù.ftype=filtertype
disableenv=env
enableenv=env
¼³¸í: | mod_ext_filter ¿É¼ÇÀ» ¼³Á¤ÇÑ´Ù |
---|---|
¹®¹ý: | ExtFilterOptions option [option] ... |
±âº»°ª: | ExtFilterOptions DebugLevel=0 NoLogStderr |
»ç¿ëÀå¼Ò: | directory |
»óÅÂ: | Extension |
¸ðµâ: | mod_ext_filter |
ExtFilterOptions
Áö½Ã¾î´Â
mod_ext_filter
ÀÇ Æ¯º°ÇÑ Ã³¸®¿É¼ÇÀ» ÁöÁ¤ÇÑ´Ù.
OptionÀº ´ÙÀ½Áß Çϳª´Ù.
DebugLevel=n
DebugLevel
Å°¿öµå´Â
mod_ext_filter
°¡ ±â·ÏÇÏ´Â µð¹ö±× ¹®±¸
¼öÁØÀ» Á¤ÇÑ´Ù. ±âº»°ªÀº µð¹ö±×¹®À» ±â·ÏÇÏÁö ¾Ê´Â´Ù.
ÀÌ´Â DebugLevel=0
°ú °°´Ù. ³ôÀº ¼ýÀÚ¸¦
»ç¿ëÇÒ¼ö·Ï, ´õ ¸¹Àº µð¹ö±×¹®ÀÌ ±â·ÏµÇ°í ¼¹ö ¼º´ÉÀÌ
¶³¾îÁø´Ù. ¼ýÀÚ°ªÀÇ ½ÇÁ¦ Àǹ̴ mod_ext_filter.c
¾ÕºÎºÐ¿¡ ÀÖ´Â DBGLVL_ »ó¼ö Á¤ÀÇ¿¡ ¼³¸íµÇÀÖ´Ù.
ÁÖÀÇ: ÇÊÅÍ ·Î±×¸¦ ±â·ÏÇÏ·Á¸é core Áö½Ã¾î LogLevel
À» »ç¿ëÇÏ¿© µð¹ö±×¹®À»
¾ÆÆÄÄ¡ ¿À·ù·Î±×¿¡ ±â·ÏÇØ¾ß ÇÑ´Ù.
LogStderr | NoLogStderr
LogStderr
Å°¿öµå´Â ¿ÜºÎ ÇÊÅÍ ÇÁ·Î±×·¥ÀÌ
Ç¥ÁØ¿À·ù·Î Ãâ·ÂÇÏ´Â ¹®±¸¸¦ ¾ÆÆÄÄ¡ ¿À·ù·Î±×¿¡ ±â·ÏÇÑ´Ù.
NoLogStderr
´Â ÀÌ ±â´ÉÀ» ÇÏÁö ¾Ê´Â´Ù.
ExtFilterOptions LogStderr DebugLevel=0
À§ÀÇ ¼³Á¤À» »ç¿ëÇϸé ÇÊÅÍ°¡ Ç¥ÁØ¿À·ù·Î Ãâ·ÂÇÏ´Â ¹®±¸¸¦
¾ÆÆÄÄ¡ ¿À·ù·Î±×¿¡ ±â·ÏÇÏ°í, mod_ext_filter
´Â
ÀÚü µð¹ö±×¹®À» ±â·ÏÇÏÁö ¾Ê´Â´Ù.