使用者工具

網站工具


program:c:cgi_-_libraries

<html> <head> <meta http-equiv=“Content-Type” content=“text/html; charset=UTF-8”> <title>Comparison of CGI libraries in C</title> <script type=“text/javascript”> window.google_analytics_uacct = “UA-11731688-3”; </script> </head> <body>

<h1>Comparison of CGI libraries in C</h1>

<p> This is a comparison of publicly available libraries in the C programming language which help to program with CGI, the “common gateway interface” for the world wide web. For more information on the common gateway interface, please see <a href='../../cgi/simple-guide/index.html'>A simple guide to the common gateway interface</a>.</p>

<p> Some of the fields in the following tables are marked as “unknown” or given a question mark because I have not had time to evaluate whether the library provides that particular feature. I apologise for the incompleteness of this list and hope that the incomplete list still has some value. </p>

<h2>Libraries</h2>

<p>The following list of CGI libraries written in C is ordered by the date of the most recent release.</p>

<table class=“cgi-library-table”> <tr> <th> Library name (host)<br> <small>(Links open in a new window)</small> </th> <th> Last update </th> <th> Last version </th> <th> Licence </th> <th>Authors</th> <th> Download </th> </tr>

<tr> <td> <a href=“http://www.qdecoder.org/wiki/qdecoder” target=“_blank”>qDecoder</a> (www.qdecoder.org) </td> <td> 2012-05-17 </td> <td class=“version-cell”> 12.0.2 </td> <td> Public domain </td> <td> Seungyoung Kim </td> <td>

<a href=“http://www.qdecoder.org/wiki/qdecoder/download”>Download</a>

</td> </tr>

<tr> <td> <a href=“http://www.infodrom.org/projects/cgilib/” target=“_blank”>Lightweight CGI Library</a> (www.infodrom.org) </td> <td> 2009-02-08 </td> <td class=“version-cell”> 0.7 </td> <td> GNU GPL </td> <td> Martin Schulze </td> <td>

<a href=“http://www.infodrom.org/projects/cgilib/download/cgilib-0.7.tar.gz”>Download</a>

</td> </tr>

<tr> <td> <a href=“http://www.boutell.com/cgic/” target=“_blank”>cgic</a> (www.boutell.com) </td> <td> 2008 </td> <td class=“version-cell”> 2.05 </td> <td> Advertising (see site for details) </td> <td> Thomas Boutrell </td> <td>

<a href=“http://www.boutell.com/cgic/cgic205.tar.gz”>Download</a>

</td> </tr>

<tr> <td> <a href=“http://www.pavluk.org/projects/libcgic/libcgic/” target=“_blank”>libcgic</a> (www.pavluk.org) </td> <td> 2008 </td> <td class=“version-cell”> 1.0 </td> <td> BSD licence </td> <td> Vladimir V. Pavluk </td> <td>

<a href=“http://www.pavluk.org/projects/libcgic/libcgic-1.0.tar.gz”>Download</a>

</td> </tr>

<tr> <td> <a href=“http://www.harding.motd.ca/cgl/” target=“_blank”>CGL</a> (www.harding.motd.ca) </td> <td> 2005-08-18 </td> <td class=“version-cell”> 1.2 </td> <td> BSD-like </td> <td> Carson Harding </td> <td>

<a href=“http://www.harding.motd.ca/cgl/cgl-1.2.tgz”>Download</a>

</td> </tr>

<tr> <td> <a href=“http://www.newbreedsoftware.com/cgi-util/” target=“_blank”>cgi-util</a> (www.newbreedsoftware.com) </td> <td> 2005 </td> <td class=“version-cell”> 2.2.1 </td> <td> GNU Library GPL </td> <td> Bill Kendrick<br>Mike Simons </td> <td>

<a href=“ftp://ftp.tuxpaint.org/unix/www/cgi-util/cgi-util-2.2.1.tar.gz”>Download</a>

</td> </tr>

