Ä¿ÇÇÇâÀÌ ³ª´Â *NIX
Ä¿ÇǴнº
½Ã½ºÅÛ/³×Æ®¿÷/º¸¾ÈÀ» ´Ù·ç´Â °÷
*
HanIRCÀÇ #coffeenix ¹æ
[
Àåºñ ¹× ȸ¼± ÈÄ¿ø
]
> Forum <
IT ÀÏÁ¤
N
e
w
!
ÀÚµ¿È ÇÁ·ÎÁ§Æ®
HOME
>
³×Æ®¿öÅ©(network)
>
À¥ ¼¹ö(web, httpd, apache)
µµ¿ò¸»
°Ë»ö :
»çÀÌÆ®
WHOIS
À¥¼¹ö Á¾·ù
WebDAV
(7, ±Û 1, ÀÚ·á 4)
À¥¼¹ö Æ©´×
(5, ±Û 4, ÀÚ·á 2)
À¥¼¹ö »ç¿ë Åë°è ÀÚ·á
(2, ÀÚ·á 1)
Apache SSL / mod_ssl
(4, ±Û 3, ÀÚ·á 2)
HTTP 1.1ÀÇ Content Length¿Í Transfer Encoding
ÀÛ¼ºÀÏ : 2005/12/04 04:29
±Û¾´ÀÌ : ÁÁÀºÁøÈ£ (
http://coffeenix.net/
)
Á¶È¸¼ö : 41426
[
ÀÌÀüȸé
/
¼öÁ¤
] ºñ¹Ð¹øÈ£ :
Á¦ ¸ñ : HTTP 1.1ÀÇ Content Length¿Í Transfer Encoding
ÀÛ¼ºÀÚ : ÁÁÀºÁøÈ£(truefeel,
http://coffeenix.net/
)
ÀÛ¼ºÀÏ : 2005.12.2~3(±Ý~Åä)
HTTP 1.1 ¿¡¼´Â Ä¿³Ø¼ÇÀÌ ²÷¾îÁöÁö ¾Ê°í À¯ÁöµÇ´Â Keep Alive connection(persistent connection)
À» Áö¿øÇÑ´Ù. apache ¿¡¼ httpd.conf ¿¡ Keepalive onÀ¸·Î ¼³Á¤Çϸé Keep alive connectionÀ» Áö¿ø
ÇÏ°Ô µÈ´Ù.
À¥ÆäÀÌÁö¸¦ °¡Á®¿À´Â ÇÁ·Î±×·¥À» ¸¸µé ¶§(php¿¡¼ fsockopenÀ» »ç¿ëÇÏ´Â °æ¿ìµµ)¸¦ »ý°¢Çغ¸ÀÚ.
ÇϳªÀÇ Ä¿³Ø¼ÇÀÌ °è¼Ó À¯ÁöµÈ »óŶó¸é Á¤È®ÇÑ º»¹®ÀÇ ³»¿ëÀÌ ¾îµð±îÁöÀÎÁö, ±×¸®°í ±æÀÌ´Â ¾ó¸¶ÀÎÁö
¾î¶»°Ô È®ÀÎÇؾßÇÒ±î? ¶ÇÇÑ connection closeÇüÅ·Π¿äûÀ» ÇÏ´õ¶óµµ HTTP 1.1¿¡¼´Â º»¹®³»¿ëÀ»
chunked enconig(ÀÌ°Ô ¹ºÁö´Â ±Û Áß°£¿¡ ¼³¸íÇÑ´Ù.) Çü½ÄÀ¸·Î Ç¥½ÃÇÏ´Â °æ¿ìµµ ÀÖ´Ù.
ÀÌ·± °Íó·³ HTTP 1.1·Î ¿äûÀ» ÇÒ ¶§´Â Content LengthÇì´õ·Î Ç¥½ÃµÇ´Â °æ¿ì¿Í chunked encoding
À» »ç¿ëÇÏ´Â °æ¿ì µî 2°¡Áö response Çü½ÄÀ» Àß ±¸ºÐÇؼ ó¸®ÇØÁÖ¾î¾ß ÇÑ´Ù.
1. Content Length Çì´õ¸¦ º¸¿©ÁÖ´Â °æ¿ì
$
telnet coffeenix.net 80
Trying 211.xxx.xxx.xx...
Connected to coffeenix.net (211.xxx.xxx.xx).
Escape character is '^]'.
GET /truefeel/files/mail_log.pl.txt HTTP/1.1 <-- HTTP/1.1 ÇüÅ·Π¿äû
Host: coffeenix.net
Connection: close
<-- ¿äû ÈÄ Á¢¼ÓÀ» ¹Ù·Î ²÷À½
HTTP/1.1 200 OK <-- ¿©±â ºÎÅÍ´Â ¼¹öÀÇ ÀÀ´ä
Date: Sat, 03 Dec 2005 15:10:17 GMT <-- RFC 1123À» µû¸£´Â ³¯Â¥ Ç¥½Ã
Server: Secured <-- À¥¼¹ö¸í ^^
Last-Modified: Sun, 18 Jan 2004 20:26:49 GMT
ETag: "64151-7dc-400aec09"
Accept-Ranges: bytes
Content-Length: 2012 <--
contentsÀÇ ±æÀÌ. 2012bytes
Connection: close
Content-Type: text/plain
#!/usr/bin/perl <-- ¿©±â ºÎÅÍ´Â contents
#
# procmailÀ» ÅëÇØ ³Ñ°Ü¿Â ¸ÞÀÏ ¼ö½Å Á¤º¸¸¦ DB·Î.
#
... »ý·« ...
Connection closed by foreign host.
ÇÑ°¡Áö ´õ º¸ÀÚ. ¾Æ·¡¿Í °°ÀÌ ¿äûÇϸé connectionÀº °è¼Ó À¯ÁöµÈ »óÅ·ΠÀÖ°Ô µÈ´Ù.
$
telnet www.cyworld.nate.com 80
Trying 211.115.11.30...
Connected to www.cyworld.nate.com (211.115.11.30).
Escape character is '^]'.
GET /main2/index.htm HTTP/1.1 <-- HTTP/1.1 ÇüÅ·Π¿äû
Host: www.cyworld.nate.com
HTTP/1.1 200 OK <-- ¿©±â ºÎÅÍ´Â ¼¹öÀÇ ÀÀ´ä
Cache-Control: max-age=31536000
Content-Length: 162368 <--
contentsÀÇ ±æÀÌ. 162368bytes
Content-Type: text/html
Last-Modified: Sat, 03 Dec 2005 14:58:50 GMT
Accept-Ranges: bytes
ETag: "fee1c0111af8c51:d63"
Server: Microsoft-IIS/6.0
Date: Sat, 03 Dec 2005 15:24:06 GMT
À§Ã³·³ 'Content-Length' Çì´õ°¡ ÀÖ´Ù¸é bodyºÎºÐ¿¡¼ ÇØ´ç ±æÀ̸¸Å¸¸ ¹Þ¾Æ¿À°í, closeÇÏ¸é µÈ´Ù.
2. Transfer Encoding Çì´õ (Chunked enconding ¹æ½Ä)
Chunked encondingÀº php³ª CGIµî¿¡¼ ÁÖ·Î »ç¿ëÇϸç, Çì´õ¿¡´Â Transfer-Encoding: chunked°¡
Ç¥½ÃµÇ°í, º»¹®Àº chunk size+³»¿ë+chunk size+³»¿ë... Çü½ÄÀ¸·Î Ç¥½ÃµÈ´Ù.
$
telnet coffeenix.net 80
Trying 211.xxx.xxx.xx...
Connected to coffeenix.net (211.xxx.xxx.xx).
Escape character is '^]'.
GET / HTTP/1.1 <-- HTTP/1.1 ÇüÅ·Π¿äû
Host: coffeenix.net
HTTP/1.1 200 OK <-- ¿©±â ºÎÅÍ´Â ¼¹öÀÇ ÀÀ´ä
Date: Sat, 03 Dec 2005 16:29:25 GMT
Server: Secured
Transfer-Encoding: chunked <-- chunked encoding
Content-Type: text/html
e22 <-- chunked µÈ size. 16Áø¼ö·Î Ç¥½ÃµÇ¸ç, bytes ´ÜÀ§
... ³»¿ë ... <-- ÇØ´ç e22(3618 bytes) ±æÀÌÀÇ contents
192 <-- 16Áø¼ö 192
... ³»¿ë ... <-- 192(402 bytes) ±æÀÌÀÇ contents
f76
... ³»¿ë ...
101
... ÀÌÇÏ »ý·« ..
0 <-- ³¡À» Ç¥½ÃÇÑ´Ù
º¸´Ù Á¤È®ÇÏ°Ô º¸ÀÚ¸é chunk size+CRLF¹®ÀÚ(CRLF´Â ASCIIÄÚµå 16Áø¼ö·Î 0d0a)°¡ Ç¥½ÃµÇ°í,
³»¿ë+CRLF¹®ÀÚ°¡ ¿À´Â ÇüÅ°¡ ¹Ýº¹µÇ¸ç 0+CRLF¹®ÀÚ·Î ¸¶¹«¸®¸¦ ÇÑ´Ù.
µû¶ó¼ À¥ÆäÀÌÁö Àоî¿Ã ¶§´Â óÀ½ chunk size¸¦ ¾Ë¾Æ³½ ÈÄ ÇØ´ç ±æÀ̸¸Å ³»¿ëÀ» ºÐ¸®ÇÏ°í
´Ù½Ã chunk sizeÀ» È®ÀÎ, ³»¿ë ºÐ¸®ÇÏ´Â °úÁ¤À» ¹Ýº¹ÇÑ ÈÄ ³»¿ë¸¸ ÇÕÄ¡´Â °úÁ¤ÀÌ ÇÊ¿äÇÏ´Ù.
3. php¿¡¼ Content-Length Çì´õ »ç¿ë
À©µµÀÇ ÀÀ¿ëÇÁ·Î±×·¥°ú php·Î µÈ À¥ÆäÀÌÁö°£ÀÇ Åë½ÅÀÌ ÇÊ¿äÇÑ °æ¿ì chunked encodingµÈ ÆäÀÌÁö
º¸´Ù´Â Content-Length Çì´õ¸¦ µû¸£µµ·Ï Çϸé ÀÀ¿ë ÇÁ·Î±×·¥ÂÊ °³¹ßÀÌ º¸´Ù ½¬¿öÁú °ÍÀÌ´Ù.
ÀÌó·³ ÇÊ¿äÇÑ ÆäÀÌÁö¸¸ Content-Length Çì´õ°¡ Ç¥½ÃÇÏ°í ½Í´Ù¸é php¿¡¼ Ãâ·Â ¹öÆÛ¸µÀ» »ç¿ëÇϵµ·Ï
ÇÏ¸é µÈ´Ù. php ½ÃÀÛ¿¡ ob_start()¸¦ ³Ö°í ¸¶Áö¸·¿¡ ob_end_flush()¸¦ »ç¿ëÇÏ¸é ±× »çÀÌ¿¡ Ãâ·ÂµÇ´Â
¸ðµç ³»¿ëÀ» ¹öÆÛ¿¡ ½×¾Æ µÐ ÈÄ ¸¶Áö¸·¿¡ Ãâ·ÂÀ» ÇÏ°Ô µÈ´Ù.
¹°·Ð ¹öÆÛ¿¡ ÀúÀåµÈ ³»¿ë ±æÀ̸¦ ÆľÇÇÑ ÈÄ Content-Length: Çì´õ¸¦ »Ñ·ÁÁÖ´Â °Íµµ ÀØÁö ¸»ÀÚ.
< ?
ob_start();
... ÇÁ·Î±×·¥ ÄÚµå ...
... HTML ...
$length=ob_get_length();
header("Content-Length: $length");
ob_end_flush();
?>
4. Âü°í ÀÚ·á
* Content Length & Transfer Encoding
http://www.simtec.ltd.uk/httpgallery/chunked/
* HTTP/1.1Ç¥ÁØ(¾È) (±è¿ë¿î ¿ª)
http://coffeenix.net/doc/network/http11.txt
* php ob_start() function
http://kr.php.net/manual/kr/function.ob-start.php
Ä¿ÇǴнº Ä«Æä ÃÖ±Ù ±Û
[04/25]
±¹°¡
[04/24]
º¸Çè
[04/22]
Re: OpenSSL Ãë¾àÁ¡ Á¤¸®, Logjam(·Î±×Àë)¿¡¼ Heartbleed±îÁö
[04/21]
LET¡¯S START WITH ON
[04/21]
º¸Çè
[04/20]
Á¦ÁÖ
[04/20]
±¹³»
[04/19]
Á¦ÁÖ
[04/18]
??? ?????
[04/17]
???? onion ?????? -
[04/11]
±¹°¡
[04/10]
Stride Into Dream:
[03/20]
Re: ¿Â¶óÀΰÔÀÓÀÇ Á¾ÁÖ±¹ ´ëÇѹα¹
[10/20]
Cross Compiler ±ò
[07/14]
SSL ¬¡¬°
N
e
w
! ÃÖ±Ù¿¡ µî·ÏÇÑ ÆäÀÌÁö
KiCad EDA Suite project (Free/Libre/Open-Source EDA Suite) (CAD)
¿ÀÇÂij½ºÄÉÀ̵å ijµå (OpenCASCADE CAD)
QCad for Windows --- GNU GPL (Free Software)
The Hello World Collection
IPMI¸¦ È°¿ëÇÑ ¸®´ª½º ¼¹ö°ü¸®
DNS ¼³Á¤ °Ë»ç
nagiosgraph ¼³Ä¡ ¹æ¹ý
Slony-I ¼³Ä¡ ¹æ¹ý (postgresql replication tool)
Qmail±â¹ÝÀÇ Anti spam ½Ã½ºÅÛ ±¸ÃàÇϱâ
clusterssh
[ ÇÔ²²ÇÏ´Â »çÀÌÆ® ]
¿î¿µÁø :
ÁÁÀºÁøÈ£(truefeel)
, ¾ß¼ö(yasu), ¹ü³ÃÀÌ, sCag
2003³â 8¿ù 4ÀÏ~