
1996幎ãCurlãããžã§ã¯ãã®å身ã§ããhttpgetããã°ã©ã ã®äœæ¥ãå§ãããšããæåã®URLããŒãµãŒãäœæããŸããã ãã®ãšãããã®ãŠãããŒãµã«ã¢ãã¬ã¹ã¯
URL ïŒUniform Resource LocatorãšåŒã°ããŠããŸããã ãã®ä»æ§ã¯ã1994幎ã«IETFã«ãã£ãŠå
¬éãããŸããã ãURLããšããç¥èªã¯ãããŒã«ã®ååãš
Curlãããžã§ã¯ãã®ã€ã³ã¹ãã¬ãŒã·ã§ã³ã®æºãšããŠäœ¿çšãããŸããã
ãURLããšããçšèªã¯åŸã«å€æŽãããŸããã 2005幎ã«å
¬éãããä»æ§ã«ãããšã
URI ïŒUniform Resource IdentifierïŒãšåŒã°ããããã«ãªããŸããããäž»ãªãã®ã¯ä¿æãããŠããŸããããªã³ã©ã€ã³ãªãœãŒã¹ãå®çŸ©ãããã®ãªãœãŒã¹ãååŸãããããã³ã«ã瀺ãè¡ã®æ§æã§ãã ãã®RFC 3986ä»æ§ã§å®çŸ©ãããŠããURLãåãå
¥ããã«ã¯ãcurlãå¿
èŠã§ãã
IRIã説æããé¢é£RFCããããŸããïŒåœéåãªãœãŒã¹èå¥åã IRIã¯åºæ¬çã«URIãšåãã§ãããIRIã§ã¯éASCIIæåã䜿çšã§ããŸãã
WHATWGã³ã³ãœãŒã·ã¢ã ã¯åŸã«ç¬èªã®
URLä»æ§ãäœæããäž»ã«ãã©ãŠã¶ãŒã«éç¹ã眮ããŠURIãšIRIã®åœ¢åŒãšã¢ã€ãã¢ããŸãšããŸããïŒããã¯é©ãããšã§ã¯ãããŸããïŒã è¿°ã¹ãããŠãã
ç®æšã® 1ã€ã¯ããææ°ã®å®è£
ã«åŸã£ãŠRFC 3986ããã³RFC 3987ãè¿ä»£åãããããã段éçã«å»æ¢ããããšãã§ãã 圌ãã¯ãURLããšããçšèªã®äœ¿çšã«æ»ããããšæã£ãŠãããURIãšIRIãšããçšèªã¯ç¶æ³ãåçŽã«æ··ä¹±ããã人ã
ã¯ãŸã ããããç解ããŠããªãïŒãŸãã¯ãããã®çšèªãååšããããšããç¥ããªãïŒããšãæ£ããè¿°ã¹ãŠããŸãã
WHATWGä»æ§ã¯å€ãè¯ããã©ãŠã¶ã®ãã³ãã©ã®ç²Ÿç¥ã«åºã¥ããŠæžãããŠããŸãããŠãŒã¶ãŒã«å¯ŸããŠå¯èœãªéãå¯å€§ã«ãªãããã«ãåžžã«æå³ãæšæž¬ããŠè£è¿ãããããå®è¡ããããšããŸãã ãããããããšåæã«ã
ãã¹ãã«ã®
æ³åãããžãã¹ãžã®æåã®ã¢ãããŒãã§ã¯ãªãããšãç§ãã¡ã¯çç¥ã£ãŠããŸãã å®éãããã¯ãä»æ§ã§URLã«äœ¿çšããã¹ã©ãã·ã¥ãã¹ããŒã¹ãéASCIIæåãå€ãããããšãæå³ããŸãã
ç§ã®èŠ³ç¹ãããããšããã®ãããªä»æ§ã¯æ§æã圢åŒã詳现ã«èª¬æããŠããªãããåæã«å¿
é ã®è§£æã¢ã«ãŽãªãºã ã課ããŠãããããèªã¿èªã¿ããããšãéåžžã«å°é£ã§ãã ç§ã®å£°æã確èªããã«ã¯ïŒURLã®ãã¹ãåã®åŸã«ããã®ä»æ§ããšã³ããã€ã³ãã«ã€ããŠäœãšèšã£ãŠããããèŠãŠãã ããã
ãããã®ãã¹ãŠã®æšæºãšä»æ§ã«å ããŠããã¹ãŠã®ãã©ãŠã¶ãŒã®ã€ã³ã¿ãŒãã§ãŒã¹ã«ã¯ããŠãŒã¶ãŒãä»»æã®çš®é¡ã®é¢çœãè¡ãå
¥åããŠURLã«å€æã§ããã¢ãã¬ã¹ããŒïŒå¥åïŒããããŸãã ã¢ãã¬ã¹ããŒã«ã
http://localhost/%41
ããšå
¥åãããšãããŒã»ã³ããŒãžã»ã¯ã·ã§ã³ã¯ãAãã«å€æãããŸãïŒ16é²æ°ã§41ã¯ASCIIã®å€§æåAã§ããããïŒããã
http://localhost/AA
"ããããŠå®éã"
/A%20A
"ïŒURLãšã³ã³ãŒãã«ã¹ããŒã¹ãå«ãïŒããçºä¿¡HTTP GETèŠæ±ã«éä¿¡ãããŸãã ãã®ããšã«ã€ããŠè©±ããŠããã®ã¯ããã®è¡ã«å
¥åã§ãããã®ã¯ãã¹ãŠURLã§ãããšäººã
ãããèããããã§ãã
äžèšã¯åºæ¬çã«ãã©ã®ä»æ§ãšæšæºããŸã 䜿çšããå¿
èŠããããã«ã€ããŠã®ç§ã®ïŒæªãã ïŒã¢ã€ãã¢ã§ãã 次ã«ãçŸå®ãè¿œå ããŠãURLãURLã§ãªãå Žåã«ã©ã®ãããªåé¡ãçºçããããèŠãŠã¿ãŸãããã
ã§ã¯ãURLãšã¯äœã§ããïŒ
ãŸãã¯ããå
·äœçã«-ããããã©ã®ããã«æžãã®ã§ããïŒ ã©ã®æ§æã䜿çšããŠããŸããïŒ
WHATWGä»æ§ã®æ倧ã®èª€ãã®1ã€ïŒããã³ããã®ä»æ§ãééã£ãŠãããšåºãä¿¡ããŠçŸåšã®åœ¢åŒã§å察ããŠããçç±ïŒã¯ã圌ãã ããURLãšãããã«å®çŸ©ãäžããŸãã URLã®è¡šç€ºããã©ãŠã¶ãHTMLãããã³ã¢ãã¬ã¹è¡ã®ã¿ã«å¶éããŸãã ãã¡ãããWHATWGã¯ã»ãšãã©ãã¹ãŠã®ãŠãŒã¶ãŒã䜿çšãããã©ãŠã¶ãŒã代衚ãã倧äŒæ¥ã«ãã£ãŠäœæãããURLã¯ãããã®ãã©ãŠã¶ãŒã§åºã䜿çšãããŠããŸãããURLèªäœã¯ã¯ããã«å€§ããªçŸè±¡ã§ãã
WHATWGã«ååšããURLã®æŠå¿µã¯ããã©ãŠã¶ä»¥å€ã§ã¯åºãåãå
¥ããããŠããŸããã
ã³ãã³ã¹ã©ãã·ã¥ã¹ã©ãã·ã¥
ãããã³ã«ããããã¯ãŒã¯ã«é¢ããç¹å¥ãªç¥èãæããªãäžè¬ã®äººã
ã«ãŠãŒã¶ãŒã«å°ãããšãURLãšã¯äœã§ããïŒ ã·ãŒã±ã³ã¹ "ïŒ//"ïŒã³ãã³-ã¹ã©ãã·ã¥-ã¹ã©ãã·ã¥ïŒã¯åçãªã¹ãã®å
é ã«ãããŸãã æ°å¹Žåããã©ãŠã¶ãURLãããå®å
šã«è¡šç€ºãããšããããã¯ããã«é¡èã«ãªããŸããã ãã®ã·ãŒã±ã³ã¹ãèŠããšãããããŸãã«URLã§ããããšãããã«ããããŸãã
ãããããŠãŒã¶ãŒããé¢ããŠèŠãŠåã£ãŠã¿ãŸããã-äžçäžã«ã¡ãŒã«ã¯ã©ã€ã¢ã³ããã¿ãŒããã«ãšãã¥ã¬ãŒã¿ãããã¹ããšãã£ã¿ãPerlã¹ã¯ãªãããªã©ãURLãèªèããŠæäœã§ãããã®ããããããããŸãã ããšãã°ããã©ãŠã¶ã§URLãéããçæãããHTMLã§ã¢ã¯ãã£ããªãªã³ã¯ã«å€æããŸãã ãããã®èšå€§ãªæ°ã®ã¹ã¯ãªãããšããã°ã©ã ã¯ããã³ãã³ã¹ã©ãã·ã¥ã¹ã©ãã·ã¥ãã·ãŒã±ã³ã¹ãäž»ãªæ©èœãšããŠäœ¿çšããŸãã
WHATWGä»æ§ã§ã¯ãå°ãªããšã1ã€ã®ã¹ã©ãã·ã¥ãå¿
èŠã§ãããããŒãµãŒã¯ä»»æã®æ°ã®ã¹ã©ãã·ã¥ãåãå
¥ããªããã°ãªããªããšèŠå®ãããŠããŸãã ããã¯ãã
http:/example.com
ããšã
http:///////////////example.com
ããå®å
šã«é©åãªãªãã·ã§ã³ã§ããããšãæå³ããŸãã RFC 3986ããã³ãã®ä»ã®å€ãã®æèŠã¯äžèŽããŸããã 確ãã«ãéå»æ°æ¥éã§ç§ãè°è«ãã人ã
ã®ã»ãšãã©ãããšãã°Webã§åããŠãã人ã
ã§ãããURLã«2ã€ã®ã¹ã©ãã·ã¥ããããšèãã確信ããŠããŸãã ãã®èšäºã®äžèšã®ãURLããªã¯ãšã¹ãã®Googleç»åæ€çŽ¢çµæã®ã¹ã¯ãªãŒã³ã·ã§ãããããèŠãŠãã ããã
URLã«ã¯2ã€ã®ã¹ã©ãã·ã¥ãããããšãç¥ã£ãŠããŸãïŒãã ãããã¡ã€ã«ã¿ã€ãã®URLïŒéåžžã¯3ã€ã®ã¹ã©ãã·ã¥ããããŸãããä»ã®ãšãããããç¡èŠããŸãããïŒã 1ã€ã§ã¯ãããŸããã 3ã€ã§ã¯ãããŸããã äºã ããããWHATWGã¯åæããŸããã
ããã¡ã€ã«ä»¥å€ã®URLã«3ã€ä»¥äžã®ã¹ã©ãã·ã¥ã䜿çšããæ¬åœã®çç±ã¯ãããŸããïŒãïŒWHATWGã¡ã³ããŒã«è¿·æããããŸãïŒ
ã äºå®ã¯ããã¹ãŠã®ãã©ãŠã¶ããããè¡ããšããããšã§ãã ããã©ãŠã¶ããã®ããã«å®è£
ããã®ã§ãä»æ§ã¯ãããè¿°ã¹ãŠããŸãããã®æã¯ééã£ãŠããããã¹ãŠã®ãã©ãŠã¶ããããè¡ãããã§ã¯ãªããšææããåŸã§ãããã以äžã®èª¬æã¯ãããŸããã§ããã ããããããã®è°è«ã®ã¹ã¬ããã¯ããªãã«ãšã£ãŠéåžžã«æçã§ãããšæãããã§ãããã
Curlãããžã§ã¯ãã§ã¯
ããLocationïŒãããããŒã«
ãã®ãããªURLãéãè¿ããµãŒããŒãæ¢ã«ååšããäžéšã®ãã©ãŠã¶ãŒãåãå
¥ããããããããã Curlã¯ãä»ã®å€ãã®ã©ã€ãã©ãªããã³ã³ãã³ãã©ã€ã³ããŒã«ã®ã»ãšãã©ãšã¯ç°ãªããããã§ã¯ãããŸããã 誰ããµããŒãããŸããïŒ
ã¹ããŒã¹
ã¹ããŒã¹æåïŒ32 ASCIIã³ãŒãã0x20 16é²ã³ãŒãïŒãURLã®äžéšã«ããããšã¯ã§ããŸããã éä¿¡ããå Žåã¯ãURLã®äžéšã«ããå¿
èŠãããä»ã®ç¡å¹ãªæåãšåæ§ã«ãURLãšã³ã³ãŒãã䜿çšããå¿
èŠããããŸãã URLãšã³ã³ãŒãã¯ãããŒã»ã³ãèšå·ãåã«ä»ãã16é²æ°ã®ãã€ãå€ã§ãã ãããã£ãŠããïŒ
20ãã¯ã¹ããŒã¹ãæå³ããŸãã ãŸããURLã®ããã¹ããã¯ããŒã«ãããªã©ã®ããŒãµãŒã¯ãç¡å¹ãªæåãæ€åºãããšURLã®æåŸã«å°éããããšãæ€åºããããšãæå³ããŸãã ããšãã°ãã¹ããŒã¹ã
ãã©ãŠã¶ã¯éåžžããªã³ã¯ãé©åã«èŠããããã«ãã¢ãã¬ã¹è¡ã®ãã¹ãŠã®20ïŒ
ãã¹ããŒã¹æåã«å€æããŸãã ã¢ãã¬ã¹ããããã¡ã«ã³ããŒããŠããã¹ããšãã£ã¿ã«è²Œãä»ãããšãïŒ
20ã®ãããªã¹ããŒã¹ã衚瀺ãããŸããããã¯å¿
é ã§ãã
ãããçç±ãã©ããã¯ããããŸãããããã©ãŠã¶ã¯URLã®äžéšãšããŠã¹ããŒã¹ãåãå
¥ããŸããããšãã°ãHTTPå¿çã§ãªãã€ã¬ã¯ããåä¿¡ããŸãã ãããã®URLã¯ãLocationïŒããããŒã§ãµãŒããŒããã¯ã©ã€ã¢ã³ãã«æž¡ãããŸãã åé¡ã®ãªããã©ãŠã¶ã¯URLã«ã¹ããŒã¹ãèš±å¯ããïŒ
20ãšããŠãšã³ã³ãŒãããŠæ¬¡ã®ãªã¯ãšã¹ããéä¿¡ããŸãã ããã«ãããcurlã¯ãªãã€ã¬ã¯ãããããURLãã®ã¹ããŒã¹ãåãå
¥ããŸãã
éã¢ã¹ããŒ
ASCII以å€ã®æåãå«ãèšèªã®URLããµããŒãããããšã¯ãç¹ã«é西æŽã³ãã¥ããã£ã«ãšã£ãŠã¯ãã¡ããéèŠã§ãããIRIä»æ§ãååã§ã¯ãªãã£ãããšã«åæããŸãã ç§ã¯å人çã«ã¯åœéåã®å°é家ã§ã¯ãªãã®ã§ãä»ã®äººããèããããšãåèã«ããŠããŸãã ãããããã¡ãããéã©ãã³ç³»ã¢ã«ãã¡ãããããã³å°å·ã·ã¹ãã ã®ãŠãŒã¶ãŒã¯ããªãœãŒã¹ã«ãã€ã³ã¿ãŒãããã¢ãã¬ã¹ããæžãçããŠããªã³ã¯ãšããŠäœ¿çšã§ããå¿
èŠããããŸãã
çæ³çã«ã¯ããŠãŒã¶ãŒã«è¡šç€ºããããã®åœéåããŒãžã§ã³ãšããããã¯ãŒã¯èŠæ±ã§å
éšçã«äœ¿çšããããã®ASCIIããŒãžã§ã³ãçšæããŸãã
åœéçãªãã¡ã€ã³åã®å Žåãååã¯punycodeã«å€æããããããéASCIIãšã³ã³ãŒãåã«ã€ããŠäœãç¥ããªãéåžžã®DNSãµãŒããŒã§èªã¿åãããšãã§ããŸãã URIã«ã¯IDNããããŸããã IRIãšWHATWGã«ããURL-ããããŸãã Surlã¯ãã¹ãIDNããµããŒãããŠããŸãã
WHATWGã¯ãURLã¯UTF-8ã䜿çšã§ããããURIã¯ASCIIã®ã¿ã§ãããšè¿°ã¹ãŠããŸãã Curlã¯ããã¹ãæå®ããã¢ãã¬ã¹ã®éšåã§éASCIIæåãåãå
¥ããŸããããçºä¿¡èŠæ±ã§ããŒã»ã³ããŒãžã§ãšã³ã³ãŒãããŸãã ããã«ãããéASCIIæåããããšãã°Windowsã®æšæºã§ããUTF-8以å€ã®ã³ãŒãã§è¡šç€ºããããšããèå³æ·±ããå¯äœçšãçããŸãã
äžèšã§æžãããã®ãšåæ§ã«ãããã¯ãµãŒããŒãHTTPããããŒå
ã®éASCIIã³ãŒããéãè¿ãããã©ãŠã¶ãŒãåãå
¥ããããšãæãã§ãããéãã©ãŠã¶ãŒãããããæäœããå¿
èŠããããŸãã
URLæšæºã¯ååšããŸãã
ç§ã¯åé¡ãççŸã®å®å
šãªãªã¹ããæäŸããããšã¯ããŸããã§ãã-ããã§ç§ãæè¿ééããå°é£ã®äžéšã玹ä»ããŸãã ãã¡ãããããå Žæã§çºè¡ããããURLãã¯ãå¥ã®å Žæã§ãURLããšããŠåãå
¥ããããããç解ããããããããã§ã¯ãããŸããã
æè¿ã§ã¯ãcurlã§ããå
¬éãããä»æ§ã«å³å¯ã«ã¯æºæ ããŠããŸããããWebäºææ§ãã®ããã«åŸã
ã«å質ãäœäžããŠããŸãã
åäžã®URLæšæºã¯ãªãããã®æ¹åã§äœæ¥ã¯è¡ãããŠããŸããã WHATWGã¯ããããè¡ãããã®çã®åªåãããŠãããšã¯èããããŸãããããåºãã³ãã¥ããã£ãåŒãä»ããããã®çå£ãªè©Šã¿ãªãã«ãä»æ§ãéããã°ã«ãŒãã§æžããŠããããã§ãã