Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A C library to build CGI applications
C Shell Makefile HTML
branch: master
Failed to load latest commit information.
doc Migrating the source from sourceforge to github
examples Migrating the source from sourceforge to github
src fix #19 by removing cgi_init_headers() call from sess_file_rewrite()
.gitignore remove files created at build time and update git ignore list
COPYING add license after having talked to Rafael and in line with what ptxdi… make the library filename match its soname Migrating the source from sourceforge to github Migrating the source from sourceforge to github make the library filename match its soname
render_md.rb Migrating the source from sourceforge to github


LibCGI is a simple to use yet powerful library written from scratch to assist in the making of CGI appliactions in C. It has support for string manipulation, linked lists, cookies, sessions, GET and POST methods and more.

It was my first Open Source project, somewhere back in the 2000s and somethings. Originally it was hosted at Sourceforge.


  • Type ./configure and then make
  • To clean, type make clean
  • To remove library files, type make uninstall
  • At the examples/ directory you'll find some code to start with


Well, I am keeping this TODO list here for historical (and funny) reasons. Nowadays I don't have any plans to enhance or change anything.

  • Template Engine
  • Mime functions
  • Encrypted session
  • Memory Management functions
  • Code speed ups
  • Other miscelaneous functions
  • Win32 port? ( who wants it? )


Vesion 1.0 Thanks to James Marjie, Mitch, Tamas Sarlos, Luis Figueiredo, Oliver Schlag and Sverre H. Huseby


  • Fixed a possible memory problem in htmlentities() function


  • Changed md5 suport. No external libs needed anymore


  • Renamed list_* functions to slist_* ( 's' of 'single' )


  • Some quick fixes to fs functions


  • Moved to va_copy() instead direct variable reference copy
  • Removed hard-coded program names from ( gcc and ar )


  • Fixed many CRLF issues ( were just LF instead CRLF )
  • Some header files reorganization
  • Fixed the examples ( deprecated things )

Version 0.8.2 Thanks to Tonu Samuel


  • Fixed some pointer manipulation bugs in list.c and cgi.c

Version 0.8.1 Thanks to Oliver Schlag, Tommy, Diogo Gonzaga, Robert Csok


  • Some changes in the documentation
  • New source tree
  • Added make_string function


  • Added md5 function
  • Added recvline function


  • Fixed a small string check bug in explode() function


  • Now compiles well under Solaris
  • getline() function is no longer necessary. Implemented my own way to read from session files.

Version 0.8.0 Thanks to Hao Yu, Rainer Huobert, Zentara, Dennis Reichel, Tony Hansen, Jakub Skopal


  • Rewritten process_data() function.


  • Added addslashes() function to cgi.c ( was missing )


  • Fixed Makefile to correctly include error.o when compiling libcgi.a
  • Fixed process_data() function to prevent bad-formed %xx data


  • Fixed pointer manipulation problems in base64.c
  • Added support to C++


  • Fixed many warnings messages

Version 0.7.5 2002/06/29

  • Fixed a bug in cgi_session_start()
  • Added cgi_session_save_path() function
  • Added cgi_session_cookie_name() function


  • Fixed cgi_cookie_add() to correctly handle cookie expiration times


  • Revised session manipulation functions
  • Code cleanups


  • Rewritten strpos() function.
  • Added strnpos() function


  • Updated explode() function
  • New examples


  • Updated htmlentities() function
  • Added str_base64_encode() and str_base64_decode() functions


  • Fixed a small bug in cgi_unescape_special_chars()
  • Fixed process_data() function to handle %xx ( hexa chars ) correctly
  • New cgi_include() function

Version 0.7.4 Thanks to Andre 'pXd'


  • Release with know bugs
  • Fixed a memory leak at process_data() function
  • Fixed an incorrect parser when there was only one parameter in the URL
  • Droped redundante calls to sizeof() when using malloc()


  • Code cleanups
  • Dropped some documentation
  • Examples revised and updated

Version 0.7.3 2002/04/14

  • Code revision
  • header files rewritten
  • Added cgi_send_header() function

Version 0.7.2 Special thanks to Erik Jansson and Robert Csok


  • Due to a little bug, cgi_include() was dropped to its original version


  • Examples revised


  • Added str_nreplace() function
  • Changed replace() to str_replace()
  • Added stripnslashes() function
  • Documentation updated


  • New documentation
  • Added cgi_ to many function names
  • Added addnslashes() function


  • Added htmlentities() function


  • Fixed another bug at process_data() function that caused more than necessary characters to be copied


  • Fixed a memory leak in cgi_process_form() function
  • Changed init_hex_table() function to use memset() insted for() loop to fill the array


  • Fixed a format bug in cgi_include() function
  • Fixed a bug in process_data() function that caused some characters to be incorrectly handled
  • Improved cgi_include() function performance


  • Added ltrim(), rtrim() and trim() functions

Version 0.7.1 2002/01

  • A bug in sess_file_rewrite() that caused application to crash was fixed

Version 0.7 Special thanks to ZE bennyben


  • Session support major updates
  • Some memory leaks and String manipulation bugs fixed
  • Removed debug() funciont and #define's relacted
  • Added libcgi_error() for internal error handling
  • Source code tree modified
  • Header files better written
  • More examples
  • Documentation updated

Version 0.1 update 6 Special thanks to Marcio Kuchma


  • pt_BR documentation, Makefile rewritten, minor improvements

Version 0.1 update 5 2001/11/14

  • A friend told me about a paper that describes ways to crack session id's.. I know that my session support ( file session.c ) is really unstable...


  • Modified strpos() function. Now you can specify the number of the characters to match

Version 0.1 update 4 2001/11/10

  • Finished the script to process XML documentation


  • Changed Makefile. Now it shows the make options

Version 0.1 update 3 2001/11/06

  • Added file() function

Version 0.1 update 2 2001/01/11

  • Finished documentation in XML format

Version 0.1 update 1 2001/10

  • Makefile fixed. Now it's more simple

Version 0.1 2001/10

  • First non-oficial release
Something went wrong with that request. Please try again.