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

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

?? ch01_02.htm

?? 用perl編寫CGI的好書。本書從解釋CGI和底層HTTP協議如何工作開始
?? HTM
?? 第 1 頁 / 共 2 頁
字號:
<?label 1.2. Introduction to CGI?><html><head><title>Introduction to CGI (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="ch01_01.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="ch01_03.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr></table></div><hr align="left" width="515" /><h2 class="sect1">1.2. Introduction to CGI</h2><p>CGI can do so much because it is so simple. CGI is a very lightweightinterface; it is essentially the minimum that the web server needs toprovide in order to allow external processes to create web pages.Typically, when a web server gets a request for a static web page,the web server finds the corresponding HTML file on its filesystem.When a web server gets a request for a CGI script, the web serverexecutes the CGI script as another process (i.e., a separateapplication); the server passes this process some parameters andcollects its output, which it then returns to the client just as ifhad been fetched from a static file (see <a href="ch01_02.htm#ch01-81668">Figure 1-1</a>).</p><a name="ch01-81668" /><div class="figure"><img width="456" src="figs/cgi2.0101.gif" height="159" alt="Figure 1-1" /></div><h4 class="objtitle">Figure 1-1. How a CGI application is executed</h4><p><a name="INDEX-11" /><a name="INDEX-12" />So how does the whole interface work?We'll spend the remainder of the book answering this questionin more detail, but let's take a basic look now.</p><p>Web browsers request dynamic resources such as CGI scripts the sameway they request any other resource on the Web: they send a messageformatted according to the <em class="firstterm">Hypertext TransportProtocol</em>, or <em class="emphasis">HTTP</em>. We'lldiscuss HTTP in <a href="ch02_01.htm">Chapter 2, "The Hypertext Transport Protocol "</a>. An HTTPrequest includes a <em class="firstterm">Universal Resource Locator</em>,or <em class="firstterm">URL</em>, and by looking at the URL, the webserver determines which resource to return. Typically, CGI scriptsshare a common directory, like <em class="filename">/cgi</em>, or afilename extension, like <em class="filename">.cgi</em>. If the web serverrecognizes that the request is for a CGI script, it executes thescript.</p><p>Say you wanted to visit the URL,<em class="emphasis">http://www.mikesmechanics.com/cgi/welcome.cgi</em>. Atits most basic, <a href="ch01_02.htm#ch01-80955">Example 1-1</a> shows a sample HTTPrequest your web browser might send.</p><a name="ch01-80955" /><div class="example"><h4 class="objtitle">Example 1-1. Sample HTTP Request </h4><blockquote><pre class="code">GET /cgi/welcome.cgi HTTP/1.1Host: www.mikesmechanics.com</pre></blockquote></div><p>This GET request identifies the resource to retrieve as <em class="emphasis">/cgi/welcome.cgi</em>. Assuming our server recognizes all files in the<em class="emphasis">/cgi</em> directory tree as CGI scripts, it understands that it shouldexecute the <em class="filename">welcome.cgi</em> script instead ofreturning its contents directly to the browser.</p><p>CGI programs get their input from <a name="INDEX-13" />standard input (<tt class="literal">STDIN</tt>)and <a name="INDEX-14" /><a name="INDEX-15" />environment variables. These<a name="INDEX-16" />variables containinformation such as the identity of the remote host and user, thevalue of form elements submitted (if any), etc. They also store theserver name, the communication protocol, and the name of the softwarerunning the server. We'll look at each one of these in moredetail in <a href="ch03_01.htm">Chapter 3, "The Common Gateway Interface"</a>.</p><p>Once the CGI program starts running, it sends its output back to theweb server via <a name="INDEX-17" /> <a name="INDEX-18" /><a name="INDEX-19" />standard output (<tt class="literal">STDOUT</tt>).In <a name="INDEX-20" /><a name="INDEX-21" />Perl, this is easy to do because bydefault, anything you <tt class="function">print</tt> goes to<tt class="literal">STDOUT</tt>. <a name="INDEX-22" />CGI scripts can either return theirown output as a new document or provide a new URL to forward therequest elsewhere. CGI scripts print a special line formattedaccording to<a name="INDEX-23" />HTTP headers to indicate this tothe web server. We'll look at these headers in the nextchapter, but here is a sample of what a CGI script returning HTMLwould output:</p><blockquote><pre class="code">Content-type: text/html</pre></blockquote><p>CGI scripts actually can return extra header lines if they choose, soto indicate that it has finished sending headers, a CGI script printsa blank line. Finally, if it is outputting a document, it prints thecontents of that document, too.</p><p>The web server takes the output of the CGI script and adds its ownHTTP headers before sending it back to the browser of the user whorequested it. <a href="ch01_02.htm#ch01-94693">Example 1-2</a> shows a sample<a name="INDEX-24" /><a name="INDEX-25" /> <a name="INDEX-26" />response that a web browser wouldreceive from the web server.</p><a name="ch01-94693" /><div class="example"><h4 class="objtitle">Example 1-2. Sample HTTP Response </h4><blockquote><pre class="code">HTTP/1.1 200 OKDate: Sat, 18 Mar 2000 20:35:35 GMTServer: Apache/1.3.9 (Unix)Last-Modified: Wed, 20 May 1998 14:59:42 GMTETag: "74916-656-3562efde"Content-Length: 2000Content-Type: text/html&lt;HTML&gt;&lt;HEAD&gt;  &lt;TITLE&gt;Welcome to Mike's Mechanics Database&lt;/TITLE&gt;&lt;/HEAD&gt;&lt;BODY BGCOLOR="#ffffff"&gt;  &lt;IMG SRC="/images/mike.jpg" ALT="Mike's Mechanics"&gt;  &lt;P&gt;Welcome from dyn34.my-isp.net! What will you find here? You'll    find a list of mechanics from around the country and the type of    service to expect -- based on user input and suggestions.&lt;/P&gt;  &lt;P&gt;What are you waiting for? Click &lt;A HREF="/cgi/list.cgi"&gt;here&lt;/A&gt;    to continue.&lt;/P&gt;  &lt;HR&gt;  &lt;P&gt;The current time on this server is: Sat Mar 18 10:28:00 2000.&lt;/P&gt;  &lt;P&gt;If you find any problems with this site or have any suggestions,    please email &lt;A HREF="mailto:webmaster@mikesmechanics.com"&gt;    webmaster@mikesmechanics.com&lt;/A&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</pre></blockquote></div><p>The <a name="INDEX-27" /><a name="INDEX-28" />header contains thecommunication protocol, the date and time of the response, the servername and version, the last time the document was modified, an entitytag used for caching, the length of the response, and the<a name="INDEX-29" /><a name="INDEX-30" />media type of the document -- in thiscase, a text document formatted with HTML. Headers like these arereturned with all responses from web servers, and we'll look atHTTP headers in more detail in the next chapter. However, note thatnothing here indicates to the browser whether this response came fromthe contents of a <a name="INDEX-31" /> <a name="INDEX-32" /> <a name="INDEX-33" />static HTML file or whether it was generateddynamically by a CGI script. This is as it should be; the browserasked the web server for a resource, and it received a resource. Itdoesn't care where the document came from or how the web servergenerated it.</p><p>CGI allows you to generate output that doesn't look anydifferent to the end user than other responses on the Web. Thisflexibility allows you to generate anything with a CGI script thatthe web server could get from a file, including HTML documents, plaintext documents, PDF files, or even images like PNGs or GIFs.We'll look at how to create dynamic images in <a href="ch13_01.htm">Chapter 13, "Creating Graphics on the Fly"</a>.</p><a name="ch01-2-fm2xml" /><div class="sect2"><h3 class="sect2">1.2.1. Sample CGI</h3><p>Let's look at a sample <a name="INDEX-34" />CGI application, written in Perl,that creates the dynamic output we just saw in <a href="ch01_02.htm#ch01-94693">Example 1-2</a>. This program, shown in <a href="ch01_02.htm#ch01-77893">Example 1-3</a>, determines where the user is connecting fromand then creates a simple <a name="INDEX-35" />HTML documentcontaining this information, along with the current time. In the nextseveral chapters, we'll see how to use various CGI modules tomake creating such an application even easier; for now, however, wewill keep it straightforward.</p><a name="ch01-77893" /><div class="example"><h4 class="objtitle">Example 1-3. welcome.cgi </h4><blockquote><pre class="code">#!/usr/bin/perl -wTuse strict;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
26uuu欧美| 久久亚洲综合色一区二区三区| 国产精品18久久久久久vr| 奇米影视7777精品一区二区| 亚洲sss视频在线视频| 亚洲国产精品自拍| 午夜精品福利在线| 亚瑟在线精品视频| 日韩成人午夜电影| 韩国成人福利片在线播放| 国精产品一区一区三区mba桃花| 精一区二区三区| 丰满岳乱妇一区二区三区 | 色综合久久综合| 色综合久久久久久久久| 欧洲人成人精品| 日韩欧美一级二级三级| 久久久久久综合| 亚洲日本欧美天堂| 轻轻草成人在线| 国产成人av网站| 色视频一区二区| 7878成人国产在线观看| 久久久久久久久久电影| 国产精品久久精品日日| 一区二区视频在线| 男人的天堂亚洲一区| 国产精品一区二区在线播放 | 国产精品每日更新| 亚洲天堂网中文字| 久久99久久99| 日本福利一区二区| 久久亚洲精品小早川怜子| 亚洲视频中文字幕| 久久99国产乱子伦精品免费| 国产·精品毛片| 欧美日韩国产高清一区二区三区| 精品福利在线导航| 亚洲一区二区三区中文字幕在线| 另类中文字幕网| av在线不卡免费看| 欧美成人vr18sexvr| 亚洲欧美一区二区三区孕妇| 蜜桃av噜噜一区二区三区小说| www.欧美亚洲| 精品成人a区在线观看| 亚洲精品ww久久久久久p站| 精品亚洲aⅴ乱码一区二区三区| 色综合久久久久网| 欧美韩国一区二区| 极品美女销魂一区二区三区| 欧美图片一区二区三区| 国产精品黄色在线观看| 精一区二区三区| 日韩一级片网站| 一区二区三区中文字幕| 久久99国产乱子伦精品免费| 欧美日本一道本在线视频| 亚洲欧美激情一区二区| 丰满少妇久久久久久久| 久久免费午夜影院| 精品无人区卡一卡二卡三乱码免费卡 | 亚洲三级电影全部在线观看高清| 免费日韩伦理电影| 7777精品伊人久久久大香线蕉| 亚洲欧美国产高清| 91丨九色丨尤物| 中文在线免费一区三区高中清不卡| 麻豆91在线看| 日韩视频在线永久播放| 日韩av一区二区三区| 欧美精品一级二级| 天天影视涩香欲综合网| 欧美男男青年gay1069videost| 一区二区三区毛片| 91高清视频在线| 亚洲一级在线观看| 欧美日本精品一区二区三区| 亚洲成人久久影院| 欧美精品123区| 日本中文字幕不卡| 精品久久久久香蕉网| 九九视频精品免费| 国产午夜精品久久久久久久| 国产精品一区二区不卡| 欧美—级在线免费片| 不卡的看片网站| 国产精品福利一区| 欧洲精品一区二区| 丝袜美腿亚洲一区二区图片| 69久久夜色精品国产69蝌蚪网| 视频在线观看91| 精品国产成人在线影院| 高清免费成人av| 一区二区三区四区中文字幕| 欧美三级日韩三级国产三级| 秋霞午夜鲁丝一区二区老狼| 2020国产精品自拍| caoporm超碰国产精品| 一区二区三区在线视频播放| 欧美理论片在线| 国产在线国偷精品产拍免费yy | 94色蜜桃网一区二区三区| 一区二区三区不卡在线观看| 欧美日韩一区二区三区高清| 韩国成人精品a∨在线观看| 中文字幕亚洲不卡| 日韩欧美中文字幕一区| bt欧美亚洲午夜电影天堂| 石原莉奈一区二区三区在线观看| 久久久一区二区| 精品视频在线免费观看| 国产精品99久久久久| 亚洲色图一区二区| 91精品一区二区三区久久久久久| 韩国精品主播一区二区在线观看| 亚洲日本va在线观看| 日韩三级中文字幕| 在线精品视频一区二区| 国产福利一区二区| 日韩成人精品在线| 亚洲激情五月婷婷| www久久精品| 91精品蜜臀在线一区尤物| 不卡一卡二卡三乱码免费网站| 日日夜夜精品免费视频| 亚洲视频一二区| 久久久久久久久久久黄色| 91麻豆精品国产91久久久久| 波波电影院一区二区三区| 狠狠色丁香婷婷综合久久片| 洋洋成人永久网站入口| 国产精品久久午夜夜伦鲁鲁| 日韩色视频在线观看| 欧美日韩一二三区| 色综合久久九月婷婷色综合| 风间由美性色一区二区三区| 久久国产精品第一页| 亚洲超丰满肉感bbw| 亚洲日穴在线视频| 日韩美女视频一区| 国产精品色哟哟网站| 精品91自产拍在线观看一区| 日韩一级片在线播放| 3d动漫精品啪啪一区二区竹菊| 欧美亚洲自拍偷拍| 欧美性做爰猛烈叫床潮| 日本韩国一区二区三区| 色中色一区二区| 91麻豆swag| 91国模大尺度私拍在线视频| 91美女片黄在线观看91美女| caoporen国产精品视频| 不卡av免费在线观看| 972aa.com艺术欧美| 日本精品一区二区三区高清 | 亚洲一区二区成人在线观看| 中文字幕中文字幕在线一区 | 麻豆成人91精品二区三区| 蜜桃在线一区二区三区| 日本aⅴ精品一区二区三区| 麻豆一区二区三区| 久久精品国产999大香线蕉| 久久精品国产亚洲a| 国产成人免费视频网站| 不卡一区二区三区四区| 色婷婷精品大视频在线蜜桃视频| 91福利国产成人精品照片| 欧美三级电影网站| 日韩精品一区二区三区swag| 久久―日本道色综合久久| 中文一区一区三区高中清不卡| 亚洲视频狠狠干| 日本不卡中文字幕| 国产成人av网站| 在线观看视频一区| 欧美一区二区成人| 国产精品视频免费| 亚洲va国产天堂va久久en| 经典三级一区二区| 色婷婷综合激情| 精品少妇一区二区| 最新热久久免费视频| 亚洲成人精品在线观看| 国产成人免费视频网站 | 欧美国产精品一区二区三区| 亚洲欧美电影一区二区| 爽好久久久欧美精品| 成人自拍视频在线| 欧美精品少妇一区二区三区| 国产午夜精品一区二区三区视频| 亚洲激情自拍视频| 国产露脸91国语对白| 精品视频一区二区不卡| 337p日本欧洲亚洲大胆精品| 亚洲精品视频在线观看免费| 精一区二区三区| 欧美一区日本一区韩国一区| 中文字幕av一区二区三区| 一区二区三区精品在线观看|