<tr> <td> <a href=“http://www.joeldare.com/wiki/software_projects” target=“_blank”>CGI-LIB</a> (www.joeldare.com) </td> <td> 2004 </td> <td class=“version-cell”> 2.0 </td> <td> GNU GPL </td> <td> Noel V Aguilar<br>Joel Dare </td> <td>

<a href=“http://www.joeldare.com/files/cgilib_2.0_src.zip”>Download</a>

</td> </tr>

<tr> <td> <a href=“http://www.midwinter.com/~koreth/uncgi.html” target=“_blank”>Un-CGI</a> (www.midwinter.com) </td> <td> 2003-11-01 </td> <td class=“version-cell”> 1.11 </td> <td> Gnu-like, see source code. </td> <td> Steven Grimm </td> <td>

<a href=“ftp://ftp.midwinter.com/pub/uncgi-1.11.tar.Z”>Download</a>

</td> </tr>

<tr> <td> <a href=“http://www.eekim.com/software/cgihtml/index.html” target=“_blank”>cgihtml</a> (www.eekim.com) </td> <td> 2001-05-25 </td> <td class=“version-cell”> 1.69 </td> <td> Unspecified </td> <td> Eric E. Kim </td> <td>

<a href=“http://www.eekim.com/software/cgihtml/cgihtml.tar.gz”>Download</a><br> (Not working)

</td> </tr>

<tr> <td> <a href=“http://sourceforge.net/projects/cgi-c/” target=“_blank”>A CGI Library for C</a> (sourceforge.net) </td> <td> 1999 </td> <td class=“version-cell”> 1.0 </td> <td> GNU GPL or GNU Library GPL </td> <td> William L. Chatfield </td> <td>

<a href=“http://sourceforge.net/projects/cgi-c/files/cgi-c/1.0/cgi-c-1.0-src.zip/download”>Download</a>

</td> </tr>

</table> <h2>Features</h2> <h3>Basics</h3>

<table class=“cgi-library-table”> <tr> <td></td>

<th>C version</th>

<th>Documentation</th>

<th>Automated tests</th>

</tr>

<tr> <th>qDecoder</th>

<td class=“unknown”>Unknown</td>

<td class=“feature”>

yes (web page/doxygen)

</td>

<td class=“no-feature yes-no”>No</td>

</tr>

<tr> <th>Lightweight CGI Library</th>

<td class=“feature”>

GNU C

</td>

<td class=“feature”>

yes (man files)

</td>

<td class=“unknown”>Maybe</td>

</tr>

<tr> <th>cgic</th>

<td class=“feature”>

ANSI

</td>

<td class=“feature”>

yes (web page)

</td>

<td class=“unknown”>Maybe</td>

</tr>

<tr> <th>libcgic</th>

<td class=“unknown”>Unknown</td>

<td class=“no-feature yes-no”>No</td>

<td class=“unknown”>Maybe</td>

</tr>

<tr> <th>CGL</th>

<td class=“unknown”>Unknown</td>

<td class=“feature”>

yes (doc/cgl.txt)

</td>

<td class=“unknown”>Maybe</td>

</tr>

<tr> <th>cgi-util</th>

<td class=“unknown”>Unknown</td>

<td class=“feature”>

yes (README.txt)

</td>

<td class=“unknown”>Maybe</td>

</tr>

<tr> <th>CGI-LIB</th>

<td class=“unknown”>Unknown</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

</tr>

<tr> <th>Un-CGI</th>

<td class=“unknown”>Unknown</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

</tr>

<tr> <th>cgihtml</th>

<td class=“unknown”>Unknown</td>

<td class=“feature yes-no”>Yes</td>

<td class=“unknown”>Maybe</td>

</tr>

<tr> <th>A CGI Library for C</th>

<td class=“unknown”>Unknown</td>

<td class=“no-feature yes-no”>No</td>

<td class=“unknown”>Maybe</td>

</tr>

</table>

<h3>HTTP headers</h3>

<table class=“cgi-library-table”> <tr> <td></td>

<th>Set content type</th>

<th>Set charset</th>

<th>Set status</th>

<th>Set error message</th>

<th>Add arbitrary HTTP headers</th>

<th>Print header</th>

</tr>

<tr> <th>qDecoder</th>

<td class=“feature”>

qCgiResponseSetContentType

</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

</tr>

<tr> <th>Lightweight CGI Library</th>

<td class=“feature”>

cgiSetType

</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“feature”>

cgiSetHeader

</td>

<td class=“feature”>

cgiHeader

</td>

</tr>

<tr> <th>cgic</th>

<td class=“feature”>

cgiHeaderContentType

</td>

<td class=“no-feature yes-no”>No</td>

<td class=“feature”>

cgiHeaderStatus

</td>

<td class=“feature”>

cgiHeaderStatus

</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

</tr>

<tr> <th>libcgic</th>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

</tr>

<tr> <th>CGL</th>

<td class=“feature”>

cgl_content_header

</td>

<td class=“no-feature yes-no”>No</td>

<td class=“feature”>

cgl_status_header

</td>

<td class=“feature”>

cgl_status_header

</td>

<td class=“no-feature yes-no”>No</td>

<td class=“feature”>

cgl_html_header

</td>

</tr>

<tr> <th>cgi-util</th>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

</tr>

<tr> <th>CGI-LIB</th>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

</tr>

<tr> <th>Un-CGI</th>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

</tr>

<tr> <th>cgihtml</th>

<td class=“feature”>

mime_header

</td>

<td class=“no-feature yes-no”>No</td>

<td class=“feature”>

status

</td>

<td class=“feature”>

status

</td>

<td class=“no-feature yes-no”>No</td>

<td class=“feature”>

http_header

</td>

</tr>

<tr> <th>A CGI Library for C</th>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

</tr>

</table>

<h3>Form parsing</h3>

<table class=“cgi-library-table”> <tr> <td></td>

<th>process query string</th>

<th>application/x-url-formencoded</th>

<th>multipart/form-data (file upload)</th>

<th>Multiple values for one key</th>

<th>uri escape</th>

<th>uri unescape</th>

</tr>

<tr> <th>qDecoder</th>

<td class=“feature yes-no”>Yes</td>

<td class=“feature yes-no”>Yes</td>

<td class=“feature yes-no”>Yes</td>

<td class=“unknown”>Maybe</td>

<td class=“feature”>

yes (in qLibc)

</td>

<td class=“feature”>

yes (in qLibc)

</td>

</tr>

<tr> <th>Lightweight CGI Library</th>

<td class=“feature yes-no”>Yes</td>

<td class=“feature yes-no”>Yes</td>

<td class=“feature yes-no”>Yes</td>

<td class=“feature”>

separated by \n

</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

</tr>

<tr> <th>cgic</th>

<td class=“feature yes-no”>Yes</td>

<td class=“feature yes-no”>Yes</td>

<td class=“feature yes-no”>Yes</td>

<td class=“feature”>

cgiFormStringMultiple

</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

</tr>

<tr> <th>libcgic</th>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

</tr>

<tr> <th>CGL</th>

<td class=“feature yes-no”>Yes</td>

<td class=“feature yes-no”>Yes</td>

<td class=“no-feature yes-no”>No</td>

<td class=“feature”>

cgl_getvalues

</td>

<td class=“feature”>

cgl_urlencode

</td>

<td class=“feature”>

cgl_urldecode

</td>

</tr>

<tr> <th>cgi-util</th>

<td class=“feature yes-no”>Yes</td>

<td class=“feature yes-no”>Yes</td>

<td class=“feature yes-no”>Yes</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“feature”>

unescape_url

</td>

</tr>

<tr> <th>CGI-LIB</th>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

</tr>

<tr> <th>Un-CGI</th>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

</tr>

<tr> <th>cgihtml</th>

<td class=“feature yes-no”>Yes</td>

