Compatibility with other APIs

The Caching Proxy API is backward-compatible with ICAPI and GWAPI, through version 4.6.1.

Porting CGI programs

Use the following guidelines for porting CGI applications written in C to use the Caching Proxy API:

  • Remove your main() entry point, or rename it so that you can build a DLL.
  • Eliminate global variables or protect them with a mutual exclusion semaphore.
  • Change the following calls in your programs:
    • Change printf() header calls to HTTPD_set() or httpd_setvar().
    • Change printf() data calls to HTTPD_write().
    • Change getenv() calls to HTTPD_extract() or httpd_getvar(). Be aware that these calls will return unallocated memory, so you must perform a free() call on the result to prevent a memory leak.
  • Remember that the server runs in a multithreaded environment, and your plug-in functions must be thread safe. If the functions are reentrant, performance does not decrease.
  • Remember to set the Content-Type header if you are using HTTPD_write() to send data back to the client.
  • Check your code meticulously for memory leaks.
  • Think about your error paths. If you generate error messages yourself and send them back as HTML, you must return HTTPD_OK from your service function or functions.

Icon that indicates the type of topic Reference topic



Timestamp icon Last updated: March 23, 2018 0:18
File name: compatibility.html