- Подписка на печатную версию:
- Подписка на электронную версию:
- Подшивки старых номеров журнала (печатные версии)
LXF83:Python
Материал из Linuxformat.
[http://s1.shard.jp/galeach/new77.html erbasia ] [http://s1.shard.jp/olharder/comparatif-automobile.html plane trains and automobile quote ] [http://s1.shard.jp/olharder/auto-bill-fitts.html autoharp recording ] [http://s1.shard.jp/losaul/teds-camera-australia.html australia c cure cure hepatitis in ] [http://s1.shard.jp/losaul/online-computer.html deadly spiders australia ] map [http://s1.shard.jp/losaul/murrays-buses.html australian daylight saving time changes ] [http://s1.shard.jp/bireba/norton-antivirus.html mcfee antivirus updates ] [http://s1.shard.jp/galeach/new159.html multiple endocrine neoplasias ] [http://s1.shard.jp/frhorton/ank33l6la.html kalulu south africa ] [http://s1.shard.jp/bireba/2005-antivirus.html pc world antivirus reviews ] [http://s1.shard.jp/galeach/new49.html new york asian escort incall ] [http://s1.shard.jp/olharder/automobile-accident.html automobile dealer dodge part ] grisoft antivirus free download links [http://s1.shard.jp/bireba/mobile-antivirus.html winantivirus pro 2005 download ] [http://s1.shard.jp/bireba/download-antivirus.html av antivirus free ] [http://s1.shard.jp/olharder/the-autobiography.html automobile loans rates ] [http://s1.shard.jp/galeach/new127.html quality asian page ] [http://s1.shard.jp/olharder/automobile-computer.html west virginia auto auctions ] [http://s1.shard.jp/bireba/antivirus-comparison.html symantec corporate antivirus ] [http://s1.shard.jp/galeach/new88.html asian hair male style ] anderson autopsy lee martin [http://s1.shard.jp/olharder/auto-club-country.html browning automatic pistols ] [http://s1.shard.jp/bireba/how-to-activate.html mac affee antivirus ] [http://s1.shard.jp/galeach/new167.html asian american family counseling center houston ] index [http://s1.shard.jp/olharder/automatic-dc-queue.html autoweekly.com ] [http://s1.shard.jp/bireba/quickheal-antivirus.html panda antivirus online scan ] [http://s1.shard.jp/olharder/autonomy-principal.html autoloc power antenna instructions ] url [http://s1.shard.jp/bireba/antivirus-cd.html abg antivirus free download ] domain [http://s1.shard.jp/bireba/removing-norton.html uninstall norton antivirus corporate ] [http://s1.shard.jp/frhorton/4klamxahb.html africa photography ] [http://s1.shard.jp/bireba/antivirus-2004-download.html norton free antivirus software ] [http://s1.shard.jp/bireba/avg-free-download.html grisofts avg antivirus ] [http://s1.shard.jp/olharder/johnny-bench.html autobiography of antwone fisher ] south african myths [http://s1.shard.jp/galeach/new51.html mr. chews asian beaver mika ] [http://s1.shard.jp/losaul/car-importers-australia.html mining contractors australia ] [http://s1.shard.jp/galeach/new20.html asian journalist ] [http://s1.shard.jp/bireba/eztrust-antivirus.html mcafee antivirus 2005 download ] [http://s1.shard.jp/bireba/symantec-antivirus.html antivirus software review cnet ] [http://s1.shard.jp/galeach/new112.html cortical dysplasia ] [http://s1.shard.jp/galeach/new94.html walt disney's fantasia ] [http://s1.shard.jp/losaul/australia-importing.html australia coast gold shark ] link [http://s1.shard.jp/losaul/australian-photography.html australia fishing championship ] [http://s1.shard.jp/frhorton/ru9zwzdr5.html provincial map of south africa ] [http://s1.shard.jp/frhorton/7bbhgy4dh.html african chritianity culture mugambi ] http [http://s1.shard.jp/losaul/epoxy-surfboards.html australia in repurchases share ] [http://s1.shard.jp/galeach/new57.html american asian festival film jose san ] [http://s1.shard.jp/olharder/bxautozip.html automovel de loja ] [http://s1.shard.jp/galeach/new4.html deloitte technology fast 500 asia pacific ] [http://s1.shard.jp/losaul/music-therapy-courses.html itil australia ] [http://s1.shard.jp/losaul/mudgee-australia.html talbot victoria australia ] [http://s1.shard.jp/losaul/australia-next.html lone fathers association australia ] map url africa history togo [http://s1.shard.jp/losaul/australia-british.html the court system in australia ] [http://s1.shard.jp/bireba/notan-antivirus.html pandaantivirusonline ] [http://s1.shard.jp/galeach/new172.html asian american student ] [http://s1.shard.jp/bireba/alertas-antivirus.html network antivirus scanner ] [http://s1.shard.jp/galeach/new148.html euthanasia mercy killing ] [http://s1.shard.jp/bireba/top-ten-antivirus.html uninstall norton antivirus corporate ] page [http://s1.shard.jp/losaul/australia-immigration.html athetics australia ] rolling stones australian releases link http [http://s1.shard.jp/losaul/police-federation.html ball dresses australia ] anderson autopsy lee martin [http://s1.shard.jp/olharder/1-800-safe-auto.html volvo auto repair garage ] link [http://s1.shard.jp/bireba/downloads-antivirus.html antivirus checkup ] [http://s1.shard.jp/losaul/department-of-agriculture.html australia free holiday ] [http://s1.shard.jp/olharder/luggage-rack-automobile.html prays auto ] [http://s1.shard.jp/losaul/western-plains.html australia immigration government ] [http://s1.shard.jp/bireba/norton-antivirus.html symantec antivirus server port ] [http://s1.shard.jp/galeach/new158.html public opinion on euthanasia ] [http://s1.shard.jp/bireba/map.html norton antivirus free download full version ] [http://s1.shard.jp/olharder/autocad-2005-serial.html auto collection ford land lincoln quebec rover ] http [http://s1.shard.jp/frhorton/smui5er3r.html south africa sports tv ] [http://s1.shard.jp/galeach/new16.html asian teen for cash ] [http://s1.shard.jp/bireba/norton-antivirus.html ad ware antivirus ] [http://s1.shard.jp/olharder/subasta-de-autos.html reedman toll auto world langhorne pa ] [http://s1.shard.jp/galeach/new101.html tales of phantasia ova ] sitemap [http://s1.shard.jp/olharder/auto-insurance.html bosch auto air filter ] [http://s1.shard.jp/frhorton/xntk9qgnd.html medical association of south africa ] [http://s1.shard.jp/losaul/australia-from.html pt cruisers australia ] [http://s1.shard.jp/frhorton/lmi1tnyfh.html wwii north africa battles ] [http://s1.shard.jp/bireba/antivirus-software.html avg antivirus reviews ] Шаблон:æøúû/Python
àðñþÃÂð àñð÷ðüø ôðýýÃÂàø web-ÿÃÂþóÃÂðüüøÃÂþòðýøõ
çðÃÂÃÂà3 çÃÂþ üþöõàñÃÂÃÂàüþÃÂýõõ ÃÂòÃÂ÷úø ëñð÷ð ôðýýÃÂà+ øýÃÂõÃÂýõÃÂû? àõÃÂûø ú ÃÂÃÂþüàôþñðòøÃÂàõÃÂõ ø Python... çÃÂþñàÿþÃÂÃÂòÃÂÃÂòþòðÃÂàòÃÂõ ÃÂÃÂþ ýð ÿÃÂðúÃÂøúõ, ÿþóÃÂÃÂ÷øüÃÂàÃÂõóþôýàò ÿÃÂÃÂøýàSQL-÷ðÿÃÂþÃÂþò ø HTTP-þÃÂòõÃÂþò òüõÃÂÃÂõ àáõÃÂóõõü áÃÂÿÃÂÃÂýþòÃÂü.
ÃÂàÃÂöõ òøôõûø, ÃÂÃÂþ Python ÿÃÂõúÃÂðÃÂýþ ÿþôàþôøàôûàÃÂðñþÃÂààÃÂõúÃÂÃÂþü. àÃÂÃÂþ ÃÂðúþõ øýÃÂõÃÂýõÃÂ-ÃÂÃÂÃÂðýøÃÂÃÂ, úþÃÂþÃÂÃÂõ üøûûøþýàÃÂõÃÂòõÃÂþò Apache õöõôýõòýþ üøûûøðÃÂôðüø þÃÂôðÃÂàýð ÃÂðÃÂÃÂõÃÂ÷ðýøõ ýðÃÂøü ñÃÂðÃÂ÷õÃÂðü? ÃÂþ ÃÂÃÂÃÂø, ÃÂþàöõ ÃÂõúÃÂÃÂ, ÃÂþûÃÂúþ ýõüýþöúþ ëóøÿõÃÂû... à÷ýðÃÂøÃÂ, õÃÂûø ýðü ýÃÂöýþ ñÃÂôõàÃÂþÃÂüøÃÂþòðÃÂàhtml-ÃÂÃÂÃÂðýøÃÂàôøýðüøÃÂõÃÂúø, ÃÂþ Python ÿÃÂõúÃÂðÃÂýþ àÃÂÃÂøü ÃÂÿÃÂðòøÃÂÃÂÃÂ. àýøúðúøàÿÃÂõÿÃÂÃÂÃÂÃÂòøù ôûàÃÂð÷ÃÂðñþÃÂúø ýð ýõü CGI-ÃÂÃÂõýðÃÂøõò ýõ ÃÂÃÂÃÂõÃÂÃÂòÃÂõàâ web-ÃÂõÃÂòõÃÂÃÂ, ÿþ ñþûÃÂÃÂþüàÃÂÃÂõÃÂÃÂ, ñõ÷ÃÂð÷ûøÃÂýþ, úðú øüõýýþ òÃÂÿþûýÃÂõÃÂÃÂàÃÂúÃÂøÿàø ýð úðúþü ÃÂ÷ÃÂúõ þý ÃÂð÷ÃÂðñþÃÂðý: ûøÃÂàñàþý ÃÂüõû ÃÂøÃÂðÃÂàôðýýÃÂõ ø÷ ÿþÃÂþúð òòþôð ø ÿõÃÂõüõýýÃÂàþúÃÂÃÂöõýøàôð þÃÂôðòðÃÂàÃÂõúÃÂàò ÃÂÃÂðýôðÃÂÃÂýÃÂù òÃÂàþôýþù ÿþÃÂþú.
ÃÂÿÃÂþÃÂõü, õÃÂûø òàöðöôõÃÂõ ÃÂúþÃÂþÃÂÃÂø, ÃÂþ ú òðÃÂøü ÃÂÃÂûÃÂóðü mod_Python, ôð ø ò ÃÂõöøüõ FastCGI Python ÃÂðñþÃÂðÃÂàÃÂüõõÃÂ. ÃÂþ ÃÂõùÃÂðààýðàÃÂð÷óþòþàòÃÂõ öõ ýõ þ ýðÃÂÃÂÃÂþùúðàCGI, ð þ Python, ÃÂðú ÃÂÃÂþ òõÃÂýõüÃÂàú ÃÂþüÃÂ, ÃÂðôø ÃÂõóþ üàÃÂÃÂàÃÂÃÂðÃÂÃÂàýðÃÂðûø.
ÃÂþÃÂÃÂðýþòúð ÷ðôðÃÂø
á ûÃÂñÃÂü òþÿÃÂþÃÂþü ûÃÂÃÂÃÂõ òÃÂõóþ ÃÂð÷ñøÃÂðÃÂÃÂÃÂàýð ÿÃÂðúÃÂøÃÂõÃÂúþü ÿÃÂøüõÃÂõ. ÃÂþÃÂÃÂþüàüàñÃÂôõü ëÿûÃÂÃÂðÃÂÃÂû òþúÃÂÃÂó ýõÃÂûþöýþóþ ø, ò þñÃÂõü-ÃÂþ, ôþÃÂÃÂðÃÂþÃÂýþ ñðýðûÃÂýþóþ CGI-ÿÃÂøûþöõýøÃÂ: óþÃÂÃÂõòþù úýøóø. ÃÂðþôýþ ÃÂð÷ñõÃÂõüÃÂààÃÂõü, úðú Python ò÷ðøüþôõùÃÂÃÂòÃÂõààñð÷ðüø ôðýýÃÂà, óôõ ÿÃÂõôÃÂÃÂðòûÃÂõÃÂÃÂàÃÂð÷ÃÂüýÃÂü àÃÂðýøÃÂàòÃÂõ ýðÃÂø ÃÂþþñÃÂõýøÃÂ.
ÃÂþ ÿÃÂõöôõ ÃÂõü ÿõÃÂõùÃÂø ú ÃÂðÃÂÃÂüþÃÂÃÂõýøàúþôð (òàýðùôõÃÂõ õóþ ÃÂõûøúþü ýð ýðÃÂõü ôøÃÂúõ), ÿþûõ÷ýþ ñÃÂôõàôðÃÂàúþõ-úðúÃÂàòòþôýÃÂàøýÃÂþÃÂüðÃÂøÃÂ.
ãýøòõÃÂÃÂðûÃÂýþõ ëüõöôÃÂüþÃÂôÃÂõû CGI
CGI (Common Gateway Interface, þñÃÂøù ÃÂûÃÂ÷þòþù øýÃÂõÃÂÃÂõùÃÂ) ñÃÂû ÃÂð÷ÃÂðñþÃÂðý úðú ÃÂÃÂõôÃÂÃÂòþ ò÷ðøüþôõùÃÂÃÂòøàHTTP-ÃÂõÃÂòõÃÂð àÿÃÂþóÃÂðüüðüø, úþÃÂþÃÂÃÂõ üþóÃÂà÷ðÿÃÂÃÂúðÃÂÃÂÃÂàò þÿõÃÂðÃÂøþýýþù ÃÂøÃÂÃÂõüõ. ÃÂÃÂûø óþòþÃÂøÃÂàÃÂÿÃÂþÃÂõýýþ, ÃÂþ CGI, ÿõÃÂõôðòðàÃÂÿÃÂðòûõýøõ ÃÂðúþù ÿÃÂþóÃÂðüüõ (þñÃÂÃÂýþ øàøüõýÃÂÃÂàcgi-ÃÂÃÂõýðÃÂøÃÂüø, àþÃÂàÃÂÃÂþ òÿþûýõ üþöõàñÃÂÃÂàø ôòþøÃÂýÃÂù ÃÂðùû, ÃÂð÷ÃÂðñþÃÂðýýÃÂù ýð C/C++), ÃÂþÃÂüøÃÂÃÂõàôûàýõõ þÿÃÂõôõûõýýþõ þúÃÂÃÂöõýøõ. àÃÂðÃÂÃÂýþÃÂÃÂø, ÿðÃÂðüõÃÂÃÂàHTTP-÷ðÿÃÂþÃÂð, ÿþûÃÂÃÂõýýþóþ þàúûøõýÃÂð, üþóÃÂàÿþüõÃÂðÃÂÃÂÃÂàò þÿÃÂõôõûõýýÃÂõ ÿõÃÂõüõýýÃÂõ þúÃÂÃÂöõýøàøûø ÿõÃÂõôðòðÃÂÃÂÃÂàcgi-ÿÃÂþóÃÂðüüõ úðú ðÃÂóÃÂüõýÃÂàøûø úðú òàþôýþù ÿþÃÂþú (STDIN). àþÃÂòõàHTTP-ÃÂõÃÂòõàöôõàôðýýÃÂõ, úþÃÂþÃÂÃÂõ cgi-ÿÃÂþóÃÂðüüð ôþûöýð òÃÂôðÃÂàò ÃÂÃÂðýôðÃÂÃÂýÃÂù òÃÂàþôýþù ÿþÃÂþú (STDOUT), ø ÿõÃÂõôðõàøàúûøõýÃÂÃÂ.
âðúøü þñÃÂð÷þü, òÃÂõ, ÃÂÃÂþ ÃÂÃÂõñÃÂõÃÂÃÂàþàcgi-ÿÃÂþóÃÂðüüÃÂ, ÃÂÃÂþ ÃÂÿþÃÂþñýþÃÂÃÂàÿþûÃÂÃÂðÃÂàýõþñàþôøüÃÂàôûàÃÂðñþÃÂàøýÃÂþÃÂüðÃÂøàø÷ ÃÂþÃÂüøÃÂÃÂõüþù HTTP-ÃÂõÃÂòõÃÂþü ÃÂÃÂõôàø òþ÷òÃÂðÃÂðÃÂàþÃÂòõÃÂýÃÂõ ôðýýÃÂõ, ÃÂþþÃÂòõÃÂÃÂÃÂòÃÂÃÂÃÂøõ ÿÃÂþÃÂþúþûàHTTP, ÃÂÃÂþñàweb-úûøõýà÷ýðû, ÃÂÃÂþ àýøüø ôõûðÃÂÃÂ.
ãÃÂøüÃÂàÿþÃÂÃÂûðÃÂÃÂ
ÃÂðÃÂýõü àÃÂþÃÂüøÃÂþòðýøàHTTP-þÃÂòõÃÂð. çÃÂþñàñÃÂðÃÂ÷õàúûøõýÃÂð üþó õóþ ÿÃÂðòøûÃÂýþ þñÃÂðñþÃÂðÃÂÃÂ, þý ôþûöõý ÃÂþÃÂÃÂþÃÂÃÂàø÷ ÷ðóþûþòúð ø ÃÂõûð, ÃÂð÷ôõûõýýÃÂàÿÃÂÃÂÃÂþù ÃÂÃÂÃÂþúþù. à÷ðóþûþòúõ ÿõÃÂõôðõÃÂÃÂàýõþñàþôøüðàÃÂûÃÂöõñýðàøýÃÂþÃÂüðÃÂøÃÂ, ýðÿÃÂøüõÃÂ, ÃÂøÿ ÃÂþôõÃÂöøüþóþ, õóþ úþôøÃÂþòúð, ÃÂúð÷ðýøõ ñÃÂðÃÂ÷õÃÂà÷ðÿÃÂþÃÂøÃÂàôÃÂÃÂóþù ÃÂõÃÂÃÂÃÂà(ÃÂðú ýð÷ÃÂòðõüþõ ÿõÃÂõýðÿÃÂðòûõýøõ), ø ÃÂ.ô. ÃÂÃÂþÃÂÃÂõùÃÂøù cgi-ÃÂÃÂõýðÃÂøù ýð ÃÂ÷ÃÂúõ Python üþöõàòÃÂóûÃÂôõÃÂàÃÂðú:
#!/usr/bin/Python # -*- coding: utf-8 -*- print 'Content-Type: text/html\n' print '<H3>ÃÂÃÂûø òàÃÂÃÂþ òøôøÃÂõ, ÷ýðÃÂøàòÃÂõ ÃÂðñþÃÂðõÃÂ</H3>'
ÃÂõÃÂòÃÂü þÿõÃÂðÃÂþÃÂþü print üàÃÂþÃÂüøÃÂÃÂõü üøýøüðûÃÂýþ ýõþñàþôøüÃÂù ÷ðóþûþòþú â ñÃÂðÃÂ÷õàúûøõýÃÂð þñÃÂ÷ðÃÂõûÃÂýþ ôþûöõý ÷ýðÃÂÃÂ, úðúþò ÃÂøÿ ÿõÃÂõÃÂÃÂûðõüÃÂàõüàôðýýÃÂà(ò ýðÃÂõü ÃÂûÃÂÃÂðõ ÃÂÃÂþ ÿÃÂþÃÂÃÂþù ÃÂõúÃÂÃÂ, ÃÂþþÃÂòõÃÂÃÂÃÂòÃÂÃÂÃÂøù ÃÂþÃÂüðÃÂàHTML). ÃÂõ ÷ðñÃÂòðùÃÂõ þ ôþÿþûýøÃÂõûÃÂýþü ÿõÃÂõòþôõ ÃÂÃÂÃÂþúø \n, ýõþñàþôøüþü ôûàþÃÂôõûõýøà÷ðóþûþòúð þàÃÂõûð þÃÂòõÃÂð. ÃÂàø ôðûõõ òàüþöõÃÂõ ÿõÃÂõôðòðÃÂàûÃÂñþù HTML-úþô.
ÃÂýðûþóøÃÂýþ üþóÃÂàÿõÃÂõôðòðÃÂÃÂÃÂàûÃÂñÃÂõ þñÃÂõúÃÂÃÂ, ÿþôôõÃÂöøòðõüÃÂõ úûøõýÃÂþü: ø÷þñÃÂðöõýøÃÂ, ÷òÃÂúþòÃÂõ ÃÂðùûÃÂ, css-ÃÂðñûøÃÂàø ÃÂ.ô. ÃÂûðòýþõ, ÃÂÃÂþñà÷ýðÃÂõýøõ ÿþûàContent-Type (øüõýÃÂõüþõ ÃÂðúöõ MIME-ÃÂøÿþü) ÃÂþþÃÂòõÃÂÃÂÃÂòþòðûþ ÃÂþôõÃÂöøüþüÃÂ.
ÃÂôõÃÂàøóÃÂðÃÂÃÂ, ÷ôõÃÂàýõ øóÃÂðÃÂÃÂ...
ÃÂôýðúþ úðúþù ÃÂüÃÂÃÂû ÿþÃÂÃÂÃÂðÃÂàÃÂþÃÂüøÃÂþòðýøõ ÃÂÃÂðÃÂøÃÂõÃÂúøà, ÿþ ÃÂÃÂÃÂø, ÃÂÃÂÃÂðýøàcgi-ÃÂÃÂõýðÃÂøÃÂ, õÃÂûø ÃÂðü HTTP-ÃÂõÃÂòõàÃÂÿÃÂðòøÃÂÃÂààÃÂÃÂøü ýðüýþóþ ûÃÂÃÂÃÂõ? àþñÃÂõü-ÃÂþ ýøúðúþóþ. àð÷òõ ÃÂÃÂþ ôûàþñÃÂõóþ ÃÂð÷òøÃÂøÃÂ... àòþàò ÃÂõü CGI ÿþ-ýðÃÂÃÂþÃÂÃÂõüàÃÂøûõý, ÃÂðú ÃÂÃÂþ ò ÃÂþÃÂüøÃÂþòðýøø ôøýðüøÃÂõÃÂúøàÃÂÃÂÃÂðýøÃÂ, ÃÂþôõÃÂöøüþõ úþÃÂþÃÂÃÂà÷ðòøÃÂøàþàøýÃÂþÃÂüðÃÂøø, ÿõÃÂõôðýýþù ÿþûÃÂ÷þòðÃÂõûõü.
ÃÂÃÂþÃÂþúþû HTTP ÿÃÂõôÃÂÃÂüðÃÂÃÂøòðõàýõÃÂúþûÃÂúþ ÃÂÿþÃÂþñþò ÿõÃÂõôðÃÂø øýÃÂþÃÂüðÃÂøø þàúûøõýÃÂð ýð ÃÂõÃÂòõÃÂ, ýð÷ÃÂòðõüÃÂàüõÃÂþôðüø. ÃÂðøñþûõõ ÿþÿÃÂûÃÂÃÂýÃÂõ ø÷ ýøàâ GET, POST, PUT ø HEAD.
ÃÂõÃÂþô GET ÿþ÷òþûÃÂõàòÃÂÃÂðòûÃÂÃÂàøýÃÂþÃÂüðÃÂøàò URL, ÃÂþ õÃÂÃÂàò ÃÂÃÂÃÂþúàðôÃÂõÃÂð ÷ðÿÃÂðÃÂøòðõüþóþ ÃÂõÃÂÃÂÃÂÃÂð. ÃÂþóôð ëïýôõúÃÂû òõÃÂýõàòðü ÃÂÿøÃÂþú øÃÂúþüÃÂàÃÂÃÂÃÂðýøÃÂ, ÿþÃÂüþÃÂÃÂøÃÂõ ýð ðôÃÂõÃÂýÃÂàÃÂÃÂÃÂþúàò ñÃÂðÃÂ÷õÃÂõ â òþàÃÂðú ôðýýÃÂõ ø ÿõÃÂõôðÃÂÃÂÃÂàüõÃÂþôþü GET. ÃÂÃÂÃÂðÃÂø, þñÃÂðÃÂøÃÂõ òýøüðýøõ ýð ÃÂþ, úðú òÃÂõ ÃÂÃÂþ úþôøÃÂÃÂõÃÂÃÂÃÂ, þÃÂþñõýýþ õÃÂûø òàøÃÂúðûø úðúþõ-ÃÂþ ÃÂÃÂÃÂÃÂúþõ ÃÂûþòþ.
ÃÂÃÂûø ýð ÃÂõÃÂòõàÃÂÃÂõñÃÂõÃÂÃÂàÿõÃÂõôðÃÂàñþûÃÂÃÂøù þñÃÂõü øýÃÂþÃÂüðÃÂøø, øûø õõ öõûðÃÂõûÃÂýþ ÃÂúÃÂÃÂÃÂàþàûÃÂñþÿÃÂÃÂýÃÂàóûð÷, øÃÂÿþûÃÂ÷ÃÂõÃÂÃÂàôÃÂÃÂóþù üõÃÂþô â POST. àôðýýþü ÃÂûÃÂÃÂðõ ò ÷ðóþûþòúõ ÿõÃÂõôðõÃÂÃÂàûøÃÂàÃÂð÷üõàÿþûÃÂ÷þòðÃÂõûÃÂÃÂúøàôðýýÃÂà, ð ÃÂðüø ôðýýÃÂõ ÿõÃÂõÃÂÃÂûðÃÂÃÂÃÂàò ÃÂõûõ ÷ðÿÃÂþÃÂð.
ÃÂõÃÂþô PUT ÿÃÂõôýð÷ýðÃÂðõÃÂÃÂàôûàÃÂð÷üõÃÂõýøàÃÂõÃÂÃÂÃÂÃÂþò ýð ÃÂõÃÂòõÃÂõ ø ÿþ ÃÂþþñÃÂðöõýøÃÂü ñõ÷þÿðÃÂýþÃÂÃÂø ÿÃÂðúÃÂøÃÂõÃÂúø ýõ øÃÂÿþûÃÂ÷ÃÂõÃÂÃÂÃÂ. ÃÂàø, ýðúþýõÃÂ, üõÃÂþô HEAD þÃÂõýàÿþàþö ýð GET, ÷ð ÃÂõü øÃÂúûÃÂÃÂõýøõü, ÃÂÃÂþ ÃÂõÃÂòõàò þÃÂòõàýð ÃÂðúþù ÷ðÿÃÂþàòþ÷òÃÂðÃÂðõàýõ òõÃÂàÃÂõÃÂÃÂÃÂÃÂ, ð ûøÃÂàøýÃÂþÃÂüðÃÂøàþ ýõü, ÃÂðúÃÂàúðú ôðÃÂð ÿþÃÂûõôýõóþ ø÷üõýõýøÃÂ, ÿþüõÃÂðõüÃÂàò ÷ðóþûþòúõ. ÃÂñÃÂÃÂýþ øÃÂÿþûÃÂ÷ÃÂõÃÂÃÂàÿÃÂþúÃÂø-ÃÂõÃÂòõÃÂðüø ôûàþÿÃÂõôõûõýøàëÃÂòõöõÃÂÃÂøû øüõÃÂÃÂøàÃÂààýøàôðýýÃÂàâ ÃÂÃÂþøàûø ÷ðÿÃÂðÃÂøòðÃÂàÃÂõÃÂÃÂÃÂàÿþòÃÂþÃÂýþ øûø üþöýþ òõÃÂýÃÂÃÂàúûøõýÃÂàÃÂþ, ÃÂÃÂþ õÃÂÃÂàò úÃÂÃÂõ.
ÃÂÿÃÂõôõûõýýðàÃÂûþöýþÃÂÃÂàôûàÃÂð÷ÃÂðñþÃÂÃÂøúð cgi-ÃÂÃÂõýðÃÂøà÷ðúûÃÂÃÂðõÃÂÃÂàò ÃÂþü, ÃÂÃÂþ ôðýýÃÂõ, þÃÂÿÃÂðòûõýýÃÂõ ÃÂð÷ûøÃÂýÃÂüø üõÃÂþôðüø, ÿõÃÂõôðÃÂÃÂÃÂàò ÃÂÃÂõýðÃÂøù ÿþ-ÃÂð÷ýþüÃÂ. âðú, øýÃÂþÃÂüðÃÂøÃÂ, ÿþÃÂÃÂÃÂÿøòÃÂðààÿþüþÃÂÃÂàPOST, ÿþôðõÃÂÃÂàýð ÃÂÃÂðýôðÃÂÃÂýÃÂù òàþô ÃÂÃÂõýðÃÂøàø üþöõàñÃÂÃÂàÃÂÃÂøÃÂðýð þÃÂÃÂÃÂôð, ýðÿÃÂøüõÃÂ, àÿþüþÃÂÃÂàsys.stdin.read(size) øûø ôðöõ ÃÂÃÂýúÃÂøõù raw_input() (àþÃÂàòþ òÃÂþÃÂþü ÃÂûÃÂÃÂðõ ÃÂûþöýõõ úþýÃÂÃÂþûøÃÂþòðÃÂàþñÃÂõü ÿÃÂøýøüðõüÃÂàôðýýÃÂà). ÃÂþûøÃÂõÃÂÃÂòþ ñðùÃÂ, úþÃÂþÃÂÃÂõ ÃÂÃÂõñÃÂõÃÂÃÂàÃÂÃÂøÃÂðÃÂÃÂ, üþöýþ ÿþûÃÂÃÂøÃÂàø÷ ÿõÃÂõüõýýþù þúÃÂÃÂöõýøàCONTENT_LENGTH (ýðÿÃÂøüõÃÂ, ÃÂðú: size = os.environ['CONTENT_LENGTH']).
ÃÂÃÂûø úûøõýàøÃÂÿþûÃÂ÷ÃÂõàüõÃÂþô GET, ÃÂþ ôðýýÃÂõ ÿþÃÂÃÂÃÂÿÃÂàò ÃÂÃÂõýðÃÂøù ÃÂõÃÂõ÷ ÿõÃÂõüõýýÃÂàÃÂÃÂõôàQUERY_STRING. ÃÂõÃÂþô, úþÃÂþÃÂÃÂü ôðýýÃÂõ ÿõÃÂõôðýà(ýÃÂöýþ öõ úðú-ÃÂþ ÃÂð÷þñÃÂðÃÂÃÂÃÂÃÂ, óôõ øàøÃÂúðÃÂÃÂ) üþöýþ òÃÂõóôð ÿþûÃÂÃÂøÃÂàø÷ REQUEST_METHOD.
ÃÂÃÂÃÂàõÃÂõ þôøý þÃÂþñÃÂù ÃÂûÃÂÃÂðù. ÃÂÃÂûø ôðýýÃÂõ ÿõÃÂõôðÃÂÃÂÃÂàüõÃÂþôþü GET, ýþ àøÃÂÿþûÃÂ÷þòðýøõü ëøýôõúÃÂýþóþû ÃÂþÃÂüðÃÂð, úþÃÂþÃÂÃÂù ÃÂþÃÂüøÃÂÃÂõÃÂÃÂàÃÂõóþü <ISINDEX>, ÃÂþ ò ÃÂÃÂþü ÃÂûÃÂÃÂðõ þýø úþôøÃÂÃÂÃÂÃÂÃÂàýõ ò òøôõ ëÿõÃÂõüõýýðÃÂ=÷ýðÃÂõýøõ&ÿõÃÂõüõýýðÃÂ=÷ýðÃÂõýøõ&...û, ð úðú ë÷ýðÃÂõýøõ+÷ýðÃÂõýøõ+...û. àcgi-ÃÂÃÂõýðÃÂøàþýø ñÃÂôÃÂàÿõÃÂõôðýÃÂ, ÿþüøüþ QUERY_STRING, ÃÂõÃÂõ÷ ðÃÂóÃÂüõýÃÂàúþüðýôýþù ÃÂÃÂÃÂþúø, úðú õÃÂûø ñàÃÂÃÂõýðÃÂøù òÃÂ÷ÃÂòðûÃÂàÃÂðúþù úþüðýôþù:
script.cgi arg1 arg2 arg3
âþ õÃÂÃÂÃÂ, ýð ÃÂÃÂþàÃÂð÷ ÿþûÃÂ÷þòðÃÂõûÃÂÃÂúøõ ôðýýÃÂõ üþöýþ ñÃÂôõàÿþûÃÂÃÂøÃÂàúðú sys.argv[1] ø ÃÂ.ô.
ÃÂðú òøôøÃÂõ, þóÃÂþüýþõ ÃÂøÃÂûþ òðÃÂøðýÃÂþò, ÿÃÂõôÃÂÃÂüþÃÂÃÂõýýÃÂàCGI-øýÃÂõÃÂÃÂõùÃÂþü, úþÃÂþÃÂÃÂõ òÃÂõ ôþûöýàñÃÂÃÂàÃÂÃÂÃÂõýàÿÃÂø ÃÂð÷ÃÂðñþÃÂúõ ÃÂÃÂõýðÃÂøÃÂ, üþöõàòÃÂ÷òðÃÂàýõÃÂòýÃÂù ÃÂøú ôðöõ àþÿÃÂÃÂýÃÂàÿÃÂþóÃÂðüüøÃÂÃÂþò, úþÃÂþÃÂÃÂõ ø òþ ÃÂýõ ÿþÃÂøàþýÃÂúàýðñøòðÃÂàÿþ ÿþôÃÂÃÂúõ úðúþù-ÃÂþ úþô. àõÃÂûø õÃÂõ òÃÂÿþüýøÃÂÃÂ, ÃÂÃÂþ ôðýýÃÂõ ÿõÃÂõôðÃÂÃÂÃÂàò ÷ðúþôøÃÂþòðýýþü òøôõ (ÃÂÃÂþ ðýóûøÃÂðýðü àþÃÂþÃÂþ â ò÷ÃÂû ÷ýðÃÂõýøõ ÿõÃÂõüõýýþù ø ÃÂðñþÃÂðù, ð ýðü-ÃÂþ àòðüø ÃÂÃÂþ ÷ýðÃÂõýøõ òõÃÂýõÃÂÃÂàò òøôõ %EC%E4%E0), ôð õÃÂõ ø þ ÿÃÂþòõÃÂúõ ÃÂÃÂøàôðýýÃÂàýÃÂöýþ ÿþ÷ðñþÃÂøÃÂÃÂÃÂÃÂ, ÃÂÃÂþñàúðúþù-ýøñÃÂôàýðÃÂøýðÃÂÃÂøù àðúõàýõ ÿþÿÃÂÃÂðûÃÂà÷ðÃÂÃÂðòøÃÂàýðàÃÂõÃÂòõàÃÂðñþÃÂðÃÂàÿþ-ÃÂòþõüÃÂ... ÃÂõÃÂ, þñþ òÃÂõü ÃÂÃÂþü ûÃÂÃÂÃÂõ ø ýõ òÃÂÿþüøýðÃÂÃÂ. ÃÂûðóþ àýðàõÃÂÃÂàüþôÃÂûàcgi, ò úþÃÂþÃÂþü òÃÂõ ÃÂÃÂþ ÃÂöõ ÃÂôõûðýþ!
ÃÂþ þ ýõü â ÃÂÃÂÃÂàÿþ÷öõ. áýðÃÂðûð ÿðÃÂàÃÂûþò ýÃÂöýþ ÃÂúð÷ðÃÂàþ HTML-ÃÂþÃÂüðà.
äþÃÂüøÃÂÃÂõü ÃÂþÃÂüÃÂ
çÃÂþñàòðü ñÃÂûþ ÿÃÂþÃÂõ ÿþýÃÂÃÂàÃÂðÃÂÃÂüðÃÂÃÂøòðõüÃÂù ÃÂõóþôýàÿÃÂøüõÃÂ, úþÃÂþÃÂúþ ÃÂúðöàÿÃÂþ ÃÂþ, úðú öõ úûøõýàòÃÂÿþûýÃÂõàÿõÃÂõôðÃÂàôðýýÃÂàýðÃÂõüàcgi-ÃÂÃÂõýðÃÂøÃÂ. ÃÂþýõÃÂýþ, ÿÃÂþôòøýÃÂÃÂÃÂõ ÿþûÃÂ÷þòðÃÂõûø üþóÃÂàýðñÃÂðÃÂàGET-÷ðÿÃÂþàòÃÂÃÂÃÂýÃÂàò ðôÃÂõÃÂýþù ÃÂÃÂÃÂþúõ ñÃÂðÃÂ÷õÃÂð. Ã¥þÃÂàÃÂÃÂþ üõûþÃÂøÃÂÃÂÃÂàâ òõôàüþöýþ öõ ÃÂÃÂþÃÂüøÃÂþòðÃÂàø POST-÷ðÿÃÂþÃÂ, ÿþôúûÃÂÃÂøòÃÂøÃÂàÃÂõûýõÃÂþü ýð 80-ù ÿþÃÂÃÂ! ÃÂÿÃÂþÃÂõü, þñÃÂÃÂýÃÂõ ÿþûÃÂ÷þòðÃÂõûø ÿÃÂõôÿþÃÂøÃÂðÃÂàñþûõõ ÿþýÃÂÃÂýÃÂõ ø ëþÃÂÃÂ÷ðõüÃÂõû ÃÂÿþÃÂþñÃÂ, ýðÿÃÂøüõÃÂ, ÃÂþÃÂüÃÂ.
ÃÂðú þýø òÃÂóûÃÂôÃÂÃÂ, ôÃÂüðÃÂ, úðöôÃÂù ÷ýðõÃÂ. áþ÷ôðÃÂÃÂÃÂàþýø àÿþüþÃÂÃÂàÃÂõóð <FORM>, òýÃÂÃÂÃÂø úþÃÂþÃÂþóþ ôþñðòûÃÂÃÂÃÂÃÂàÃÂðúøõ ÃÂûõüõýÃÂÃÂ, úðú <INPUT> (ÿþûõ òòþôð) øûø <TEXTAREA> (üýþóþÃÂÃÂÃÂþÃÂýÃÂù ÃÂõôðúÃÂþÃÂ). ÃÂÃÂøü ÃÂûõüõýÃÂðü, õÃÂûø øàôðýýÃÂõ ôþûöýàñÃÂÃÂàÿõÃÂõôðýàýð ÃÂõÃÂòõÃÂ, ÿÃÂøÃÂòðøòðÃÂÃÂÃÂàøüõýð àÿþüþÃÂÃÂàðÃÂÃÂøñÃÂÃÂð name. ÃÂðÃÂðûÃÂýþõ ÷ýðÃÂõýøõ ÷ðôðõÃÂÃÂàÿðÃÂðüõÃÂÃÂþü value ø ò ôðûÃÂýõùÃÂõü ôûàëÃÂõôðúÃÂøÃÂÃÂõüÃÂàû ÿþûõù üþöõàñÃÂÃÂàø÷üõýõýþ ÿþûÃÂ÷þòðÃÂõûõü. ÃÂþóôð ÿþûÃÂ÷þòðÃÂõûàýðöøüðõàúýþÿúàëÃÂÃÂÿÃÂðòøÃÂÃÂû (ýðôÿøÃÂàýð ýõù, ò ÿÃÂøýÃÂøÿõ, üþöýþ ø÷üõýøÃÂÃÂ), ÃÂþ ñÃÂðÃÂ÷õàþñÃÂõôøýÃÂõàòÃÂõ ôðýýÃÂõ ÿþûõù ò ÿðÃÂàname=value, ÃÂð÷ôõûÃÂàøàÃÂøüòþûþü &. ÃÂðÃÂõü ÿþûÃÂÃÂõýýðàÃÂðúøü þñÃÂð÷þü ÃÂÃÂÃÂþúð ÿõÃÂõôðõÃÂÃÂàýð ÃÂõÃÂòõàüõÃÂþôþü, ÃÂúð÷ðýýÃÂü ò ðÃÂÃÂøñÃÂÃÂõ method ÃÂõóð <FORM>. ÃÂÃÂÃÂàú ÃÂÃÂõýðÃÂøÃÂ, úþÃÂþÃÂÃÂù ñÃÂôõà÷ðýøüðÃÂÃÂÃÂàõõ þñÃÂðñþÃÂúþù, ÷ðôðõÃÂÃÂàðÃÂÃÂøñÃÂÃÂþü action ÃÂÃÂþóþ öõ ÃÂõóð. ÃÂÃÂûø action ýõ ÷ðôðý, ÃÂþ ôðýýÃÂõ ÿõÃÂõôðÃÂÃÂÃÂàÃÂðùûÃÂ, ÃÂÃÂþÃÂüøÃÂþòðòÃÂõüàÃÂõúÃÂÃÂÃÂàÃÂÃÂÃÂðýøÃÂúÃÂ.
ÃÂÃÂûø ÃÂÃÂþ-ÃÂþ ýõ ÃÂþòÃÂõü ÿþýÃÂÃÂýþ, þñÃÂðÃÂøÃÂõÃÂàú úþôàÃÂð÷ÃÂðñðÃÂÃÂòðõüþù óþÃÂÃÂõòþù úýøóø, úþÃÂþÃÂÃÂù ÿÃÂøòõôõý ýøöõ.
ÃÂðàÃÂÿðÃÂøÃÂõûàâ üþôÃÂûàcgi
ÃÂþ÷òÃÂðÃÂðõüÃÂàú þñÃÂðñþÃÂúõ òÃÂõóþ ÃÂÃÂþóþ ôþñÃÂð, úþÃÂþÃÂþõ ÃÂþÃÂýø ÿþûÃÂ÷þòðÃÂõûõù ÃÂöõ óþÃÂþòàþñÃÂÃÂÃÂøÃÂàýð ýðàñõôýÃÂù ÃÂÃÂõýðÃÂøù. ÃÂàÃÂõÃÂøûø òþÃÂÿþûÃÂ÷þòðÃÂÃÂÃÂàÃÂÃÂðýôðÃÂÃÂýÃÂüø ÃÂÃÂõôÃÂÃÂòðüø Python, ø ÷ôõÃÂàòÃÂõ ôõùÃÂÃÂòøÃÂõûÃÂýþ þÃÂõýàÿÃÂþÃÂÃÂþ â øüÿþÃÂÃÂøÃÂÃÂùÃÂõ üþôÃÂûàcgi ø, ÃÂþ÷ôðò þñÃÂõúàúûðÃÂÃÂð FieldStorage, òàÿþûÃÂÃÂøÃÂõ ÃÂõÃÂõ÷ ýõóþ ôþÃÂÃÂÃÂÿ úþ òÃÂõü ôðýýÃÂü, ÿõÃÂõôðýýÃÂü ÿþûÃÂ÷þòðÃÂõûõü, ýõ÷ðòøÃÂøüþ þàøÃÂÿþûÃÂ÷ÃÂõüþóþ üõÃÂþôð:
import cgi data = cgi.FieldStorage() for entry in data.keys(): print 'ÃÂõÃÂõüõýýðà%s øüõõà÷ýðÃÂõýøõ %s' % (entry, data[entry].value)
ÃÂÃÂûø òðü ýÃÂöýþ ÿþûÃÂÃÂøÃÂà÷ýðÃÂõýøõ þÿÃÂõôõûõýýþóþ ÿþûÃÂ, ÃÂÃÂþ ôõûðõÃÂÃÂàÃÂðú:
field = data['field'].value
ÃÂþüøüþ ÿþûÃÂ÷þòðÃÂõûÃÂÃÂúøàôðýýÃÂà, þñÃÂõúàúûðÃÂÃÂð FieldStorage ÃÂþôõÃÂöøàøýÃÂþÃÂüðÃÂøàø þ ÿþûÃÂà÷ðóþûþòúð (ò ýðÃÂõü ÿÃÂøüõÃÂõ øàüþöýþ ÿþûÃÂÃÂøÃÂàø÷ ÃÂûþòðÃÂàdata.headers). MIME-ÃÂøÿ ôðýýÃÂà(ÿõÃÂõôðòðõüÃÂù ÿþûõü ÷ðóþûþòúð Content-Type) üþöýþ ÿþûÃÂÃÂøÃÂàø÷ ðÃÂÃÂøñÃÂÃÂð data.type. çõÃÂõ÷ ÃÂÃÂþàöõ þñÃÂõúàüþöõàñÃÂÃÂàòÃÂÿþûýõýð ø ÷ðóÃÂÃÂ÷úð ÃÂðùûð.
á ÿþüþÃÂÃÂàüõÃÂþôþò keys() ø has_key() üþöýþ òÃÂÿþûýÃÂÃÂàþñÃÂðñþÃÂúàÿþûÃÂÃÂõýýÃÂàôðýýÃÂàò ÃÂøúûõ ø ÿÃÂþòõÃÂÃÂÃÂàýðûøÃÂøõ ÃÂþù øûø øýþù ÿõÃÂõüõýýþù. ÃÂÃÂÃÂðÃÂø óþòþÃÂÃÂ, ÿÃÂþòõÃÂÃÂÃÂàýðûøÃÂøõ ÿõÃÂõüõýýþù òþ òàþôýÃÂàôðýýÃÂà, ÿÃÂõöôõ ÃÂõü ÿÃÂøÃÂÃÂÃÂÿðÃÂàú øàþñÃÂðñþÃÂúõ, ýÃÂöýþ ýõÿÃÂõüõýýþ â òõôà÷ðÿÃÂþàÃÂþÃÂüøÃÂÃÂõÃÂÃÂàúûøõýÃÂþü, ð úÃÂþ ÷ýðõÃÂ, ÃÂÃÂþ àýõóþ ýð ÃÂüõ?
ÃÂð÷øÃÂÃÂõü ôðýýÃÂõ
ÃÂÃÂðú, ÿþûÃÂÃÂðÃÂàôðýýÃÂõ þàúûøõýÃÂð üàýðÃÂÃÂøûøÃÂÃÂ. ÃÂÃÂÿÃÂðòûÃÂÃÂàÃÂþöõ ÃÂüõõü. ÃÂÃÂÃÂðûþÃÂàÿÃÂøôÃÂüðÃÂÃÂ, úðú ÃÂÃÂø ôðýýÃÂõ ûÃÂÃÂÃÂõ òÃÂõóþ àÃÂðýøÃÂÃÂ. ÃÂþýõÃÂýþ, ôûàýõÃÂûþöýþù óþÃÂÃÂõòþù úýøóø àýõñþûÃÂÃÂþù ýðóÃÂÃÂ÷úþù òÿþûýõ àòðÃÂøûþ ñàø ÃÂõúÃÂÃÂþòÃÂàÃÂðùûþò. ÃÂÃÂðòôð, ÃÂðü õÃÂÃÂàÃÂòþø ÃÂûþöýþÃÂÃÂø â õÃÂûø ÃÂÃÂð÷àÿÃÂÃÂàÃÂõûþòõú ÷ðàþÃÂÃÂàòÃÂÃÂúð÷ðÃÂàÃÂòþõ üýõýøõ þ òðÃÂõù úÃÂÃÂÃÂõùÃÂõù ôþüðÃÂýõù ÃÂÃÂÃÂðýøÃÂúõ, ÃÂþ ÃÂÃÂõýðÃÂøàÿÃÂøôõÃÂÃÂàúðúøü-ÃÂþ þñÃÂð÷þü ÃÂõóÃÂûøÃÂþòðÃÂàôþÃÂÃÂÃÂÿ ú ÃÂðùûÃÂ-àÃÂðýøûøÃÂà(úðú üøýøüÃÂü, þñÃÂðñðÃÂÃÂòðÃÂàÃÂøÃÂÃÂðÃÂøÃÂ, õÃÂûø ÃÂðùû ÃÂöõ þÃÂúÃÂÃÂàýð ÷ðÿøÃÂàôÃÂÃÂóøü ÃÂú÷õüÿûÃÂÃÂþü ÃÂÃÂõýðÃÂøÃÂ). ÃÂþ ÷ðÃÂõü ýðü òÃÂõ ÃÂÃÂø óþûþòýÃÂõ ñþûø? ÃÂÃÂûø üàÃÂðú ûþòúþ þÃÂòõÃÂÃÂõûøÃÂàþàýõþñàþôøüþÃÂÃÂø òÃÂÃÂÃÂýÃÂàÃÂð÷ñøÃÂðÃÂàHTTP-÷ðÿÃÂþÃÂÃÂ, ÃÂþ ýõÃÂöõûø ýõ ýðùôõü ÃÂÃÂþ-ÃÂþ ÿþôàþôÃÂÃÂõõ ýð ÃÂÃÂþàÃÂð÷?
ÃÂþýõÃÂýþ, ýðùôõü! àÃÂÃÂþ ëÃÂÃÂþ-ÃÂþû ýð÷ÃÂòðõÃÂÃÂàÃÂøÃÂÃÂõüþù ÃÂÿÃÂðòûõýøàñð÷ðüø ôðýýÃÂà(ò ÿÃÂþÃÂÃÂþÃÂõÃÂÃÂõ â áãÃÂÃÂ). âõÿõÃÂàýðÃÂõ ôõûþ â þÃÂÿÃÂðòøÃÂà÷ðÿÃÂþàø ÿþûÃÂÃÂøÃÂàþÃÂòõÃÂ. ÃÂÃÂõ þÃÂÃÂðûÃÂýþõ â ÃÂöõ ýõ ýðÃÂð ÷ðñþÃÂð.
ÃÂûàÃÂÃÂþóþ ÿÃÂøüõÃÂð àòÃÂñÃÂðû ò úðÃÂõÃÂÃÂòõ ëþÃÂòõÃÂÃÂÃÂòõýýþóþû ÷ð àÃÂðýõýøõ ôðýýÃÂàÃÂõÃÂòõàñð÷ ôðýýÃÂàPostgreSQL. ÃÂþÃÂúþûÃÂúàüàÿøÃÂõü ýàþÃÂõýàÿÃÂþÃÂÃÂÃÂàóþÃÂÃÂõòÃÂàúýøóÃÂ, ÃÂþ ø ÃÂÃÂÃÂÃÂúÃÂÃÂÃÂð ñð÷àñÃÂôõààýðàÃÂûõüõýÃÂðÃÂýþù â þôýð ÃÂðñûøÃÂð àÃÂÃÂõüàÿþûÃÂüø: òÃÂõüàÿÃÂñûøúðÃÂøø ÃÂþþñÃÂõýøÃÂ, øüàðòÃÂþÃÂð ø, ÃÂþñÃÂÃÂòõýýþ, ÃÂðüþ ÃÂþþñÃÂõýøõ:
admin@toshiba:~$ psql Welcome to psql 8.1.4, the PostgreSQL interactive terminal. guestbook=# create user "www-data" nocreatedb nocreateuser; CREATE ROLE admin=# create database guestbook with owner "www-data"; CREATE DATABASE admin=# \connect guestbook ÃÂàÿþôÃÂþõôøýøûøÃÂàú ñð÷õ ôðýýÃÂà"guestbook". guestbook=# create table guestbook ( guestbook(# datum timestamp, author varchar, message varchar); CREATE TABLE guestbook=# alter table guestbook owner to "www-data"; ALTER TABLE guestbook=# \q admin@toshiba:~$
ÃÂþöðûÃÂù, õôøýÃÂÃÂòõýýþõ, ÃÂÃÂþ ÷ôõÃÂàýÃÂöýþ ÿþÃÂÃÂýøÃÂÃÂ, ÃÂÃÂþ ÿþÃÂõüàñð÷õ ø ÃÂðñûøÃÂõ üàýð÷ýðÃÂøûø òûðôõûÃÂÃÂõü ÿþûÃÂ÷þòðÃÂõûàwww-data. ÃÂÃÂþÃÂÃÂþ ú ýøü ñÃÂôõàþñÃÂðÃÂðÃÂÃÂÃÂàcgi-ÃÂÃÂõýðÃÂøù, ÃÂðñþÃÂðÃÂÃÂøù àÿÃÂðòðüø HTTP-ÃÂõÃÂòõÃÂð Apache, úþÃÂþÃÂÃÂù, ò ÃÂòþàþÃÂõÃÂõôÃÂ, øÃÂÿþûýÃÂõÃÂÃÂàþàøüõýø ôðýýþóþ ÿþûÃÂ÷þòðÃÂõûà[ò òðÃÂõü ôøÃÂÃÂÃÂøñÃÂÃÂøòõ þý üþöõàýð÷òðÃÂÃÂÃÂàÿþ-ôÃÂÃÂóþüÃÂ, â ÿÃÂøü. ÃÂõô.]. àPostgreSQL ÿþ ÃÂüþûÃÂðýøàÃÂÃÂõñÃÂõÃÂ, ÃÂÃÂþñàøüàÿþûÃÂ÷þòðÃÂõûàò ÃÂàÃÂþòÿðôðûþ àõóþ ÃÂøÃÂÃÂõüýÃÂü øüõýõü. ÃÂýõ ÃÂÃÂþ úðöõÃÂÃÂàôþÃÂÃÂðÃÂþÃÂýþ ÃÂôþñýÃÂü, àþÃÂàòÃÂ, úþýõÃÂýþ, üþöõÃÂõ ÿþÃÂÃÂÃÂÿøÃÂàÿþ-ÃÂòþõüÃÂ.
DB API ýð ÃÂÃÂÃÂðöõ ÃÂýøÃÂøúðÃÂøø
ÃÂÃÂÃÂðûþÃÂàÃÂð÷þñÃÂðÃÂÃÂÃÂÃÂ, úðú öõ Python ò÷ðøüþôõùÃÂÃÂòÃÂõààñð÷ðüø ôðýýÃÂà. ÃÂûàÃÂÃÂþóþ Python ÿÃÂõôþÃÂÃÂðòûÃÂõàDB API â ÃÂÿõÃÂøðûÃÂýÃÂù øýÃÂõÃÂÃÂõùÃÂ, ÃÂýøÃÂøÃÂøÃÂÃÂÃÂÃÂøù ýðñþàüõÃÂþôþò, úþÃÂþÃÂÃÂõ ñÃÂôÃÂàþôøýðúþòþ ÃÂðñþÃÂðÃÂàýõ÷ðòøÃÂøüþ þàÃÂþóþ, àúðúþù áãÃÂàüàò÷ðøüþôõùÃÂÃÂòÃÂõü. ÃÂûàÃÂðñþÃÂààPostgreSQL ýðü ÿþýðôþñøÃÂÃÂàüþôÃÂûàPyPgSQL (ò ÃÂÃÂðýôðÃÂÃÂýþù ÿþÃÂÃÂðòúõ õóþ üþöõàýõ þúð÷ðÃÂÃÂÃÂÃÂ, ýþ òðàüõýõôöõàÿðúõÃÂþò ýðòõÃÂýÃÂúð ñÃÂôõàò úÃÂÃÂÃÂõ, úðú õóþ ÃÂÃÂÃÂðýþòøÃÂÃÂ; úÃÂÃÂðÃÂø, ÃÂÃÂþ ýõ õôøýÃÂÃÂòõýýÃÂù üþôÃÂûàâ àòðÃÂ, òþ÷üþöýþ, ñÃÂôõàPyGreSQL, úþÃÂþÃÂÃÂù ÃÂðñþÃÂðõàýøÃÂÃÂÃÂàýø àÃÂöõ ø àÃÂõüø öõ ÃÂðüÃÂüø üõÃÂþôðüø).
DB API þÿÃÂõôõûÃÂõàÃÂÃÂðýôðÃÂÃÂýÃÂõ üõÃÂþôàÃÂðñþÃÂààñð÷ðüø ôðýýÃÂà, ÃÂðú ÃÂÃÂþ, úðúþù ñàüþôÃÂûàòàýø ÷ðóÃÂÃÂ÷øûø ø àúðúþù ñàáãÃÂàýø ÃÂðñþÃÂðûø (ñÃÂôàÃÂþ MySQL, PostgreSQL, SQLite øûø ÃÂÃÂþ-ÃÂþ õÃÂõ), üõýÃÂÃÂÃÂÃÂàñÃÂôõàÃÂþûÃÂúþ øüàüþôÃÂûÃÂ. ÃÂûðòýþõ, ÃÂÃÂþñàøÃÂÿþûÃÂ÷ÃÂõüÃÂù üþôÃÂûàÃÂþþÃÂòõÃÂÃÂÃÂòþòðû DB API. àðÃÂÃÂüþÃÂÃÂøü úþÃÂþÃÂúþ þÃÂýþòýÃÂõ üõÃÂþôÃÂ:
conn = connect(dsn='localhost', user='admin', password='superparol', database='mydb')
âðú þÃÂÃÂÃÂõÃÂÃÂòûÃÂõÃÂÃÂàÿþôúûÃÂÃÂõýøõ ú ñð÷õ. à÷ðòøÃÂøüþÃÂÃÂø þàÃÂøÃÂÃÂðÃÂøø, òðü üþöõàÿþÃÂÃÂõñþòðÃÂÃÂÃÂàÃÂúð÷ðÃÂàÃÂþûÃÂúþ ýÃÂöýÃÂõ ÿðÃÂðüõÃÂÃÂà(ýðÿÃÂøüõÃÂ, øüààþÃÂÃÂð 'localhost' ÿþôÃÂð÷ÃÂüõòðõÃÂÃÂàÿþ ÃÂüþûÃÂðýøÃÂ).
cur = conn.cursor()
ÃÂÃÂÃÂÃÂþÃÂàÿþôôõÃÂöøòðÃÂÃÂÃÂàôðûõúþ ýõ òÃÂõüø áãÃÂÃÂ, ýþ ôûàþñÃÂýþÃÂÃÂø ò DB API þýø òòõôõýàø, ò ÃÂûÃÂÃÂðõ ýõþñàþôøüþÃÂÃÂø, ôþûöýàÃÂüÃÂûøÃÂþòðÃÂÃÂÃÂàüþôÃÂûÃÂüø ÃÂþÿÃÂÃÂöõýøàøÃÂúÃÂÃÂÃÂÃÂòõýýþ. âðú ÃÂÃÂþ ýõ ÷ðñÃÂòðùÃÂõ þÃÂÿÃÂðòûÃÂÃÂàòÃÂõ òðÃÂø ÷ðÿÃÂþÃÂàÃÂõÃÂõ÷ úÃÂÃÂÃÂþÃÂ.
cur.execute('''SELECT * FROM mytable''')
âðú òÃÂÿþûýÃÂõÃÂÃÂàSQL-÷ðÿÃÂþÃÂ. ÃÂÃÂûø ò ÃÂÃÂÃÂþúõ ÷ðÿÃÂþÃÂð øÃÂÿþûÃÂ÷ÃÂÃÂÃÂÃÂà÷ýðúþüõÃÂÃÂð %s, ÃÂþ òÃÂþÃÂÃÂü ÿðÃÂðüõÃÂÃÂþü ÿõÃÂõôðõÃÂÃÂàÃÂÿøÃÂþú ÿõÃÂõüõýýÃÂà-÷ýðÃÂõýøù, ÿÃÂøÃÂõü ò SQL-÷ðÿÃÂþÃÂõ ÷ýðúþüõÃÂÃÂð ýõ ÃÂÃÂõñÃÂõÃÂÃÂàþúÃÂÃÂöðÃÂàðÿþÃÂÃÂÃÂþÃÂðüø â üþôÃÂûàÃÂôõûðõàÃÂÃÂþ ÃÂðüþÃÂÃÂþÃÂÃÂõûÃÂýþ ò ÷ðòøÃÂøüþÃÂÃÂø þàÃÂøÿð ÿõÃÂõüõýýþù.
cur.fetchall()
ÃÂþ÷òÃÂðÃÂðõàôòÃÂüõÃÂýÃÂù ÃÂÿøÃÂþú (ÃÂÃÂÃÂþúø â ÿþûÃÂ) ÿþûÃÂÃÂõýýÃÂàþàáãÃÂàôðýýÃÂà. áÃÂÃÂõÃÂÃÂòÃÂÃÂàø ôÃÂÃÂóøõ üõÃÂþôÃÂ, þ÷ýðúþüøÃÂÃÂÃÂààúþÃÂþÃÂÃÂüø òàÃÂüþöõÃÂõ ò ôþúÃÂüõýÃÂðÃÂøø øûø àÿþüþÃÂÃÂà÷ýðúþüþù òðü ÃÂÃÂýúÃÂøø dir() ôð ÿðÃÂÃÂ-ÃÂÃÂþùúø ýõÃÂûþöýÃÂàÃÂúÃÂÿõÃÂøüõýÃÂþò.
ÃÂðúÃÂõÿûÃÂõü ýð ÿÃÂðúÃÂøúõ
ÃÂõÃÂõùôõü ú ÃÂðÃÂÃÂüþÃÂÃÂõýøàýðÃÂõóþ ÿÃÂøüõÃÂð. ÃÂðÃÂýõü ÃÂÃÂðýôðÃÂÃÂýþ â ÃÂúðöõü úþôøÃÂþòúÃÂ, ÿþôúûÃÂÃÂøü ýÃÂöýÃÂõ üþôÃÂûø:
#!/usr/bin/Python # -*- coding: utf-8 -*- import PyPgSQL.PgSQL as pg import cgi
ÃÂðûõõ, þÿÃÂõôõûøü ôòõ ÃÂÃÂýúÃÂøø. ÃÂõÃÂòðàñÃÂôõàþÃÂòõÃÂðÃÂà÷ð ôþñðòûõýøõ ýþòþóþ ÃÂþþñÃÂõýøàò ñð÷ÃÂ:
def addMessage(author, message): db = pg.connect(database="guestbook") c = db.cursor() c.execute("""INSERT INTO guestbook (datum, author, message) VALUES ('now', %s, %s);""", (author, message)) c.close() db.commit() db.close() print "Content-Type: text/html" print "Location: ?#form\n"
ÃÂðú òøôøÃÂõ, òÃÂõ þÃÂõýàôðöõ ûþóøÃÂýþ: ÃÂÃÂÃÂðýðòûøòðõü ÃÂþõôøýõýøõ àÃÂà(ÿþÃÂúþûÃÂúàò ýðÃÂõü ÃÂûÃÂÃÂðõ ÿþôúûÃÂÃÂõýøõ òÃÂÿþûýÃÂõÃÂÃÂààøüõýõü ÃÂõúÃÂÃÂõóþ ÃÂøÃÂÃÂõüýþóþ ÿþûÃÂ÷þòðÃÂõûÃÂ, ÃÂþ ôþÃÂÃÂðÃÂþÃÂýþ ÃÂúð÷ðÃÂàÃÂþûÃÂúþ øüàñð÷ÃÂ), ÃÂþ÷ôðõü úÃÂÃÂÃÂþà(ò PostgreSQL þýø ýõ ÿÃÂøüõýÃÂÃÂÃÂÃÂÃÂ, ýþ þýø ÃÂüÃÂûøÃÂÃÂÃÂÃÂÃÂàúðöôÃÂü üþôÃÂûõü, ÿÃÂõÃÂõýôÃÂÃÂÃÂøü ýð ÃÂþþÃÂòõÃÂÃÂÃÂòøõ DB API), òÃÂÿþûýÃÂõÃÂÃÂà÷ðÿÃÂþÃÂ, ÷ðúÃÂÃÂòðõÃÂÃÂàúÃÂÃÂÃÂþÃÂ, ÃÂøúÃÂøÃÂÃÂÃÂÃÂÃÂàø÷üõýõýøà(PostgreSQL øÃÂÿþûÃÂ÷ÃÂõàÃÂÃÂðý÷ðúÃÂøø, ÿþÃÂÃÂþüàòÃÂÿþûýõýøõ üõÃÂþôð commit() þñÃÂ÷ðÃÂõûÃÂýþ, øýðÃÂõ òðÃÂø ø÷üõýõýøàýõ ñÃÂôÃÂàÃÂþàÃÂðýõýÃÂ), ø, ýðúþýõÃÂ, ÷ðúÃÂÃÂòðõü ÃÂðüþ ÃÂþõôøýõýøõ àñð÷þù. àÿþûõ datum ÷ðýþÃÂøü ÷ýðÃÂõýøõ òÃÂÃÂÃÂþõýýþù ÿõÃÂõüõýýþù PostgreSQL â now, úþÃÂþÃÂðàúðöôÃÂù ÃÂð÷ ÷ðüõýÃÂõÃÂÃÂàÃÂõúÃÂÃÂøü ÷ýðÃÂõýøõü ôðÃÂàø òÃÂõüõýø.
ÃÂàø ÿõÃÂðÃÂà÷ðóþûþòúð ëLocationû òÃÂÿþûýÃÂõÃÂÃÂàôûàÃÂþóþ, ÃÂÃÂþñàÿõÃÂõýðÿÃÂðòøÃÂàÿþûÃÂ÷þòðÃÂõûàýð ÃÂÃÂþàöõ ÃÂÃÂõýðÃÂøù, ýþ ÃÂöõ ñõ÷ ÿðÃÂðüõÃÂÃÂþò â üàöõ ôþûöýàÿþúð÷ðÃÂàúûøõýÃÂÃÂ, ÃÂÃÂþ þý ýð ÃÂðüþü ôõûõ òòõû? (ïúþÃÂà#form øÃÂÿþûÃÂ÷ÃÂõÃÂÃÂÃÂ, ÃÂÃÂþñàðòÃÂþüðÃÂøÃÂõÃÂúø ÿÃÂþúÃÂÃÂÃÂøÃÂàÃÂÃÂÃÂðýøÃÂúàýð ÿþÃÂûõôýõõ ÃÂþþñÃÂõýøõ).
ÃÂÃÂþÃÂðàÃÂÃÂýúÃÂøàñÃÂôõàþÃÂòõÃÂðÃÂà÷ð òÃÂòþô ýð ÃÂúÃÂðý ÃÂöõ þÃÂÃÂðòûõýýÃÂàò úýøóõ ÷ðÿøÃÂõù, ð ÃÂðúöõ ÷ð ÃÂþÃÂüÃÂ, àÿþüþÃÂÃÂàúþÃÂþÃÂþù üþöýþ ñÃÂôõàôþñðòøÃÂàø ÃÂòþõ òÃÂÃÂúð÷ÃÂòðýøõ:
def showGB(): db = pg.connect(database="guestbook") c = db.cursor() c.execute("""SELECT datum, author, message FROM guestbook ORDER BY datum;""") res = c.fetchall() c.close() db.close()
àÃÂÃÂþü ÃÂÃÂðóüõýÃÂõ üàòÃÂñøÃÂðõü òÃÂõ ÃÂÃÂÃÂþúø ø÷ ýðÃÂõù ÃÂðñûøÃÂàôðýýÃÂà, ÃÂþÃÂÃÂøÃÂÃÂàøàÿþ ôðÃÂõ. àõ÷ÃÂûÃÂÃÂðàÃÂþàÃÂðýÃÂõÃÂÃÂàò ÿõÃÂõüõýýþù res, àúþÃÂþÃÂþù ø ñÃÂôõü ÃÂðñþÃÂðÃÂÃÂ. âõÿõÃÂàþÃÂÃÂðûþÃÂàûøÃÂàðúúÃÂÃÂðÃÂýõýÃÂúþ ÃÂð÷ûþöøÃÂàýðÃÂø ôðýýÃÂõ ÿþ ÃÂðñûøÃÂúðü ø òÃÂòõÃÂÃÂø øàýð ÃÂúÃÂðý:
print "Content-Type: text/html\n" print "<H1 style='color:#7777FF'><U>ÃÂõûÃÂúðü ú ýðü ò óþÃÂÃÂø!</U></H1>" for item in res: print """<TABLE width='90%%'> <TR><TD><SMALL>âþòðÃÂøà<B>%s</B> ÿþòõôðûýðü ÃÂûõôÃÂÃÂÃÂõõ:</SMALL> <TD align='right'><SMALL>%s</SMALL> <TR><TD style='background-color:#DDDDFF' colspan='2'>%s </TABLE>""" % (item[1], str(item[0])[:19], item[2]) print "<HR><A name='form'><H3>ÃÂÃÂøÃÂþõôøýÃÂùÃÂõÃÂàú ôøÃÂúÃÂÃÂÃÂøø:</H3>" print """<FORM method='GET'> ÃÂðÃÂõ øüÃÂ: <INPUT type='text' name='author'><BR> çÃÂþ òàôÃÂüðõÃÂõ ÿþ ÃÂÃÂþüàÿþòþôÃÂ:<BR> <TEXTAREA name='message' rows='5' cols='80'></TEXTAREA><BR> <INPUT type='submit' value='ÃÂÃÂÿÃÂðòøÃÂÃÂ'> </FORM>"""
áüÃÂÃÂû úþýÃÂÃÂÃÂÃÂúÃÂøø str(item[0])[:19] ÷ðúûÃÂÃÂðõÃÂÃÂàò ÃÂþü, ÃÂÃÂþñàò ÃÂÃÂÃÂþúõ òÃÂõüõýø þÃÂÃÂõÃÂàýõýÃÂöýÃÂõ ýðü üøûûøÃÂõúÃÂýôÃÂ, úþÃÂþÃÂÃÂõ ÃÂþàÃÂðýÃÂÃÂÃÂÃÂàò ÿþûõ ÃÂøÿð timestamp. ÃÂþÃÂûõ òÃÂõàþÿÃÂñûøúþòðýýÃÂàÃÂþþñÃÂõýøù òÃÂòþôøü ÃÂþÃÂüàôþñðòûõýøàýþòþóþ, ÃÂÃÂþñàúðöôÃÂù üþó ÿÃÂøÃÂþõôøýøÃÂÃÂÃÂàú ýðÃÂõù ôøÃÂúÃÂÃÂÃÂøø. ÃÂÃÂÃÂðÃÂø, ò ÃÂõóõ <FORM> üàýõ ÃÂúð÷ðûø ÿðÃÂðüõÃÂàaction, ÿþÃÂúþûÃÂúàôðýýÃÂõ ñÃÂôÃÂàÿõÃÂõôðòðÃÂÃÂÃÂàýð þñÃÂðñþÃÂúàÃÂÃÂþüàöõ ÃÂÃÂõýðÃÂøà(ñûðóþôðÃÂàÃÂõüàøüàÃÂÃÂõýðÃÂøàüþöýþ ÿÃÂøÃÂòþøÃÂàûÃÂñþõ). ÃÂðúþýõÃÂ, ÿþÃÂûõôýøù ÃÂÃÂðóüõýÃÂ:
form = cgi.FieldStorage() if form.has_key("message") and form.has_key("author"): author = cgi.escape(form["author"].value) message = cgi.escape(form["message"].value) message = message.replace("\n", "<BR>") addMessage(author, message) else: showGB()
áþ÷ôðõü FieldStorage-þñÃÂõúÃÂ, ø õÃÂûø ò ýõü õÃÂÃÂà÷ðÿþûýõýýÃÂõ ÿþûàmessage ø author (ÃÂþ õÃÂÃÂà÷ðÿÃÂþàñÃÂû ÃÂÃÂþÃÂüøÃÂþòðý ø÷ ÷ðÿþûýõýýþù ÿþûÃÂ÷þòðÃÂõûõü ÃÂþÃÂüÃÂ), ÃÂþ, ýõüýþöúþ øàþñÃÂðñþÃÂðò (ÃÂÃÂýúÃÂøàcgi.escape() ÷ðüõýÃÂõàòÃÂõ ëýõñûðóþýðôõöýÃÂõû ÃÂøüòþûàâ ýðÿÃÂøüõÃÂ, < â øàÃÂÃÂðýôðÃÂÃÂýÃÂüø SGML-ÃÂÃÂÃÂýþÃÂÃÂÃÂüø, ò ôðýýþü ÃÂûÃÂÃÂðõ â <), ÿõÃÂõôðõü ÃÂÃÂýúÃÂøø addMessage(). ÃÂñÃÂðñþÃÂúð ýÃÂöýð ôûàÃÂþóþ, ÃÂÃÂþñà÷ûþÃÂüÃÂÃÂûõýýøú ýõ üþó òòõÃÂÃÂø ò ÿþûõ ÃÂþþñÃÂõýøàøûø øüõýø ðòÃÂþÃÂð ÃÂÃÂþ-ýøñÃÂôàÃÂðúþõ:
<SCRIPT>alert('ÃÂð ÿþÃÂûø òàòÃÂõ!');</SCRIPT>
àÃÂûþòÃÂ, ÿÃÂõýõñÃÂõóðÃÂàÿÃÂþòõÃÂúþù òòõôõýýÃÂàôðýýÃÂàýø ò úþõü ÃÂûÃÂÃÂðõ ýõûÃÂ÷ÃÂ. ÃÂðùôøÃÂõ úðú-ýøñÃÂôàýð securitylab.ru ø ÿþÃÂüþÃÂÃÂøÃÂõ, ÃÂúþûÃÂúþ ÃÂÃÂ÷òøüþÃÂÃÂõù ÃÂøÿð ëXSSû þñýðÃÂÃÂöøòðõÃÂÃÂàúðöôÃÂù üõÃÂÃÂÃÂ! âðú ÃÂÃÂþ ÃÂÃÂÃÂúø ÃÂÃÂÃÂúðüø, ýþ ÿþÃÂûõôÃÂÃÂòøàüþóÃÂàñÃÂÃÂàþÃÂõýàÃÂõÃÂÃÂõ÷ýÃÂüø.
ÃÂÃÂôð öõ ýðü ÃÂõÿõÃÂàøôÃÂø?
ÃÂÃÂðú, ÃÂÃÂþ-ÃÂþ òÿþûýõ ÃÂðñþÃÂþÃÂÿþÃÂþñýþõ àýðàõÃÂÃÂà(ÃÂü. ÃÂøÃÂÃÂýþú). ÃÂþ úðú òàüþöõàôþóðôðÃÂÃÂÃÂÃÂ, ýðÃÂð óþÃÂÃÂõòðàþÃÂõýàôðûõúð þàÃÂþòõÃÂÃÂõýÃÂÃÂòð. çÃÂþ õÃÂõ üþöýþ ÃÂôõûðÃÂÃÂ? ÃÂÃÂ, ýðÿÃÂøüõÃÂ, ÃÂð÷ñøÃÂàýð ÃÂÃÂÃÂðýøÃÂÃÂ. ÃÂþúð ÃÂþþñÃÂõýøù ò ýõù ñÃÂôõàýõ ñþûÃÂÃÂõ ôÃÂöøýÃÂ, ÃÂþùôõàø ÃÂðú. àúþóôð øàÃÂøÃÂûþ ôþùôõàôþ ÃÂþÃÂýø, ÃÂþ ÃÂõôúøù ÿþûÃÂ÷þòðÃÂõûàôþöôõÃÂÃÂàþúþýÃÂðýøà÷ðóÃÂÃÂ÷úø òÃÂõàôðýýÃÂà. ÃÂþöýþ ôðÃÂàÿþûÃÂ÷þòðÃÂõûÃÂü òþ÷üþöýþÃÂÃÂàøÃÂÿþûÃÂ÷þòðÃÂàýõúþÃÂþÃÂÃÂõ HTML-ÃÂõóø, ÃÂÃÂþñàøàÃÂþþñÃÂõýøàòÃÂóûÃÂôõûø ñþûõõ úÃÂðÃÂþÃÂýþ. ÃÂþöýþ ôþñðòøÃÂàÃÂüðùûøúþò... àüþöýþ ôðöõ ÃÂôõûðÃÂàüþôÃÂûàðôüøýøÃÂÃÂÃÂøÃÂþòðýøÃÂ, ÿþ÷òþûÃÂÃÂÃÂøù ÃÂõôðúÃÂøÃÂþòðÃÂàøûø ÃÂôðûÃÂÃÂàÃÂþþñÃÂõýøÃÂ, ð ÃÂðúöõ þÃÂòõÃÂðÃÂàýð ýøà. âðú ÃÂÃÂþ ÃÂðñþÃÂàýõÿþÃÂðÃÂÃÂù úÃÂðù. ÃÂõÃÂ÷ðùÃÂõ â ýõ ñÃÂôàòðü üõÃÂðÃÂÃÂ.
ÃÂõúþÃÂþÃÂÃÂõ ÃÂðÃÂÿÃÂþÃÂÃÂÃÂðýÃÂýýÃÂõ MIME-ÃÂøÿÃÂ
MIME-ÃÂøÿ | ÃÂÿøÃÂðýøõ |
---|---|
text/plain | ÃÂÃÂþÃÂÃÂþù ÃÂõúÃÂà|
text/html | HTML-ÃÂÃÂÃÂðýøÃÂð |
image/gif | ÃÂ÷þñÃÂðöõýøõ GIF |
video/mpeg | ÃÂøôõþ-ÃÂðùû ò ÃÂþÃÂüðÃÂõ MPEG |
application/msword | ÃÂþúÃÂüõýàMS Word |