<td class=“feature yes-no”>Yes</td>

<td class=“feature yes-no”>Yes</td>

<td class=“feature”>

cgi_name_multi

</td>

<td class=“no-feature yes-no”>No</td>

<td class=“feature”>

unescape_url

</td>

</tr>

<tr> <th>A CGI Library for C</th>

<td class=“feature yes-no”>Yes</td>

<td class=“feature yes-no”>Yes</td>

<td class=“feature yes-no”>Yes</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

</tr>

</table>

<h3>Cookies</h3>

<table class=“cgi-library-table”> <tr> <td></td>

<th>Read cookies</th>

<th>Set cookies</th>

<th>Create cookie time strings</th>

<th>Delete cookies</th>

</tr>

<tr> <th>qDecoder</th>

<td class=“feature yes-no”>Yes</td>

<td class=“feature”>

qCgiResponseSetCookie

</td>

<td class=“unknown”>Maybe</td>

<td class=“feature”>

qCgiResponseRemoveCookie

</td>

</tr>

<tr> <th>Lightweight CGI Library</th>

<td class=“feature yes-no”>Yes</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

</tr>

<tr> <th>cgic</th>

<td class=“feature yes-no”>Yes</td>

<td class=“feature yes-no”>Yes</td>

<td class=“feature yes-no”>Yes</td>

<td class=“no-feature yes-no”>No</td>

</tr>

<tr> <th>libcgic</th>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

</tr>

<tr> <th>CGL</th>

<td class=“feature yes-no”>Yes</td>

<td class=“feature yes-no”>Yes</td>

<td class=“feature”>

cgl_cookietime

</td>

<td class=“no-feature yes-no”>No</td>

</tr>

<tr> <th>cgi-util</th>

<td class=“feature”>

cgi_getcookie

</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

</tr>

<tr> <th>CGI-LIB</th>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

</tr>

<tr> <th>Un-CGI</th>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

</tr>

<tr> <th>cgihtml</th>

<td class=“feature yes-no”>Yes</td>

<td class=“feature yes-no”>Yes</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

</tr>

<tr> <th>A CGI Library for C</th>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

</tr>

</table>

<h3>Extras</h3>

<table class=“cgi-library-table”> <tr> <td></td>

<th>html generation</th>

<th>compression</th>

<th>save environment</th>

<th>Redirects</th>

</tr>

<tr> <th>qDecoder</th>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“feature”>

qCgiResponseRedirect

</td>

</tr>

<tr> <th>Lightweight CGI Library</th>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“feature”>

cgiRedirect

</td>

</tr>

<tr> <th>cgic</th>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“feature”>

cgiWriteEnvironment

</td>

<td class=“feature”>

cgiHeaderLocation

</td>

</tr>

<tr> <th>libcgic</th>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

</tr>

<tr> <th>CGL</th>

<td class=“feature yes-no”>Yes</td>

<td class=“no-feature yes-no”>No</td>

<td class=“feature”>

cgl_dumpenv

</td>

<td class=“no-feature yes-no”>No</td>

</tr>

<tr> <th>cgi-util</th>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

</tr>

<tr> <th>CGI-LIB</th>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

</tr>

<tr> <th>Un-CGI</th>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

<td class=“unknown”>Maybe</td>

</tr>

<tr> <th>cgihtml</th>

<td class=“feature yes-no”>Yes</td>

<td class=“no-feature yes-no”>No</td>

<td class=“feature”>

print_cgi_env

</td>

<td class=“no-feature yes-no”>No</td>

</tr>

<tr> <th>A CGI Library for C</th>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

<td class=“no-feature yes-no”>No</td>

</tr>

</table>

<h3>Key to the tables</h3> <table class=“cgi-library-table”> <tr> <td class=“no-feature yes-no”>No</td> <td>Does not have this feature</td> </tr> <tr> <td class=“unknown yes-no”>Maybe</td> <td>Unknown or not tested</td> </tr> <tr> <td class=“feature yes-no”>Yes</td> <td>Has this feature</td> </tr> </table>

