<-
Apache > HTTP Server > Documentation > Version 2.2 > ¸ðµâ

Please note

This document refers to the 2.2 version of Apache httpd, which is no longer maintained. The active release is documented here. If you have not already upgraded, please follow this link for more information.

You may follow this link to go to the current version of this document.

¾ÆÆÄÄ¡ ¸ðµâ mod_ext_filter

°¡´ÉÇÑ ¾ð¾î:  en  |  ja  |  ko 

ÀÌ ¹®¼­´Â ÃÖ½ÅÆÇ ¹ø¿ªÀÌ ¾Æ´Õ´Ï´Ù. ÃÖ±Ù¿¡ º¯°æµÈ ³»¿ëÀº ¿µ¾î ¹®¼­¸¦ Âü°íÇϼ¼¿ä.
¼³¸í:ÀÀ´ä ³»¿ëÀ» ¿ÜºÎ ÇÁ·Î±×·¥À¸·Î ó¸®ÇÑ ÈÄ Å¬¶óÀ̾ðÆ®·Î º¸³½´Ù
»óÅÂ:Extension
¸ðµâ¸í:ext_filter_module
¼Ò½ºÆÄÀÏ:mod_ext_filter.c

¿ä¾à

mod_ext_filter¸¦ »ç¿ëÇÏ¸é °£´ÜÇÏ°í Àͼ÷ÇÑ ¹æ¹ýÀ¸·Î ÇÊÅ͸¦ ¸¸µé ¼ö ÀÖ´Ù. Ç¥ÁØÀԷ¿¡¼­ Àаí Ç¥ÁØÃâ·Â¿¡ ¾²´Â ÇÁ·Î±×·¥(Áï, À¯´Ð½º½Ä ÇÊÅÍ ¸í·É¾î)À» ¾ÆÆÄÄ¡ ÇÊÅÍ·Î »ç¿ëÇÒ ¼ö ÀÖ´Ù. ÀÌ·± ÇÊÅÍ´Â ¾ÆÆÄÄ¡ API·Î ¾²¿©Áö°í ¾ÆÆÄÄ¡ ¼­¹ö ÇÁ·Î¼¼½º ¾È¿¡¼­ ½ÇÇàµÇ´Â ÇÊÅÍ¿¡ ºñÇØ ¸Å¿ì ´À¸®Áö¸¸, ´ÙÀ½°ú °°Àº ÀåÁ¡ÀÌ ÀÖ´Ù:

½ÇÁ¦ »ç¿ëÇϱ⿡´Â ¼º´ÉÀÌ ¶³¾îÁöÁö¸¸, mod_ext_filter¸¦ »ç¿ëÇÏ¿© ÇÊÅ͸¦ »¡¸® ¸¸µé¾îº¼ ¼ö ÀÖ´Ù.

ÁÖÁ¦

Áö½Ã¾îµé

Âü°í

top

¿¹Á¦

´Ù¸¥ typeÀÇ ÀÀ´äÀ» HTML·Î ¸¸µç´Ù

# 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>

content ÀÎÄÚµù ÇÊÅÍ ±¸ÇöÇϱâ

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>

sed¸¦ »ç¿ëÇÏ¿© ÀÀ´ä¿¡¼­ ±ÛÀ» ´ëüÇϱâ

# ÀÀ´ä¿¡¼­ ±ÛÀ» ´ëüÇÏ´Â ÇÊÅ͸¦ Á¤ÀÇÇÏ´Â
# 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);

top

ExtFilterDefine Áö½Ã¾î

¼³¸í:¿ÜºÎ ÇÊÅ͸¦ Á¤ÀÇÇÑ´Ù
¹®¹ý: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
ÀÌ ÆĶó¹ÌÅÍ´Â ÇÊÅͷΠó¸®ÇÒ ¹®¼­ÀÇ ÀÎÅÍ³Ý media type(Áï, MIME type)À» ÁöÁ¤ÇÑ´Ù. ±âº»ÀûÀ¸·Î ¸ðµç ¹®¼­¸¦ ÇÊÅͷΠó¸®ÇÑ´Ù. intype=À» ÁöÁ¤ÇÏ¸é ´Ù¸¥ typeÀÇ ¹®¼­´Â ÇÊÅͷΠó¸®ÇÏÁö ¾Ê´Â´Ù.
outtype=imt
ÀÌ ÆĶó¹ÌÅÍ´Â ÇÊÅͷΠó¸®ÇÑ ¹®¼­ÀÇ ÀÎÅÍ³Ý media type(Áï, MIME type)À» ÁöÁ¤ÇÑ´Ù. ÇÊÅÍó¸® ÀÛ¾÷Áß¿¡ ÀÎÅÍ³Ý media typeÀ» º¯°æÇÒ¶§ À¯¿ëÇÏ´Ù. ±âº»ÀûÀ¸·Î, ÀÎÅÍ³Ý media typeÀº º¯ÇÏÁö ¾Ê´Â´Ù.
PreservesContentLength
PreservesContentLength Å°¿öµå´Â ÇÊÅÍ°¡ content length¸¦ À¯ÁöÇϵµ·Ï ÇÑ´Ù. ´ëºÎºÐÀÇ ÇÊÅÍ°¡ content length¸¦ º¯°æÇϹǷΠÀÌ Å°¿öµå´Â ±âº»°ªÀÌ ¾Æ´Ï´Ù. ÇÊÅÍ°¡ ±æÀ̸¦ À¯ÁöÇÒ¶§¸¸ ÀÌ Å°¿öµå¸¦ »ç¿ëÇØ¾ß ÇÑ´Ù.
ftype=filtertype
ÀÌ ÆĶó¹ÌÅÍ´Â ÇÊÅÍ Á¾·ù¿¡ ´ëÇÑ ¼ýÀÚ°ªÀ» ÁöÁ¤ÇÑ´Ù. ´ëºÎºÐÀÇ °æ¿ì ±âº»°ªÀÎ AP_FTYPE_RESOURCE°¡ Àû´çÇÏ´Ù. ÇÊÅ͸¦ ½ÇÇàÇÏ´Â ¼ø¼­°¡ ÀÚ¿øÇÊÅÍ¿Í ´Þ¶ó¾ßÇÏ´Â °æ¿ì ÀÌ ÆĶó¹ÌÅÍ°¡ ÇÊ¿äÇÏ´Ù. Àû´çÇÑ °ªÀ» ¾Ë·Á¸é util_filter.h¿¡ ÀÖ´Â AP_FTYPE_* Á¤ÀǸ¦ Âü°íÇ϶ó.
disableenv=env
ÀÌ ÆĶó¹ÌÅÍ·Î ¼³Á¤ÇÑ È¯°æº¯¼ö°¡ Á¤ÀǵǾú´Ù¸é ÇÊÅ͸¦ »ç¿ëÇÏÁö ¾Ê´Â´Ù.
enableenv=env
ÀÌ ÆĶó¹ÌÅÍ·Î ¼³Á¤ÇÑ È¯°æº¯¼ö°¡ Á¤ÀÇµÈ °æ¿ì ÇÊÅ͸¦ »ç¿ëÇÑ´Ù.
top

ExtFilterOptions Áö½Ã¾î

¼³¸í: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´Â ÀÚü µð¹ö±×¹®À» ±â·ÏÇÏÁö ¾Ê´Â´Ù.

°¡´ÉÇÑ ¾ð¾î:  en  |  ja  |  ko 

top

Comments

Notice:
This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Libera.chat, or sent to our mailing lists.