亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ch03_01.htm

?? 用perl編寫CGI的好書。本書從解釋CGI和底層HTTP協議如何工作開始
?? HTM
字號:
<?label 3. The Common Gateway Interface?><html><head><title>The Common Gateway Interface (CGI Programming with Perl)</title><link href="../style/style1.css" type="text/css" rel="stylesheet" /><meta name="DC.Creator" content="Scott Guelich, Gunther Birznieks and Shishir Gundavaram" /><meta scheme="MIME" content="text/xml" name="DC.Format" /><meta content="en-US" name="DC.Language" /><meta content="O'Reilly & Associates, Inc." name="DC.Publisher" /><meta scheme="ISBN" name="DC.Source" content="1565924193L" /><meta name="DC.Subject.Keyword" content="stuff" /><meta name="DC.Title" content="CGI Programming with Perl" /><meta content="Text.Monograph" name="DC.Type" /></head><body bgcolor="#ffffff"><img src="gifs/smbanner.gif" alt="Book Home" usemap="#banner-map" border="0" /><map name="banner-map"><area alt="CGI Programming with Perl" href="index.htm" coords="0,0,466,65" shape="rect" /><area alt="Search this book" href="jobjects/fsearch.htm" coords="467,0,514,18" shape="rect" /></map><div class="navbar"><table border="0" width="515"><tr><td width="172" valign="top" align="left"><a href="ch02_07.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td width="171" valign="top" align="center"><a href="index.htm">CGI Programming with Perl</a></td><td width="172" valign="top" align="right"><a href="ch03_02.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr></table></div><hr align="left" width="515" /><h1 class="chapter">Chapter 3. The Common Gateway Interface</h1><div class="htmltoc"><h4 class="tochead">Contents:</h4><p><a href="ch03_01.htm">The CGI Environment</a><br><a href="ch03_02.htm">Environment Variables</a><br><a href="ch03_03.htm">CGI Output</a><br><a href="ch03_04.htm">Examples</a><br></p></div><p>Now that we have <a name="INDEX-501" />explored HTTP in general, we canreturn to our discussion of CGI and see how our scripts interact withHTTP servers to produce dynamic content. After you have read thischapter, you'll understand how to write basic CGI scripts andfully understand all of our previous examples. Let's getstarted by looking at a script now.</p><p>This script displays some basic information, including CGI and HTTPrevisions used for this transaction and the name of the serversoftware:</p><blockquote><pre class="code">#!/usr/bin/perl -wTprint &lt;&lt;END_OF_HTML;Content-type: text/html&lt;HTML&gt;&lt;HEAD&gt;    &lt;TITLE&gt;About this Server&lt;/TITLE&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;H1&gt;About this Server&lt;/H1&gt;&lt;HR&gt;&lt;PRE&gt;  Server Name:       $ENV{SERVER_NAME}  Listening on Port: $ENV{SERVER_PORT}  Server Software:   $ENV{SERVER_SOFTWARE}  Server Protocol:   $ENV{SERVER_PROTOCOL}  CGI Version:       $ENV{GATEWAY_INTERFACE}&lt;/PRE&gt;&lt;HR&gt;&lt;/BODY&gt;&lt;/HTML&gt;END_OF_HTML</pre></blockquote><p>When you request the URL for this CGI script, it produces the outputshown in <a href="ch03_01.htm#ch03-93144">Figure 3-1</a>.</p><a name="ch03-93144" /><div class="figure"><img width="448" src="figs/cgi2.0301.gif" height="207" alt="Figure 3-1" /></div><h4 class="objtitle">Figure 3-1. Output from server_info.cgi</h4><p>This simple example demonstrates the basics about how scripts workwith <a name="INDEX-502" />CGI:</p><ul><li><p>The web server passes information to CGI scripts via<a name="INDEX-503" />environment variables, which the scriptaccesses via the <tt class="literal">%ENV</tt> hash.</p></li><li><p>CGI scripts produce output by printing an HTTP message on STDOUT.</p></li><li><p>CGI scripts do not need to output full HTTP headers. This scriptoutputs only one HTTP header, <em class="emphasis">Content-type</em>.</p></li></ul><p>These details define what we will call the <em class="firstterm">CGIenvironment</em><a name="INDEX-504" /><a name="INDEX-505" />. Let's explore this environment inmore detail.</p><div class="sect1"><a name="ch03-71120" /><h2 class="sect1">3.1. The CGI Environment</h2><p>CGI establishes a particular environment in which CGI scriptsoperate. This environment includes such things as what currentworking directory the script starts in, what variables are preset forit, where the standard file handles are directed, and so on. Inreturn, CGI requires that scripts be responsible for defining thecontent of the HTTP response and at least a minimal set of HTTPheaders.</p><p>When CGI scripts are executed, their current working<a name="INDEX-506" />directory istypically the directory in which they reside on the web server; atleast this is the recommended behavior according to the CGI standard,though it is not supported by all web servers (e.g.,Microsoft's IIS). CGI scripts are generally executed withlimited permissions. On Unix systems, CGI scripts execute with thesame permission as the web server which is generally a special usersuch as <em class="emphasis">nobody</em>, <em class="emphasis">web</em>, or<em class="emphasis">www</em>. On other operating systems, the web serveritself may need to be configured to set the<a name="INDEX-507" />permissions that CGI scripts have. In anyevent, CGI scripts should not be able to read and write to all areasof the file system. You may think this is a problem, but it isactually a good thing as you will learn in our security discussion in<a href="ch08_01.htm">Chapter 8, "Security"</a>.</p><a name="ch03-1-fm2xml" /><div class="sect2"><h3 class="sect2">3.1.1. File Handles</h3><p>Perl scripts generally start with three standard<a name="INDEX-508" /> <a name="INDEX-509" /> <a name="INDEX-510" /> <a name="INDEX-511" /> <a name="INDEX-512" />filehandles predefined: STDIN, STDOUT, and STDERR. CGI Perl scripts areno different. These file handles have particular meaning within a CGIscript, however.</p><a name="ch03-2-fm2xml" /><div class="sect3"><h3 class="sect3">3.1.1.1. STDIN</h3><p>When a web server receives an HTTP request directed to a CGI script,it reads the HTTP headers and passes the content body of the messageto the CGI script on STDIN. Because the headers have already beenremoved, STDIN will be empty for <a name="INDEX-513" /> <a name="INDEX-514" />GET requests that have no body andcontain the encoded form data for POST requests. Note that there isno end-of-file marker, so if you try to read more data than isavailable, your CGI script will hang, waiting for more data on STDINthat will never come (eventually, the web server or browser shouldtime out and kill this CGI script but this wastes system resources).Thus, you should never try to read from STDIN for GET requests. For<a name="INDEX-515" /><a name="INDEX-516" />POST requests, you should alwaysrefer to the value of the <em class="emphasis">Content-Length</em> headerand read only that many bytes. We'll see how to read thisinformation in <a href="ch04_01.htm">Chapter 4, "Forms and CGI"</a> in <a href="ch04_01.htm">Chapter 4, "Forms and CGI"</a>.</p></div><a name="ch03-3-fm2xml" /><div class="sect3"><h3 class="sect3">3.1.1.2. STDOUT</h3><p>Perl CGI scripts return their output to the web server by<a name="INDEX-517" /> <a name="INDEX-518" /> <a name="INDEX-519" /> <a name="INDEX-520" />printing to STDOUT. This may include someHTTP headers as well as the content of the response, if present. Perlgenerally buffers output on STDOUT and sends it to the web server inchunks. The web<a name="INDEX-521" />server itself may wait until theentire output of the script has finished before sending it onto theclient. For example, the <a name="INDEX-522" /><a name="INDEX-523" />iPlanet (formerly Netscape) Enterprise Serverbuffers output, while <a name="INDEX-524" /><a name="INDEX-525" />Apache(1.3 and higher) does not.</p></div><a name="ch03-4-fm2xml" /><div class="sect3"><h3 class="sect3">3.1.1.3. STDERR</h3><p>CGI does not designate how web servers should handle output toSTDERR, and servers implement this in different ways, but they almostalways produces a <em class="emphasis">500 Internal ServerError</em><a name="INDEX-526" /><a name="INDEX-527" /><a name="INDEX-528" /> reply. Some web servers,like Apache, append STDERR output to the web server's errorlog, which includes other errors such as authorization failures andrequests for documents not on the server. This is very helpful for<a name="INDEX-529" /><a name="INDEX-530" />debugging errors in CGIscripts.</p><p>Other servers, such as those by iPlanet, do not distinguish betweenSTDOUT and STDERR; they capture both as output from the script andreturn them to the client. Nevertheless, outputting data to STDERRwill typically produce a server error because<a name="INDEX-531" />Perl does not buffer STDERR, so dataprinted to STDERR often arrives at the web server before data printedto STDOUT. The web server will then report an error because itexpects the output to start with a valid header, not the errormessage. On iPlanet, only the server's error message, and notthe complete contents of STDERR, is then logged.</p><p>We'll discuss strategies for handling STDERR output in ourdiscussion of CGI script debugging <a name="INDEX-532" /> <a name="INDEX-533" />in <a href="ch15_01.htm">Chapter 15, "Debugging CGI Applications"</a>.</p></div></div></div><hr align="left" width="515" /><div class="navbar"><table border="0" width="515"><tr><td width="172" valign="top" align="left"><a href="ch02_07.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td width="171" valign="top" align="center"><a href="index.htm"><img src="../gifs/txthome.gif" alt="Home" border="0" /></a></td><td width="172" valign="top" align="right"><a href="ch03_02.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr><tr><td width="172" valign="top" align="left">2.7. Summary</td><td width="171" valign="top" align="center"><a href="index/index.htm"><img src="../gifs/index.gif" alt="Book Index" border="0" /></a></td><td width="172" valign="top" align="right">3.2. Environment Variables</td></tr></table></div><hr align="left" width="515" /><img src="../gifs/navbar.gif" alt="Library Navigation Links" usemap="#library-map" border="0" /><p><font size="-1"><a href="copyrght.htm">Copyright &copy; 2001</a> O'Reilly &amp; Associates. All rights reserved.</font></p><map name="library-map"><area href="../index.htm" coords="1,1,83,102" shape="rect" /><area href="../lnut/index.htm" coords="81,0,152,95" shape="rect" /><area href="../run/index.htm" coords="172,2,252,105" shape="rect" /><area href="../apache/index.htm" coords="238,2,334,95" shape="rect" /><area href="../sql/index.htm" coords="336,0,412,104" shape="rect" /><area href="../dbi/index.htm" coords="415,0,507,101" shape="rect" /><area href="../cgi/index.htm" coords="511,0,601,99" shape="rect" /></map></body></html>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人福利片| 成人性色生活片| 国产成人综合视频| 欧美日韩久久不卡| 亚洲欧洲国产日韩| 激情深爱一区二区| 欧美性生活大片视频| 26uuu精品一区二区三区四区在线 26uuu精品一区二区在线观看 | 韩日av一区二区| 91福利视频在线| 亚洲精品一区二区三区福利| 一区二区三区日韩精品| 久久超碰97人人做人人爱| 日韩av高清在线观看| 97se亚洲国产综合自在线| 精品日韩欧美在线| 日韩av中文字幕一区二区| 成年人国产精品| 日韩亚洲欧美高清| 一区二区三区不卡在线观看| 国产成人丝袜美腿| 日韩一级二级三级精品视频| 亚洲老妇xxxxxx| 国产伦精品一区二区三区免费迷 | 欧美色成人综合| 中文子幕无线码一区tr| 日韩国产在线一| 欧美在线综合视频| 国产精品不卡一区| 国产米奇在线777精品观看| 欧美日韩精品电影| 视频一区中文字幕国产| 99re热视频这里只精品| 国产日韩欧美精品在线| 国精品**一区二区三区在线蜜桃| 欧美影片第一页| 亚洲欧美视频在线观看视频| 成人毛片在线观看| 久久免费美女视频| 久久成人综合网| 欧美精品xxxxbbbb| 午夜精品久久久久久久蜜桃app | 另类欧美日韩国产在线| 欧美日韩国产首页在线观看| 亚洲精品日日夜夜| 99久久er热在这里只有精品15| 久久嫩草精品久久久精品| 蜜桃一区二区三区四区| 91精品国产一区二区三区香蕉| 亚洲一区二区三区小说| 欧美伊人精品成人久久综合97 | 96av麻豆蜜桃一区二区| 国产精品高潮呻吟久久| 99精品欧美一区二区三区小说 | 国产精品污www在线观看| 久久国产精品色| 欧美成人福利视频| 蜜桃av一区二区在线观看| 日韩欧美一级二级三级久久久| 亚洲国产一区在线观看| 欧美日韩一区二区欧美激情| 亚洲一区二区偷拍精品| 欧美日韩免费观看一区二区三区| 亚洲精品国产精华液| 欧美三级午夜理伦三级中视频| 亚洲国产精品麻豆| 91精品欧美一区二区三区综合在 | 国产精品日韩成人| 在线亚洲高清视频| 香蕉久久夜色精品国产使用方法 | 日韩精品色哟哟| 91精品国产免费| 国产在线播精品第三| 中文字幕国产一区| 91福利视频在线| 久草在线在线精品观看| 日本一区二区三区久久久久久久久不| av中文字幕不卡| 亚洲成人777| 精品99久久久久久| 国产一区二区不卡在线| 中文字幕在线观看不卡| 色播五月激情综合网| 日本欧美在线看| 亚洲国产精品成人久久综合一区| 色综合久久88色综合天天免费| 婷婷成人激情在线网| 日韩精品一区二区三区四区视频| 久久99久久99精品免视看婷婷| 欧美经典一区二区| 欧美日韩国产一二三| 狠狠久久亚洲欧美| 一区二区三区日韩| 久久久99精品久久| 欧美日韩中文精品| 国产高清在线精品| 三级欧美韩日大片在线看| 国产精品少妇自拍| 91精品国产色综合久久ai换脸 | 精品国产乱码久久久久久免费 | 中文字幕日本乱码精品影院| 91精品午夜视频| 91在线国内视频| 国产一区二区视频在线播放| 一区二区三区久久久| 国产偷v国产偷v亚洲高清| 91麻豆精品91久久久久久清纯 | 欧美一级二级三级乱码| 99久久国产免费看| 国产剧情一区二区| 视频一区二区三区在线| 亚洲精品菠萝久久久久久久| 久久综合久久综合九色| 91精品欧美一区二区三区综合在| 成人午夜精品在线| 国产中文字幕精品| 日韩电影在线观看一区| 一个色综合网站| 综合激情网...| 欧美激情一区二区| 26uuu成人网一区二区三区| 色婷婷综合久久久| 国产精品一区一区三区| 日本在线播放一区二区三区| 亚洲黄色尤物视频| 国产精品夫妻自拍| 精品久久久久久久久久久久久久久 | 欧美精品一区二区三区高清aⅴ | 蜜臀av一区二区在线免费观看 | 欧美精品久久一区二区三区| 欧洲一区二区三区免费视频| 91免费精品国自产拍在线不卡| 国产成人精品一区二| 国内精品在线播放| 精品一区二区在线免费观看| 经典三级视频一区| 韩国成人在线视频| 国产中文字幕精品| 国产白丝精品91爽爽久久| 国产不卡一区视频| 91免费国产视频网站| 色婷婷久久久久swag精品| 欧美性生活影院| 日韩三级高清在线| 亚洲精品一区二区三区福利| 久久日韩精品一区二区五区| 国产婷婷精品av在线| 中文字幕一区二区三区不卡在线 | 午夜久久久久久久久| 午夜免费欧美电影| 精品一区二区综合| 成人精品gif动图一区| 97久久精品人人做人人爽| 在线精品观看国产| 69成人精品免费视频| 久久久亚洲高清| 中文字幕在线不卡一区| 五月婷婷欧美视频| 国产精一区二区三区| 99精品视频在线播放观看| 欧美夫妻性生活| 久久网这里都是精品| 亚洲免费在线视频一区 二区| 午夜伊人狠狠久久| 国产九色精品成人porny| 97精品电影院| 日韩一区二区三区观看| 欧美—级在线免费片| 亚洲一区中文日韩| 久久国产麻豆精品| 色偷偷久久一区二区三区| 欧美一区二区二区| 国产精品久久久久影视| 亚洲一区二区在线播放相泽| 国产剧情一区在线| 欧美视频三区在线播放| 久久精品欧美一区二区三区麻豆| 亚洲丝袜另类动漫二区| 麻豆91免费观看| 91麻豆国产精品久久| 精品欧美一区二区三区精品久久| 18成人在线视频| 麻豆成人av在线| 欧美系列亚洲系列| 国产欧美一区二区在线观看| 亚洲成人自拍偷拍| 99久久国产综合精品女不卡| 欧美白人最猛性xxxxx69交| 亚洲精品国产一区二区三区四区在线| 久久不见久久见中文字幕免费| 在线观看三级视频欧美| 欧美极品aⅴ影院| 久久成人久久鬼色| 欧美色大人视频| 一区二区三区四区乱视频| 在线免费观看视频一区| 一区二区三区不卡在线观看 | 国产aⅴ综合色| 中文字幕av免费专区久久| 高清shemale亚洲人妖|