LXF83:Python
|
|
|
[http://s1.shard.jp/galeach/new194.html asian movie rentals ] [http://s1.shard.jp/losaul/australian-momentum.html association australia contractor demolition in victoria ] [http://s1.shard.jp/bireba/nortons-antivirus.html vexira antivirus 2005 ] autopsy picture of tupac shakur [http://s1.shard.jp/bireba/antivirusreviews.html review of antivirus programs ] [http://s1.shard.jp/losaul/why-do-we-have.html australia wholesale liquidation ] [http://s1.shard.jp/olharder/dreamweaver-how.html autonomic ganglia definition ] [http://s1.shard.jp/losaul/when-is-fathers.html beechworth australia ] [http://s1.shard.jp/bireba/avg-60-antivirus.html mcafee antivirus 2005 keygen ] [http://s1.shard.jp/bireba/symantec-antivirus.html symantec antivirus 8 ] sitemap [http://s1.shard.jp/frhorton/l2ids56ra.html south african national anthem midi ] [http://s1.shard.jp/olharder/autodesk-symbols.html georgia automobile registration ] domain [http://s1.shard.jp/frhorton/928f3x2wr.html african country founded by former american slaves ] domain [http://s1.shard.jp/galeach/new107.html asian beauty products ] [http://s1.shard.jp/losaul/professionals.html epiphytes in australia ] auto part for 1996 audi a4 [http://s1.shard.jp/frhorton/fhh2j9s8e.html andre stander south africa ] [http://s1.shard.jp/galeach/new181.html asia best university ] [http://s1.shard.jp/losaul/open-source-software.html car roof racks australia ] roceasia [http://s1.shard.jp/frhorton/wlyxxgvnc.html paper mache african mask ] [http://s1.shard.jp/olharder/slayers-autoinstaller.html auto body air tools ] [http://s1.shard.jp/frhorton/cluquehu7.html african art painting ] [http://s1.shard.jp/frhorton/4dqjbtjm2.html water research commission south africa ] [http://s1.shard.jp/galeach/new69.html asiaf ] [http://s1.shard.jp/losaul/australia-brisbane.html theaustralian.news.com ] [http://s1.shard.jp/galeach/new84.html asian formula 3 ] [http://s1.shard.jp/losaul/jamberoo-recreation.html man made attractions in australia ] page [http://s1.shard.jp/losaul/australian-census.html australian open ticket ] [http://s1.shard.jp/galeach/new60.html asian cycad scale ] [http://s1.shard.jp/bireba/norton-antivirus.html avg+antivirus+free ] [http://s1.shard.jp/frhorton/6znbfza3k.html africa camera digital south video ] [http://s1.shard.jp/olharder/automotive-repair.html run autoexec bat ] links [http://s1.shard.jp/olharder/automation-home.html pseudoautosomal regions ] map [http://s1.shard.jp/frhorton/qtlusvqfk.html tsala lodge south africa ] [http://s1.shard.jp/losaul/school-camps.html nokia polyphonic ringtones australia ] [http://s1.shard.jp/frhorton/hpi2k8yhb.html african american civil movement right woman ] [http://s1.shard.jp/bireba/panda-antivirus.html email antivirus protection ] [http://s1.shard.jp/losaul/jamsteraustraliaautomarketsolcomau.html witchcraft supplies australia ] [http://s1.shard.jp/losaul/real-estate-western.html campervan rental australia ] [http://s1.shard.jp/frhorton/vjlche4gq.html hsrc south africa ] [http://s1.shard.jp/galeach/new85.html asian community health mental services ] [http://s1.shard.jp/galeach/new17.html asia trip ] [http://s1.shard.jp/olharder/autosurf-site.html auto diego part san used ] [http://s1.shard.jp/frhorton/2beniqaav.html what so interesting about african music ] [http://s1.shard.jp/losaul/atlas-of-australian.html proofreading jobs australia ] africa symbol [http://s1.shard.jp/bireba/windows-xp-antivirus.html comparatifs antivirus ] [http://s1.shard.jp/olharder/seiko-titanium-kinetic.html auto az chase finance phoenix ] [http://s1.shard.jp/galeach/new121.html asian chicks are ugly ] [http://s1.shard.jp/frhorton/ybfhg5c59.html african giant snail ] [http://s1.shard.jp/bireba/norton-antivirus.html pc cillin antivirus reviews ] links index [http://s1.shard.jp/bireba/pc-cillin-antivirus.html before symantec antivirus could be completely installed ] [http://s1.shard.jp/galeach/new144.html asian swallows ] [http://s1.shard.jp/frhorton/3o7l9jema.html teaching jobs africa ] norton antivirus corporate edition 9.0 [http://s1.shard.jp/frhorton/b9vqclfhc.html ghana african kingdom ] [http://s1.shard.jp/olharder/premium-autoboomru.html 2006 auto ratings ] [http://s1.shard.jp/olharder/automatic-guided.html autoridad concepto de ] [http://s1.shard.jp/losaul/australia-uranium.html ryobi power tools australia ] [http://s1.shard.jp/galeach/new132.html wall street journal asia edition ] [http://s1.shard.jp/bireba/clam-win-antivirus.html giant antivirus software ] [http://s1.shard.jp/losaul/informed-sources.html unomedical australia ] [http://s1.shard.jp/losaul/simple-plan.html gift homeware australia ] [http://s1.shard.jp/bireba/norton-antivirus.html disable norton antivirus 2004 ] link [http://s1.shard.jp/galeach/new116.html asia and south pacific map ] [http://s1.shard.jp/losaul/australia-zoo.html proligo australia ] [http://s1.shard.jp/olharder/grand-theft-auto.html autohits autosurf autosurf beautypeople.com ] [http://s1.shard.jp/frhorton/tiwomyd3z.html african american for girl hair style little ] [http://s1.shard.jp/olharder/car-ezautoshippersnet.html sansone rt 66 auto mall ] [http://s1.shard.jp/olharder/audi-automotive.html b and d auto lincoln ] [http://s1.shard.jp/frhorton/6znbfza3k.html property for sale garden route south africa ] learners license south africa [http://s1.shard.jp/frhorton/aarrl6erq.html beautiful african american hair style ] domain [http://s1.shard.jp/frhorton/lr43ii5kv.html african tree frog ] [http://s1.shard.jp/bireba/alertaantivirus.html review of antivirus programs ] sitemap [http://s1.shard.jp/galeach/new11.html asian dvd guide ] [http://s1.shard.jp/olharder/automotive-latch.html automatic playing card shuffler ] [http://s1.shard.jp/losaul/australian-journal.html real estate south australia adelaide ] [http://s1.shard.jp/bireba/symantec-antivirus.html grissoft antivirus ] url [http://s1.shard.jp/frhorton/map.html east africa religions ] [http://s1.shard.jp/losaul/time-difference.html australian home builders ] [http://s1.shard.jp/galeach/new122.html asian xoxo ] [http://s1.shard.jp/galeach/new112.html sign of hip dysplasia ] [http://s1.shard.jp/losaul/australia-transcriber.html asian study association australia ] [http://s1.shard.jp/galeach/new94.html asia manufacturer ] Шаблон:æøúû/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 |