<!– Removed since there was an obsessed downloader. –>

<h2>Reviews</h2>

<p> These reviews are meant to supplement the tabular information listed above. All of the CGI libraries listed on this page suffer from very similar problems; none of them has an automated test, almost all of them don't handle HTTP headers fully, and none of them handles compression at all.</p>

<h3>“qDecoder” by Seungyoung Kim</h3>

<p>

<p> Has basic CGI library features including parsing forms and setting and deleting cookies. The examples on the web page are written in C++ but the code itself is C. Lacks ways to set the HTTP status or the character set of the page. </p>

<p> One unusual feature is a way to force a download using a

Content-Disposition:

header. </p>

</p>

<h3>“Lightweight CGI Library” by Martin Schulze</h3>

<p>

This library appears to be quite difficult to use. The use of C string functions in parsing multipart/form-data is likely to cause problems in the case of binary file uploads with bytes equal to zero.

</p><p>

The web page for this library claims that it supports writing cookies, but I could not see where this was implemented.

</p>

<h3>“cgic” by Thomas Boutrell</h3>

<p> ★★★☆☆ </p>

<p>

This library has been around since the 1990s. It is carefully programmed to avoid problems such as memory leaks. It has a lot of documentation for each function. It also comes with example code and a debugging helper to capture the CGI environment. </p>

<p> Its licence requires users to either pay a fee or include advertising for it in output. The library provides its own

main

function, and users must use something called

cgiMain

instead.</p>

<p> The C programming is a bit questionable. The first thing the library does is to read every possible environment variable into global variables, but most of these it goes on to completely ignore.

</p>

<h3>“CGL” by Carson Harding</h3>

<p>

A lot of this code looks useful, but it barely seems to be robust.

</p><p>

Careless in the way that it relies on printf for functions like setting the HTTP headers, so there is no distinction between creating the flow of output and setting the headers. This kind of behaviour tends to make debugging difficult, especially it tends to cause problems with malformed HTTP headers if the programmer forgets what stage he is at in the flow of output. The library is also missing the feature of multipart form handling (file uploads).

</p><p>

The extensive use of hash tables to store form name and value pairs looks a bit excessive considering the number of these things in even a fairly large HTML form.

</p><p>

The library also contains a facility to print headers as if it was a web server rather than a CGI library.

</p>

<h3>“cgi-util” by Bill Kendrick<br>Mike Simons</h3>

<p>

This library is not clearly documented, and seems to be somewhat incomplete. For example, it provides nothing to deal with HTTP headers or cookies. On the bright side, it contains a lot of error status checking. It also contains odd-bod functions like an email address validation routine.

</p>

<h3>“cgihtml” by Eric E. Kim</h3>

<p>

This library is no longer updated by its author. Its internals refer to ancient bugs of Netscape Navigator and uses cludges to do things like detect whether the browser can accept images. The download no longer works.

</p>

<h3>“A CGI Library for C” by William L. Chatfield</h3>

<p>

This library has no documentation. From looking at the code, the main ability seems to be to parse HTML form data. It does not seem to have any output parts.

</p>

<h2>Web links</h2>

<ul><li> <a href=“http://www.ietf.org/rfc/rfc2616.txt”>RFC 2616 - Hypertext Transfer Protocol – HTTP/1.1</a><blockquote>The specification for the Hypertext Transfer Protocol (HTTP).</blockquote></li><li> <a href=“http://www.w3.org/TR/html401/interact/forms.html#h-17.13.3”>WWW Consortium - Processing form data</a></li></ul><div id='c-forum' style='border:1px dotted;background:#eef;padding:5px;text-align:center;'> Ask and answer questions on C in the new <a href='../../c/forum/'>C forum</a> </div>

</body> </html>

program/c/cgi_-_libraries.txt · 上一次變更: 2019/11/16 08:12 由 127.0.0.1