ã³ã¡ã³ããæè¿ããŸãã
<div class = "chapter" lang = "ru" xmlïŒlang = "ru">
第1ç« HTTP
ã³ã³ãã³ã HTTPèŠæ± HTTPå¿ç HTTPããŒãã¢ã©ã€ã ã䜿çšããæé©åHTTPãã€ãã©ã€ã³ ã䜿çšããæé©åHTTPãã£ãã·ã³ã°ã䜿çšããæé©å ææ°ã®ã¯ã©ã€ã¢ã³ãã§ã® ãã£ãã·ã³ã° åæ€èšŒæŠç¥ ãã£ãã·ã³ã°ãšã€ã³ã¿ã©ã¯ãã£ãããŒãžã®ç¡å¹ åå§çž®ã䜿çšãã æé©åç¹å®ã®æé©åã³ã³ãã³ãã³ã³ãã³ãã® çµã¿åããã¯ã©ã€ã¢ã³ãïŒãã©ãŠã¶ãŸãã¯ããããïŒã¯WebãµãŒããŒãšéä¿¡ããŸã
HTTPãããã³ã«ã䜿çšããŠããŸãã HTTPãšãã®åäœã®çŽ°ããªè©³çŽ°
æè¡ã®äžäœå±€ãšäžäœå±€ãšã®çžäºäœçš-ã®1ã€
é«æ§èœã®éµïŒHTTPã¯Hyper Text Transport Protocolã®ç¥ã§ãã
ãã¡ããããµãŒããŒããã¯ã©ã€ã¢ã³ããžã®è»¢éã ãã§ãªã䜿çšãããŸã
HTMLãã¡ã€ã«ã ãã§ãªãããã®ä»ã®ãªããžã§ã¯ãïŒç»åãã¹ã¯ãªããã
CSSãã¡ã€ã«ãããŒã¿ãã¡ã€ã«ã ãŸããéã«åäœããŸã
ãµã€ã-ãã¡ã€ã«ããµãŒããŒã«ã¢ããããŒããããã©ãŒã ãéä¿¡ãã
ãªã©ãAJAXã¢ããªã±ãŒã·ã§ã³ããæããã«ãµãŒããŒãšéä¿¡ããŸãã
HTTP HTTPãããå ·äœçãªç®çã§äœ¿çšãããããšããããŸããã
ããšãã°ãWebDAVã䜿çšããŠãµãŒããŒã³ã³ãã³ãã管çãã
ãªã©ãHTTPéä¿¡ã¯ãäžé£ã®æç¶çãª
ã¯ã©ã€ã¢ã³ããšãµãŒããŒéã®HTTPãªã¯ãšã¹ããšHTTPã¬ã¹ãã³ã¹<Div class = "sect1" lang = "ru" xmlïŒlang = "ru">
HTTPãªã¯ãšã¹ã
HTTPèŠæ±ã¯ãèŠæ±æååãããããŒãããã³ã¡ãã»ãŒãžæ¬æã ãã¡ã€ã«ãååŸããHTTPãªã¯ãšã¹ãã®äŸã次ã«ç€ºããŸã
www.habrahabr.ru/robots.txt ïŒ
GET /robots.txt HTTP / 1.1 ãã¹ãïŒwww.habrahabr.ru ãŠãŒã¶ãŒãšãŒãžã§ã³ãïŒWget 1.8.3ææ°ã®ãŠã§ãäžã®HTTPãªã¯ãšã¹ãã®å€§éšåã¯
ãããã¯ããªã¯ãšã¹ãããã£ã空ïŒé·ã0ïŒã®GETãªã¯ãšã¹ãã§ãã
ãã®å Žåã¯èŠ³å¯ããŠãã ããã ããšãã°ãPOSTãªã¯ãšã¹ãã®å Žåãæ¬æ
ã»ãšãã©åžžã«ç©ºã§ã¯ãããŸããããªã¯ãšã¹ãã®äŸã詳ãã調ã¹ãŠã¿ãŸãããã ãªã¯ãšã¹ãã®æåã®åèªã¯
GET
ããã¯ãããããæ¹æ³ãã§ã
HTTPãªã¯ãšã¹ãã æãäžè¬çãªæ¹æ³ã¯
GET
GET
ã¡ãœããã¯ãåçŽã«
æå®ãããå Žæã§å©çšå¯èœãªãªã¯ãšã¹ãã³ã³ãã³ãïŒããŒãžãŸãã¯ãã¡ã€ã«ïŒ
URLã éèŠãªèæ ®äºé ã¯ãGETèŠæ±ãã§ããããšã§ã
ãã£ãã·ã¥ãããå¥ã®äžè¬çãªãªã¯ãšã¹ãã¯
POST
ã§ãã
POSTãªã¯ãšã¹ãã«ã¯ãã»ãšãã©ã®å Žåããšã³ã³ãŒãããããªã¯ãšã¹ãæ¬æãå«ãŸããŸã
ç¹å¥ãªåœ¢åŒã®ããããã§ã éåžžãPOSTãªã¯ãšã¹ãã¯
ãŠãŒã¶ãŒã[éä¿¡]ãã¿ã³ãŸãã¯åæ§ã®ãã¿ã³ãã¯ãªãã¯ããçµæãšããŠ
ã¢ã¯ã·ã§ã³
HEAD
ã¡ãœããïŒGETã¡ãœãããã€ããŒïŒã䜿çšãããŸãã
PUT
ãããªãããŸããªã¡ãœããã®ãã¹ã
DELETE
ãšåæ§ã«ãç¹å®ã®ã¡ãœããã®å€§èŠæš¡ãªã»ãã
WebDAVãããã³ã«ã ãããã®è©³çŽ°ã«ã€ããŠã¯ãä»ã®ç« ã
/robots.txt
ãã ãããã¯ãšãªã®2çªç®ã®åèªïŒ
/robots.txt
ããã¯ãåä¿¡ãããããŒãžãŸãã¯ãã¡ã€ã«ã®URLã§ããªã¯ãšã¹ãã®3çªç®ã®åèªã¯
HTTP/1.1
ã§ãã ããã¯
ãããã³ã«ã®å®éã®ååãšããŒãžã§ã³çªå·ã HTTP 1.1
ã»ãšãã©æ®éçã«äœ¿çšãããŸãããäžéšã®äººã«ãšã£ãŠã¯ååã§ã
ç¹å®ã®ç®æšãHTTPã«æ ŒäžãããããšäŸ¿å©ãªå ŽåããããŸã
1.0ã HTTP 1.1ãšHTTP 1.0ã®äž»ãªéãã¯å¿ é ã§ã
ä»®æ³ãã¹ãã®ãµããŒãããã£ãã·ã¥ã®ãµããŒãã®æ¹åã
HTTPããŒãã¢ã©ã€ãã®å¿ é ãµããŒããããã³ããã€ãã®éèŠãª
ã¯ãšãªæååã¯ãCR-LFïŒ\ r \ nïŒã®æåã®çµã¿åããã§çµãããŸãã
ããã«ãäºãã«åé¢ããããªã¯ãšã¹ãããããŒããããŸã
CR-LFã®çµã¿åããã å¯äžã®å¿ é ïŒHTTP 1.1ïŒ
ããããŒã¯ããã¡ã€ã³åãå«ã
Host
ã§ã
ã©ã®ããŒãžãŸãã¯ãã¡ã€ã«ããããã HTTPæšæºã¯
å€ãã®ç°ãªããªã¯ãšã¹ãããããŒããã®å€ãã¯åç
é«ãããã©ãŒãã³ã¹ã確ä¿ããããã®éèŠãªåœ¹å²ã ã§
äŸã«ã¯ãå¥ã®ããããŒ
User-Agent
ãå«ãŸããŠããŸãã
ã¯ã©ã€ã¢ã³ãèå¥åè¡ãããããŒã®ãªã¹ãã¯ãæåã®å¥ã®çµã¿åããã§çµãããŸã
CR-LFïŒã€ãŸãã空ã®æååïŒã èŠåºãã®åŸã«äœãæ¥ã
ãªã¯ãšã¹ãã ãã®äŸã§ã¯ããªã¯ãšã¹ãã®æ¬æã¯ç©ºã§ãïŒé·ããŒãïŒ<Div class = "sect1" lang = "ru" xmlïŒlang = "ru">
HTTPå¿ç
HTTPèŠæ±ããµãŒããŒã«éä¿¡ããããšã«ãããã¯ã©ã€ã¢ã³ãã¯å¿çãæåŸ ããŸãã HTTPå¿çäžè¬çã«ã¯ãšãªã«äŒŒãŠããŸãïŒã¹ããŒã¿ã¹ããŒããªã¹ã
ããããŒãšå¿çæ¬æã
HTTP / 1.1 200 OK ãµãŒããŒïŒnginx / 0.5.35 æ¥ä»ïŒ2008幎4æ22æ¥ç«ææ¥10:18:08 GMT ã³ã³ãã³ãã¿ã€ãïŒããã¹ã/ãã¬ãŒã³; æåã»ãã= Windows-1251 æ¥ç¶ïŒéãã æçµå€æŽæ¥ïŒéã2007幎11æ30æ¥12:46:53 GMT ETagïŒ "27e74f-43-4750063d" Accept-RangesïŒãã€ã ã³ã³ãã³ãã®é·ãïŒ34 ãŠãŒã¶ãŒãšãŒãžã§ã³ãïŒ* äžèš±å¯ïŒ/人å¿çã®æåã®åèªã¯
HTTP/1.1
ããŒãžã§ã³ã§ã
ãããã³ã«ã 2çªç®ã®åèªã¯
200
ã§ãã ãããæãäžè¬çã§ã
èŠæ±ããããã¡ã€ã«ãŸãã¯ããŒãžãæ€åºãããããšã瀺ãå¿çã³ãŒã
顧客ã«äžããããã å€ãã®ç°ãªãå¿çã³ãŒããããã
é«ãå€ã確ä¿ããäžã§éèŠãªåœ¹å²ãæãã
ããã©ãŒãã³ã¹ã è¡ã®æ®ãã¯
人éãèªããã¬ã¹ãã³ã¹ã³ãŒãã®èª¬æïŒãã®å Žå-
OK
ïŒãã¹ããŒã¿ã¹è¡ã®åŸã次ãå«ãããããŒã®ãªã¹ã
è¿œå ã®ãæã«ã¯éåžžã«éèŠãªãã¡ã€ã«æ å ±ãŸãã¯
ããŒãžã ãã®å Žåãã³ã³ãã³ãã®MIMEã¿ã€ããéèŠã§ãã
ãã¡ã€ã«ã®æçµå€æŽæ¥ïŒ
Last-Modified
ïŒããã®
é·ãïŒ
Content-Length
ïŒããã³
ETag
ïŒãã
ãã£ãã·ã³ã°ã«äœ¿çšãããç¹å¥ãªããŒã¯ã³ïŒã çãã«ã
ãµãŒããŒæ å ±ïŒ
Server
ãš
Date
ïŒand
Connection
ãããããŒã®ãªã¹ãã®åŸã«ãå¥ã®ç©ºã®è¡ã衚瀺ããã
æåŸã«ãå¿çã®å®éã®å 容ïŒãã®å Žåããããã¯2ã€ã§ã
ããã¹ãè¡ïŒãHTTPã¯ã·ã³ãã«ã§æè»ã§ãããšçµè«ä»ããããšãã§ããŸãã
ããã¹ãæ§æãããã³ã«ã è€æ°ã®æ£ç¢ºãªäœ¿çš
ãªã¯ãšã¹ãããã³ã¬ã¹ãã³ã¹ããããŒã«ããã
é«æ§èœWebã·ã¹ãã ã®é åã 詳现åæ
é¢é£ãããã¯ãããžãŒã«ã€ããŠã¯ã次ã®ç« ã§èª¬æããŸãã<div class = "sect1" lang = "ru" xmlïŒlang = "ru">
HTTPããŒãã¢ã©ã€ãã«ããæé©å
HTTPã¯TCPïŒéä¿¡å¶åŸ¡ãããã³ã«ïŒã TCPã¯ä¿¡é Œã§ãããããã³ã«ã§ã
åæ¹åããŒã¿ã¹ããªãŒã éä¿¡ã TCPã¯ãã±ããã転éããããšã§æ©èœããŸã
ã¯ã©ã€ã¢ã³ããããµãŒããŒãžããŸãã¯ãã®éã®ããŒã¿ã TCPãã±ããã¯ããããŒã§æ§æãããŸã
ããã³ããŒã¿ã ããããŒã«ã¯ãã¯ã©ã€ã¢ã³ãIPã¢ãã¬ã¹ãš
ãµãŒããŒãã¯ã©ã€ã¢ã³ããšãµãŒããŒã§äœ¿çšãããTCPããŒãçªå·ãããã³ãã€ã€ã«
ãã©ã°ã ãµãŒããŒã¯éåžžãæšæºã®TCPããŒãã䜿çšããŸã
80çªãã¯ã©ã€ã¢ã³ããšãµãŒããŒéã®TCPæ¥ç¶ã¯æ¬¡ã®æ¹æ³ã§ç¢ºç«ãããŸãã
åŸæ¥ã®TCP 3ãŠã§ã€ãã³ãã·ã§ã€ã¯ã䜿çšããŸãã ã客æ§ç¬¬äž
SYNãã©ã°ä»ãã®ãã±ããããµãŒããŒã«éä¿¡ããŸãã å¿çãšããŠããµãŒããŒã¯ãã±ãããéä¿¡ããŸã
SYN + ACKãã©ã°ã æåŸã«ãã¯ã©ã€ã¢ã³ãã¯ãã©ã°ä»ãã§å¥ã®ãã±ãããéä¿¡ããŸã
ACKããã³æ¥ç¶ã¯ç¢ºç«ããããšèŠãªãããã¯ã©ã€ã¢ã³ãã¯
ããŒã¿ïŒãã®å Žåã¯HTTPãªã¯ãšã¹ãïŒãéä¿¡ããŸãããããã³ã«çžäºäœçšã®ãã®éšåã§ã¯ã
ãµãŒããŒããã®å¿çãã±ããã1ååŸ ã€
HTTPãªã¯ãšã¹ããéä¿¡ããŸãã ã€ãŸããTCPæ¥ç¶ã確ç«ããæäœ
æ¯èŒçé«äŸ¡ã§ãäžéšã®ãã£ãã«ã§ã¯
é 延ãšéåžžã«é«äŸ¡ã§ãã èšãæããã°ã
HTTPæ¥ç¶1.1ã§ã¯ããã®æé©åã¯ããã©ã«ãã§æå¹ã«ãªã£ãŠããŸãã äžå
ãµãŒããŒã«æ¥ç¶ãããšãã¯ã©ã€ã¢ã³ãã¯ãµãŒããŒãšãªã¯ãšã¹ãã亀æãã
æ¥ç¶ãåæããã«çããŸãã ããã¯HTTPãšåŒã°ããŸãã
ããŒãã¢ã©ã€ãïŒæ°äžã®ãã©ãŠã¶ãŒããµãŒããŒãšå ±ã«ã€ã³ã¹ããŒã«ãããŠããå Žå
ããŒãã¢ã©ã€ãæ¥ç¶ãè¡ããšãããã«ãªãœãŒã¹ã䜿ãæãããŸãã
ãããã£ãŠããã¹ãŠã®ãµãŒããŒã«ã¯ãèšå®å¯èœãªã¿ã€ã ã¢ãŠãããããŸãã
ããŒãã¢ã©ã€ãæ¥ç¶ãåæãããŠããªãå Žåã¯åæãããŸã
ã¢ã¯ãã£ããã£ãªããã¯ã©ã€ã¢ã³ãã¯ãå¿çåŸã«æ¥ç¶åæãèŠæ±ãã
èŠæ±ããããŒ
Connection: close
åæ§ã«
ãµãŒããŒã¯ãããŒãã¢ã©ã€ãããµããŒãããªãããšãå¿çã§ç€ºãå ŽåããããŸã
ãŸã£ããåãããããŒãæž¡ãããšã«ããæ¥ç¶ïŒ
Connection: close
ã äžè¬çã«ããããã®ãã¹ãŠ
çžäºéç¥ã®åãæ¶ããå³å¯ã«èšãã°ã課ããªã
矩åãªãã ãµãŒããŒãšã¯ã©ã€ã¢ã³ãã®äž¡æ¹ãå®å šã«æºåããå¿ èŠããããŸã
æ¥ç¶ãã€ãã·ã¢ããã§ãã€ã§ãäžæããããšããäºå®ã«
äžæ¹ãéç¥ã¯ãããŸãããããŒãã¢ã©ã€ãæ¥ç¶ã®æŽåæ§ãç¶æããããã«ã
ãµãŒããŒã¯å¿çã®é·ããç¥ã£ãŠããå¿ èŠããããŸãã æãç°¡åãªæ¹æ³ã¯
Content-Length
ããããŒã§æå®ããŸãã é·ãã
ãã³ãã©ãŒã«ãã£ãŠå¿çã瀺ãããªãå ŽåããµãŒããŒã¯éä¿¡åã«åŒ·å¶ãããŸã
å¿çã»ããããããŒ
Connection: close
å¿çãéä¿¡ããåŸããã®éšåã§æ¥ç¶ãéããŸãã Webã¢ããªã±ãŒã·ã§ã³ãæ£ããå ¬éãããŠããããšã確èªããŠãã ãã
Content-Length
ããããŒããã以å€ã®å Žåã¯ããŒãã¢ã©ã€ãæ¥ç¶
çãã®ãµã€ãºãäœæ段éã§å€æããã®ãé£ããå ŽåããããŸãã ã§
ãã®å ŽåãããŒãã¢ã©ã€ãæ¥ç¶ãç ç²ã«ãããããŸãã¯
ç¹å¥ãªãã£ã³ã¯åãããå¿çãšã³ã³ãŒãã£ã³ã°ã䜿çšããŸãïŒããã¯
Transfer-Encoding: chunked
ããããŒã䜿çšïŒã
詳现ã¯HTTPæšæºã«èšèŒãããŠããŸã<Div class = "sect2" lang = "ru" xmlïŒlang = "ru">
HTTPãã€ãã©ã€ã³åã«ããæé©å
1ã€ã®äžã§äžé£ã®èŠæ±ãšå¿çãè¡ããšãããŒãã¢ã©ã€ãæ¥ç¶ãæéã¯ããã©ãŒãã³ã¹ã«éèŠãªåœ¹å²ãæãããŸã
èŠæ±ãšå¿çã®éã®é 延ã é 延ã¯
é«ããã£ãã«é 延ãšé·æéã®äž¡æ¹ãåå
ãµãŒããŒã§ãªã¯ãšã¹ããåŠçããŸãã å¥ã®ãªã¯ãšã¹ããéä¿¡ããåã«ã
次ã®åŠçãå®äºãããŸã§åŸ ã€å¿ èŠããããŸãã 察åŠãã
ãã®åé¡ã¯ãæè¡ã䜿çšããããšãã§ããŸã
HTTPãã€ãã©ã€ã³åŠçïŒHTTPãã€ãã©ã€ã³åŠçã®æå³ã¯ãåã«ã¯ã©ã€ã¢ã³ãã
ããã€ãã®ãªã¯ãšã¹ããé£ç¶ããŠéä¿¡ããåŸã ã«éå§ããŸã
å ¥ã£ãŠããåçããããäžããŸãã äžè¬çãªãµãŒããŒãµããŒã
è¯ãããæ®å¿µãªãããçŸåšãµããŒãããŠããã¯ã©ã€ã¢ã³ã
HTTPãã€ãã©ã€ã³ãåžå Žã®ããäžéšãå ãã<Div class = "sect1" lang = "ru" xmlïŒlang = "ru">
HTTPãã£ãã·ã³ã°ã«ããæé©å
ãªãŒããŒHTTPãã£ãã·ã³ã°ã¯é·å¹Žã«ããã£ãŠèç©ãããŠããŸããç¥è©±ãšåèŠã 第13ç« RFC2616ïŒHTTPã§ã®ãã£ãã·ã¥ïŒ
ããªãçŽããããã ããã®äž»ãªçç±ã¯ãèè ã
ãã¹ãŠã®äººã«äžåºŠã«ãã¹ãŠã説æããããšããïŒãµãŒããŒéçºè ãããã³
ã¯ã©ã€ã¢ã³ãéçºè ãããã³ãã£ãã·ã¥ãããã·éçºè ã ãé€ã
ããã«ãæ··ä¹±ã¯æ代é ãã®è°è«ãè¿œå ããŸã
ïŒHTTP 1.0ïŒã¯ã©ã€ã¢ã³ãããµãŒããŒããããã·ã«ããããã®ç« ã§ã¯ãã¹ããŒãªãŒå šäœãæ£ç¢ºã«äŒããããšãè©Šã¿ãŸãã
çŸä»£ã®éçºè ã®èŠç¹ïŒããªãã¡ããµããŒã
HTTP 1.1ïŒãµãŒããŒã æåã«ãæãåçŽãªç¶æ³ã«ã€ããŠèª¬æããŸãã
ææ°ã®ã¯ã©ã€ã¢ã³ãã§åäœããŸãïŒéäžã§ãããã·ããã£ãã·ã¥ããŸããïŒã
ãã®åŸ-1ã€ãŸãã¯
ããã€ãã®ææ°ã®ãã£ãã·ã¥ãããã·ã æåŸã«ã
ããã«ãã©ã®ïŒå»æ¢ãããïŒããããŒãå¿çã«è¿œå ããå¿ èŠããããã
å€ã顧客ãæ代é ãã®é¡§å®¢ããåãå ¥ããããçµæãéæãããã
é路沿ãã®ãããã·ïŒãã ããããã2ã€ã®çš®ã®ååšã¯
åç©ã蚌æããã®ã¯éåžžã«é£ããã§ããïŒ<div class = "sect2" lang = "ru" xmlïŒlang = "ru">
çŸä»£ã®ã¯ã©ã€ã¢ã³ãã§ã®ãã£ãã·ã¥
äžè¬ã«ããã£ãã·ã¥ããã»ã¹ã¯2ã€ã®éšåã§æ§æãããŸããã³ã³ãã³ãã®æå¹æéãšåæ€èšŒæé ãã³ã³ãã³ãã®æå¹æéãåããã«ã¯ã
Cache-Control: max-age=300
å¿çããããŒ
Cache-Control: max-age=300
ããã«
300
ã¯ãã³ã³ãã³ãã®æå¹æéïŒç§åäœïŒã§ãã
ïŒã€ãŸãã5åïŒã ããã¯ã5å以å ã«ã¯ã©ã€ã¢ã³ãã
ãŸã£ãããªã¯ãšã¹ãããã«ãåä¿¡ãããªããžã§ã¯ããèªç±ã«äœ¿çšã§ããŸã
re-serverããªããžã§ã¯ããæå¹æéåŸã«å¿ èŠãªå Žåã
åæ€èšŒããå¿ èŠããããŸãã åæ€èšŒã¯åçŽã«
åããªããžã§ã¯ããåèŠæ±ããŸãããè¿œå ã§
èŠåºãã åæ€èšŒã«ãããããããã®åéä¿¡ãçºçããå ŽåããããŸã
ãªããžã§ã¯ãããŸãã¯ç¹å¥ãªå¿çã³ãŒããéä¿¡ãã
304 Not Modified
ã æããã«ã2çªç®ã®ãªãã·ã§ã³
æãŸããã åæ€èšŒã«ã¯äž»ã«3ã€ã®æ¹æ³ããããŸãã
- æçµå€æŽæ
ïŒLast-Modified
ïŒ; - ãªããžã§ã¯ãèå¥åïŒ
ETag
ïŒ; - ç¡æ¡ä»¶ïŒãªããžã§ã¯ãã®å 容ãäžããã ãïŒ;
å€æŽãå¿çããããŒã®éã«ç¹å¥ãªããããŒãããã¯ãã§ã
åœç¶ã®ããšãªãããæåŸã®æå»ãå«ã
Last-Modified
ãªããžã§ã¯ãã®å€æŽã åæ€èšŒäžã«ããã®å€ã¯ã¯ã©ã€ã¢ã³ãã«ãã£ãŠéä¿¡ãããŸã
ç¹å¥ãªãªã¯ãšã¹ãããããŒïŒ
If-Modified-Since
èŠæ±ãã³ãã©ã¯ããªããžã§ã¯ããå€æŽããããã©ãããããã³
no-空ã®ããã£ãšå¿çã³ãŒãã§å¿çãè¿ããŸã
304 Not Modified
ã ã³ã³ãã³ãèªäœã¯
éä¿¡ãããã¯ã©ã€ã¢ã³ãã¯ã³ã³ãã³ãã䜿çšããŸã
ãã£ãã·ã¥ã«ä¿åãããŸããæåŸã®å€æŽæãŸã§ã«åæ€èšŒã䜿çšããæ¹ãç°¡åã§ã
éçãã¡ã€ã«ãããã³ããã©ã«ãã§ãã¹ãŠã®ãµãŒããŒã®åèš
ãã®æ©èœãå«ããŸãã åçã«çæãããããŒãžã®å Žå
é©åãªãªã¯ãšã¹ãåŠçã¢ãŒããã¯ãã£ãéžæããããšããããŠäžè¬çã«ã¯
ãã®ãããªåæ€èšŒã®å¯èœæ§ãšäŸ¿å®ãè°è«ãããŠããŸã
ãªããžã§ã¯ãèå¥åã«ããåæ€èšŒãæ©èœããããã«ã¯ã
å¿çããããŒã«ã¯ç¹å¥ãªèŠåºããå¿ èŠã§ã
ETag
ã æå®ãããŠããªããã®ãè¿ããŸã
ãªããžã§ã¯ãããŒãžã§ã³èå¥åïŒäŸïŒApacheéçãã¡ã€ã«çšïŒ
ããã©ã«ãã§ã¯ããã¡ã€ã«ãæåŸã«å€æŽãããæ¥ä»ã®çµã¿åããã䜿çšãã
ãã¡ã€ã«ã·ã¹ãã ã®ãµã€ãºãšiããŒãçªå·ïŒã åæ€èšŒæ
ã¯ã©ã€ã¢ã³ãã¯ãªã¯ãšã¹ãã§ç¹å¥ãªããããŒãéä¿¡ããŸã
åãèå¥åãå«ã
If-None-Match
ã
ãµãŒããŒã¯ãããŒãžã§ã³èå¥åã®çŸåšã®å€ãæ¯èŒããŸãã
äžèŽãã空ã®æ¬æãšå¿çã³ãŒããå«ãå¿çãè¿ããŸã
304 Not Modified
æåŸã®å€æŽã®æå»ã®åæ€èšŒãšåæ§ã«ã
ãã®åæ€èšŒã¯ãéçãã¡ã€ã«ã«äœ¿çšããã®ãæãç°¡åã§ãã ã®ããã«
åçã«çæãããããŒãžã®å Žåæ£ããéžæã®åé¡
ã³ã³ãã³ãã¢ãŒããã¯ãã£ã«ã€ããŠã¯ä»¥äžã§èª¬æããŸãã äž¡æ¹ã®åæ€èšŒã¡ãœããã¯
ç¥è©±äžã®ãã©ãŠã¶ããããã·ãšã®äºææ§ã®ããã
HTTP 1.1ããµããŒããããããå¿çã«ã¯ããããŒãå«ããå¿ èŠããããŸã
Expires
ãå»æ¢ã®å¿ èŠãªãã€ã³ãã瀺ããŸã
ãã¡ã€ã«ãŸãã¯ããŒãžã ãã®ããããŒã®å€ã®åœ¢åŒã¯æ¬¡ã®ãšããã§ãã
Tue, 15 Nov 1994 08:12:31 GMT
<div class = "sect2" lang = "ru" xmlïŒlang = "ru">
åæ€èšŒæŠç¥
æ¢ã«è¿°ã¹ãããã«ããã£ãã·ã³ã°ã¯æãç°¡åã§æãç解ãããããã®ã§ããã¶ã€ã³åçãjavascriptãã¡ã€ã«ãªã©ã®éçãã¡ã€ã«ã
CSSãã¡ã€ã«ã éçãã¡ã€ã«ã®å Žåãçæãéåžžã«ç°¡åã§ã
äž¡æ¹ã®æ¡ä»¶ã®æå³ã確èªããŸãïŒ
Last-Modified
ãš
ããã³
ETag
ãããããéçã®å Žåã«
ETag
é£ãã質å
ãã¡ã€ã«-é©åãªæå¹æéãéžæããŸãã éçºè
Yahoo.comã¯åçŽãªæŠç¥ãæšå¥šããŸããaïŒéçã«å ¬éãã
1幎ã®ãã¡ã€ã«ã®æå¹æéïŒèªã¿åãïŒãæ°žä¹ ãïŒããã³bïŒ
ãããžã§ã¯ãã®æ°ããããŒãžã§ã³ãæçš¿ãããšãã«URLãå€æŽããã·ã¹ãã ãå°å ¥ãã
å®çšŒåãµãŒããŒäžãããšãã°ãRuby on Railsã§ã¯ãURLã
CSSãã¡ã€ã«ã¯æ¬¡ã®ããã«ãªããŸãã
/stylesheets/main.css?31415
ããã§
31415
ã¯ãã·ã¹ãã å ã®ææ°ãªããžã§ã³ã®çªå·ã§ã
ããŒãžã§ã³ç®¡çã åæ§ã®ã¡ã«ããºã ãç°¡åã«å®è£ ã§ããã¯ãã§ã
ä»ã®ä¿å®çãªæŠç¥ã¯ããã£ãã·ã¥ããããšã§ã
çŽ30åãçæéã®éçãã¡ã€ã«ã ã ãã
ãããã£ãŠãäžè¬çãªãŠãŒã¶ãŒã»ãã·ã§ã³ãé«éåããŸãã 圌ã¯ãã€æ¥ãŸãã
次åãµã€ããžãåããŠãããèµ·ãã£ããšã
ãã¹ãŠã®çµ±èšã®äžæ¬åæ€èšŒã ãã®æŠç¥ã¯å¿ èŠãããŸãã
éç£ã³ãŒãé€å»ã·ã¹ãã ïŒååãšããŠãããå€æŽãã
ãã®æŠç¥ã®æ¬ ç¹ãšèŠãªãããšãã§ããŸã-å€ãã®å Žå
ãã®ãããªã·ã¹ãã ããŸã£ããååšããªãããšãæå³ãããããããŸãããïŒäžè¬çã«ãããã€ãã®å€§å¹ ãªå¢å ãéæããããã«ã
ããã©ãŒãã³ã¹ãåäžãããã«ã¯ãæ¡ä»¶ãé©åã«çµã¿åãããå¿ èŠããããŸãã
ãŸããããŒãžã«ã€ããŠã¯ãæ¯èŒçç°¡åã«èšç®ã§ããã¯ãã§ã
ããªããŒã¿ãŒïŒæçµå€æŽæå»ãŸãã¯ETagïŒã 第äºã«
ããŒãžã®æ å ±ãã¶ã€ã³ã«ãããã¯ã©ã€ã¢ã³ãã¯ååãªè² è·ããããããšãã§ããŸã
æ代é ãã®ã³ããŒã çµéšãããéåžžã«ãŸããªããŒãžã¯ã©ã¹
枬å®å¯èœãªå¹æã¯èšããŸã§ããªãããã®çµã¿åãããæäŸãã
åæ€èšŒã®å°å ¥ããã çŸä»£ã®å¯èœæ§ããããŸã
ã€ã³ã¿ã©ã¯ãã£ããªãããžã§ã¯ãã¯äžè¬ã«ããã«ã€ããŠèããã®ã¯æå³ããããŸãã
æ¹åãããã³éåžžã«é«éãªçæã«éäž
ãããã®åãããŒãžããã ããäžèšã®éçãã£ãã·ã¥ã¯
ãã¡ã€ã«ã¯ãåç¹å®ã®ãŠãŒã¶ãŒãšã¯ã¹ããªãšã³ã¹ã§éèŠãªåœ¹å²ãæãããŸã
ãŠãŒã¶ãŒãããã³ãã®ãããªãã£ãã·ã¥ã«æ³šæãæãå¿ èŠããããŸãïŒè¯ã
ããã¯é£ããããšã§ã¯ãããŸãããïŒãã®åé¡ã®ãã1ã€ã®åŽé¢ã¯ãæ€çŽ¢ãšã³ãžã³
ã·ã¹ãã ã¯ãããããæ£ããæéãèšå®ããããšã匷ããå§ãããŸã
ãã¹ãŠã®ããŒãžã§
Last-Modified
ã
æ€çŽ¢ããããã«ãã£ãŒãããŸãã å¯èœæ§ããããŸã
ãã®ãããã¯ã®ãšã³ãžã³ãä¿®æ£ããããã»ã¹ã¯ã
æŠç¥èªäœãå®è£ ããããšãå°é£ã§ã
ãã£ãã·ã³ã°<div class = "sect2" lang = "ru" xmlïŒlang = "ru">
ãã£ãã·ã¥ãšã€ã³ã¿ã©ã¯ãã£ãããŒãžãç¡å¹ã«ãã
å€ãã®å Žåãéåé¡ã解決ããå¿ èŠããããŸãããµã€ãã®ç¹å®ã®ããŒãžããããããµã€ããããªããŒããããããã«
ãŠãŒã¶ãŒã蚪åããæéã ãããŸã
HTTPã®ãã£ãã·ã³ã°ã«é¢é£ããäžè¬çãªç¥è©±ããã 圌ã¯çžãããŠãã
3ã€ã®éæ³ã®éæ³ã®åªæã®ååŒã®ç¹°ãè¿ãã§
ããããŒïŒ
ãã£ãã·ã¥å¶åŸ¡ïŒãã£ãã·ã¥ãªã ãã©ã°ãïŒno-cache æå¹æéïŒä»ãšã©ãŒã®è©³çŽ°ãªåæã«ã€ããŠã¯èª¬æããŸãããã
ããã3è¡ã§åéãããŸãã æåã®è¡ã¯
ãã®ç®çãå®å šã«æå³ãããã®ã§ã¯ãªãã2è¡ç®ã¯æ±ºããŠ
æå³ããããŸããã§ããããããŠ3çªç®ã¯å£æ» çã«æ代é ãã§ãïŒããã¯ããŸãã
ã¿ã¹ã¯ïŒãæ£ããçŸä»£çãªæ¹æ³ã¯
Cache-Control: max-age=0
ããããŒ
Cache-Control: max-age=0
ã 圌ã¯æå³ãã
ããŒãžã®ã³ã³ãã³ããåä¿¡åŸããã«æéåãã«ãªãããšãããã³
ãã©ãŠã¶ã¯ãããåæ€èšŒããå¿ èŠããããŸãã ãªã¯ãšã¹ããåä¿¡ãããµãŒããŒ
åæ€èšŒãåã«ãŠãŒã¶ãŒã«æ°ããããŒãžã§ã³ãè¿ã
ããŒãžããã©ãŠã¶ã®ç¥è©±äžã®å€ãããŒãžã§ã³ãšã®äºææ§ããã³
HTTP 1.1ããµããŒãããªããããã·ãå¿çã
ããããŒ
Expires: now
è¿œå ã
Expires: now
ã 圌ã¯åãã§ã
Cache-Control: max-age=0
ãããªæå³ã§ãã<div class = "sect1" lang = "ru" xmlïŒlang = "ru">
å§çž®ã®æé©å
ãã©ãã£ãã¯ãå€§å¹ ã«åæžããå¿çãé«éåããçŽ æŽãããæ¹æ³ãµãŒããŒã¯ãæå®ããããã¡ã€ã«ãšããŒãžã®å§çž®ã§ãã ã»ãŒ
ææ°ã®ãã¹ãŠã®WebãµãŒããŒãäœããã®åœ¢ã§ããããµããŒã
æ©èœã å§çž®çã¯
ç¹å®ã®åããŒãžã§ã10ã®ãªãŒããŒã®å€ã«å°éã§ããŸãã
Webã¢ããªã±ãŒã·ã§ã³éçºè ã®å§çž®ã¯å®å šã«ééçã§ãããå¿ èŠãããŸãã
å§çž®ãããã³ã³ãã³ãã¯ã©ã€ã¢ã³ããåãå ¥ããæ©èœ
ããããŒã䜿çšããŠãµãŒããŒã«éç¥ããŸã
Accept-Encoding: gzip
ã ãµãŒããŒã
é¢é£ã³ã³ãã³ãã®å§çž®ãããããã¿ã€ãã«ãè¿œå ã§ããŸã
Content-Encoding: gzip
å¿çïŒæ··åããªãã§ãã ããïŒ
Transfer-Encoding
ïŒããã³å§çž®ãããã¯ã©ã€ã¢ã³ãã«éä¿¡
ã³ã³ãã³ããæŽå²çã«ç°ãªããã©ãŠã¶ã«ã¯å€ãã®ç°ãªããšã©ãŒããããŸãã
å§çž®ã³ã³ãã³ãã®åŠçã çŸåšïŒ2008幎åã°ïŒã
ãšã©ãŒã®ããå®éã«äœ¿çšããã顧客ã®å²åãäœäžããããã§ã
ç¡èŠã§ããã éåžžããµãŒããŒã®ããã¥ã¡ã³ãã§ã¯ã
ã³ã³ãã³ãã®ã¿ã€ããšãã©ãŠã¶ã®çµã¿åããã®ãããã®ã»ãã
å€ãã¯ã©ã€ã¢ã³ãã®ãšã©ãŒãåé¿ããããã®æšå¥šäºé ãšåæ§ã«æ©èœããŸãã
<div class = "sect2" lang = "ru" xmlïŒlang = "ru">
ç¹å®ã®æé©å
å
容
ç°¡åã«èšãã°ãããã¯äœåãªã¹ããŒã¹ãšæ¹è¡ãåé€ããŸã
HTMLãã¡ã€ã«ãšCSSãã¡ã€ã«ãããJavaScriptã®çž®å°ãããã³
ç»åãã¡ã€ã«ãµã€ãºã®æé©åã ãµã€ãºãžã®åœ±é¿ã«å ããŠ
éä¿¡ããŒã¿ããã®æé©åãå¢å ããå¯èœæ§ããããŸã
ã¯ã©ã€ã¢ã³ãåŽã®ããã©ãŒãã³ã¹ïŒãã©ãŠã¶ã®ããã©ãŒãã³ã¹ã¯äœäžããŸã
åŠçãããããŒãžã®ããŒãžãœãŒã¹ããã³DOMããŒãã®è§£æããã³å æã¡ã¢ãªã®åæž
ãJavaScriptã®ãããã¡ã€ã¯ã
é£èªåïŒã³ãŒãã®æå³ãæãããïŒãšåæã«å®è¡ããããšãã§ããŸããããã¯
ãç¥ç財ç£ä¿è·ããªã·ãŒã®èŠ³ç¹ããããçšåºŠã®æå³ãæã€å ŽåããããŸãã
prototype.jsãªã©ã®æ±çšã©ã€ãã©ãªã«ã¯ã
çž®å°åã®çµã¿èŸŒã¿ãµããŒããšã
ãããžã§ã¯ãã§äœ¿çšãããŠããªãã³ã³ããŒãã³ãã®ãµãã»ãããåé€ããæ©èœãå«ãŸããŠããŸã<Div class = "sect2" lang = "ru" xmlïŒlang = "ru">
ã³ã³ãã³ãã®çµã¿åãã
HTTPãªã¯ãšã¹ãã®æ°ãæžããããã«ãè€æ°ã®ãã¡ã€ã«ã1ã€ã«ãŸãšããããšãã§ããŸããå€ãã®å Žåã
çµåã«å ããŠãçµæã®ãã¡ã€ã«ãçž®å°ããããšãã§ããŸãCSSãã¡ã€ã«ã¯åçŽã«1ã€ã«é£çµã§ããŸããJavaScriptãã¡ã€ã«ã«
ã¯ãã®ç¹ã«æ³šæãå¿ èŠã§ãããäžè¬çã«
ãJavaScriptãé£çµãããªãå Žå
ãJSã³ãŒãã®ã¢ãŒããã¯ãã£ã«åé¡ããããšæ³å®ã§ããŸããã¢ã€ã³ã³ãããã²ãŒã·ã§ã³ã°ã©ãã£ãã¯ãªã©ã¯ã
t n CSSã¹ããªãã
ãã®ããŒãã«é¢ããå€æ°ã®ã¬ã€ãããªã³ã©ã€ã³ã§åç §ããŠãã ããã