⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gcgi.html

📁 C/C++语言的CGI接口库
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>  <style type="text/css">    <!--    A:link       { color:               #486591;      }    A:visited    { color:               #aaaaaa;      }    A:hover      { color:               #b62b38;      }    .heading     { color:               #888888;                          font-weight:         bold;                    font-size:           x-large;      }    .subsection  { color:               #4e7c5d;                          font-weight:         bold;                    font-size:           medium;       }    .footer      { color:               #888888;                   font-size:           small;        }    IMG          { border:              0;            }    BODY         { background-color:    #ffffff;      }    .section     { font-size: large; color: #888888;                      font-weight: bold;                 }    .code        { font-family: fixed,courier;        }    .codeHeader  { color: #242e4c; font-weight: bold;                          font-family: fixed,courier;                          font-size: small; }    -->  </style>  <head>    <title>GNU CGI Library in C (GCGI)</title>  </head>  <body>    <center>    <div style="width: 80%; text-align: left; border-left: solid #486591 3px; padding:3px">	<p>	<span class=heading>GNU CGI Library in C (GCGI)</span><br>	  <span style="font-size: small; color=#cccccc;">	   	    [ <a href="#releases">releases</a> | <a href="#features">features</a> | <a href="#installation">installation</a> |	      <a href="#api">api</a> | <a href="#examples">examples</a> | <a href="#debugging">debugging</a> | 	      <a href="#history">history</a> | <a href="#who">who</a> ]	  </span>	</p>        <p>	  The GCGI library implements NCSA's <a href="http://www.w3.org/CGI/">Common Gateway Interface</a> 	  specification along with the extensions that were defined in 	  <a href="http://www.rfc-editor.org/rfc/rfc2388.txt">RFC2388</a>.	  GCGI is released under the GNU <a href="http://www.gnu.org/licenses/lgpl.txt">Lesser General Public License</a>.	</p>	<a name="releases"></a>	  <p>	  <span class=section>Releases:</span>	    <ul>	      <li><span class=codeHeader>June 22, 2002:</span> Release version 0.9.5. This release	        is primarily a bugfix release. Many improvements have been made to the build 		system and GCGI now builds on GNU/Linux and FreeBSD without modification.  Thanks		go to David Scherzer for providing ssh access to his FreeBSD server to fix GCGI		build issues.		See the <a href="./ChangeLog.txt">ChangeLog</a> for full details.                Download it here: <a href="http://catchen.org/gcgi/gcgi-0.9.5.tar.gz">gcgi-0.9.5.tar.gz</a>                <br><br>	      </li>	      <li><span class=codeHeader>June 15, 2002:</span> Release version 0.9.4. This release	        implements HTTP headers and cookies in GCGI.  This means you can now set and fetch	        regular and encrypted cookies (using OpenSSL) and manipulate the HTTP headers to send	        HTTP error codes, redirects to another page, cache controls and Content type and 	        disposition.  Also, as usual, some bug fixes are included. 		<br><br>	        <span class=codeHeader>Help Needed!</span> I am looking for someone who can build GCGI on any of	        the BSD variants.  I think GCGI now builds on Solaris without issue but needs some help	        including the right headers on BSD systems.<br><br>		I am trying to improve the build system for platforms other than GNU/Linux (which GCGI is		developed on) and need people who have access to these systems.  If you have built GCGI		on another platform, please let me know.<br><br>	      </li>	      <li><span class=codeHeader>March 24, 2002:</span> Release version 0.9.3. This release		contains several major new features.  Most importantly, GCGI no longer uses temporary		files to process RFC2388 queries.  It now buffers the incoming data internally. With		this buffering it is also now possible to place limits on the amount of data read.  You		can now specify two limits: 1) The total possible length of a CGI query, and 2) the 		length of a single MIME part.  This will allow developers to limit the sizes of files		that will be uploaded.  Also, included in this release is several smaller bugfixes as well.		<br><br>This is one of the last releases before GCGI is declared to be 1.0.  The remaining		features have to do with sending HTTP headers and cookies.  So, please try this release out		and send and bugs/comments/rants to <a href="mailto:topeka@catchen.org">me</a>.		See the <a href="./ChangeLog.txt">ChangeLog</a> for full details.                Download it here: <a href="http://catchen.org/gcgi/gcgi-0.9.3.tar.gz">gcgi-0.9.3.tar.gz</a>		<br><br>			      </li>              <li><span class=codeHeader>February 14, 2002:</span> Release version 0.9.2. This release                contains significant improvements to the build process.  GCGI is now system installable using autotools 	    	('make install') and all dependencies have been removed from the gcgi.h header file.              </li>	      <li><span class=codeHeader>February 8, 2002:</span> Release version 0.9.1. A		small bugfix release.	      </li>              <li><span class=codeHeader>January 26, 2002:</span> Release version 0.9.		<ul>                   <li> Project now builds with autotools: i.e. 		        <span class=codeHeader>./configure, make</span>.</li>     		   <li> gcgiFetchData() now returns MIME info		        about the uploaded data (type/subtype, encoding).</li>		   <li>MIME parsing now uses a token parser that is mych more robust and expandable.</li>		   <li>Added gcgiFieldSize() method to return buffer size for the specified field.</li>		</ul>                </li>              <li><span class=codeHeader>January 12, 2002:</span> Release version 0.82.                Small bugfix release.	      </li>	      <li><span class=codeHeader>January 6, 2002:</span> Release version 0.81.                Small bugfix release.	      </li>	      <li><span class=codeHeader>October 3, 2001:</span> Release version 0.80. 		Changes include better debugging support, stronger typechecking and several new encoding		functions.	      </li>  	      <li><span class=codeHeader>August 29, 2001:</span> Release version 0.71.  GCGI now compiles as a 		static library.  Fixed a few documentation bugs.</li>	      <li><span class=codeHeader>August 27, 2001:</span> Initial Release of GCGI 0.70: 	          gcgi-0.70.tar.gz</li>	    </ul>	  	  </p>	  <a name="features"></a>	  <span class=section>Features:</span>	    <p>	      <ul>		<li>Implements NCSA's CGI specification allowing you to easily process the data submitted by		    urlencoded HTML forms.</li>		<li>Implements RFC 2388.  This includes support for HTML forms encoded as 		    <span class="code">multipart/form-data</span> which gives support for such things as uploading		    files via HTML forms.</li>		<li>GCGI buffers incoming CGI data. Beacuase of this, it is possible to set upload limits		    to limit the size of single MIME parts or for the entire query (for RFC2388 uploads only).</li>	        <li>GCGI handles setting and fetching regular and encrypted cookies (using OpenSSL).</li>	        <li>GCGI can control the HTTP headers sent to the browser to change cache behavior, send HTTP	            error codes, redirect the browser to other pages and to send both the Content-Type and	            Content-Disposition headers.</li>		<li>Includes several functions to capture a CGI environment and query string to external files.  		    GCGI can then be invoked in debug mode to run CGI programs from the command line or  		    through a debugger.</li>	      </ul>	    </p>	  <a name="installation"></a>	  <span class=section>Installation:</span>	      <p>Unpack the gcgi-0.9.5.tar.gz:</p>        	      <p><span class="code">$ tar xvfz gcgi-0.9.5.tar.gz<br>		  $ cd gcgi-0.9.5</span></p>	      <p>Configure the library:</p>	      <p><span class="code">$ ./configure</span></p>	      <p>To build GCGI with encryption support, run configure like this:</p>	      <p><span class="code">$ ./configure --with-openssl</span></p>	      <p>Build the gcgi library:</p>	      <p><span class="code">$ make</span></p>	      <p>This should create the static library file, libgcgi.a in the 	      <span class="code">src</span> subdirectory.</p>	      <p>If you want to make the library available to the rest of the system:</p>	      <p><span class="code">$ su<br>       	      # make install</span></p>        	      <p>Otherwise, copy the library and the gcgi.h header file somewhere convienent.  	        For the following example, the library and header were copied into the same         	directory as the program being built against it.		First compile your program and then link against GCGI like this:</p>	      <p><span class="code">$ gcc -g -Wall -c example-prog.c<br>	      $ gcc -g -Wall -o example-prog -L. example-prog.o -lgcgi</span></p>	      <p>and if you built with OpenSSL, link like this:</p>        <p><span class="code">$ gcc -g -Wall -o example-prog -L. example-prog.o -lgcgi -lm -lssl -lcrypto</span></p>        <p>A set of example programs will also be built in the examples/ directory.        There are example HTML forms in the examples subdirectory to use with the example programs.          These should give you a good idea how to use GCGI's funtions. </p>	  <a name="api"></a> 	      	  <span class="section">API:</span>	  <p><span class="subsection">Initialization Functions</span></p>	      <p>		<span class="codeHeader">gcgiResultType   initCgi( void )</span><br>		  This function must be called before any interaction with the GCGI library.  It will 		  initialize the GCGI data structures and parse the input from the web server.  The 		  function returns <span class="code">GCGISUCCESS</span> if it is able to instantiate the 		  CGI structures and parse the input, and <span class="code">GCGIFATALERROR</span> otherwise.		</p>		<p>		<span class="codeHeader">void  freeCgi( void )</span><br>		  This function must be called after use of GCGI has been completed.  It will free the 		  memory that GCGI is using.		</p>                <p>                <span class="codeHeader">gcgiResultType   gcgiSetLimits(size_t fieldLimit, size_t queryLimit)</span><br>                  This function must be called before <span class="code">initCgi()</span>. It will		  set two limits internally for the GCGI library: 1) the fieldLimit will cause GCGI to truncated		  any single MIME part of an RFC2388 query to this numebr.  It applies to all MIME parts in		  the CGI query. 2) the queryLimit is the maximum data the GCGI library will read for the 		  entire query.  These limits only apply to RFC2388's multipart/form-data. If either or both of the		  limits are set to 0, then GCGI does not limit the incoming query with that limit.  The                  function returns <span class="code">GCGISUCCESS</span> if the limits are successfully set.                </p>	  <p><span class="subsection">Data-Fetching Functions</span></p>		<p>		<span class="codeHeader">char *gcgiFetchEnvVar(int env)</span><br>		  Returns a string containing the environment variable specified as a parameter, and a NULL		  pointer, otherwise.  The available environment variables are listed below.		</p>		<p>  		<span class="codeHeader">gcgiResultType gcgiFetchInteger(char *field, int *ret, int defaultRet)</span><br>		  This function returns an integer in the <span class="code">ret</span> parameter for the field specified		  in the HTML form by <span class="code">field</span>.  Upon success, <span class="code">GCGISUCCESS</span>		  is returned, and if the field is not present, then <span class="code">ret</span> contains the value 		  given in <span class="code">defaultRet</span> and <span class="code">GCGIFIELDNOTFOUND</span> is returned.		  If there is more than one form field of the same name, this funtion will always return the first 		  value submitted by the browser.		</p>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -