The below attachment is HTTP Server Source code that supports CGI.
Detail Description:
HTTPSVR is an MFC sample that demonstrates the use of MFC and its Windows Sockets (WinSock) classes in implementing a simple World Wide Web HTTP Server. HTTPSVR turns any computer connected to a network into a publishing platform viewable from any of a number of web browsers available on the market today, such as Microsoft's Internet Explorer.
HTTPSVR also minimally supports the Common Gateway Interface (CGI). You can create forms and execute CGI-compatible server-side applications using the standard hypertext markup language (HTML) tags.
To increase performance, HTTPSVR checks a file's last modified date and compares it to the date sent by the browser in the HTTP If-Modified-Since field. Most browsers will send this field if they already have a copy of the file in their cache. If the file has not been modified since the date of the cached copy, it will send the browser a Not Modified status code instead of downloading the entire file again.
출처 : http://strcpy.com/69