FAQ.


So what is Mod CGI Debug?

Where do I get it from?

What sort of license does it have?

How can I make suggestions for it?

How can I report a bug?

Is there a mailing list?

How do I install it?

How do I use it?

What are the directives?

How do I customize it?

What about running the CGI and getting output?

So what is Mod Debug?

Mod Debug is designed to help with the CGI programming and debugging process. While programming a CGI script, it is often rather difficult to discover what is actually getting returned to the web server. Rather than chopping up your CGI script with a whole bunch of debug print statements, a single change to the action statement of the calling form will bring up a nicely formatted page with all of the information that the web server sees, including any get and post arguments, and the send and recieve headers.


Where do I get it from?

You can get it from either here via the web or here via ftp.

What sort of license does it have?

You are pretty much free to use it as you please. Check out the License file with the distribution for more details. In all likelihood I will switch to either GNU or Apache style licensing at some point in the future.


How can I make suggestions for it?

Send email to cgidebug@tangent.org.


How can I report a bug?

Send email to cgidebug@tangent.org.


Is there a mailing list?

Not yet. If you have any bug reports or requests for features, please send email to us at cgidebug@tangent.org

.

How do I install it?

From the INSTALL file:


Do you use DSO? If so just type make and

as long as apxs is in your path all things

should go smoothly.

If you are not using DSO you should be :)


If for some reason you need to compile apache try the following:

1. Change the current directory to the directory containing your apache source distribution.


2. Call the configure script as you normally would and add the switch:

--add-module=<path-to-mod_cgi_debug-directory>/mod_cgi_debug.c


3. Make sure the build environment is clean by issuing the following

command:

> make clean


4. Build the new httpd binary with:

> make


5. Install the new httpd binary with:

> make install


How do I use it?

Once you have mod_cgi_debug set up and going, it's time to modify the httpd.conf file to use it. Add a line that says:

AddHandler cgi_debug .env
Restart Apache, and any URL directed to the server with a .env extension will get passed to mod_cgi_debug.

Now is the fun part- take any HTML form (or CGI that generates a form), and tack a '.env' on the end of the name of the CGI that is processing the form. Pull up a web browser, fill in the form, press 'submit', and see what the server sees!

What are the directives?

  • CGIDebugKeyColor
  • CGIDebugValueColor
  • CGIDebugHeaderIn
  • CGIDebugHeaderOut
  • CGIDebugGetData
  • CGIDebugPostData
  • CGIDebugPathInfo
  • CGIDebugHangingIndent
  • CGIDebugHandler
  • CGIDebugHandlerKey


  • How do I customize it?

    All of the directives above customize the appearance of the cgi_debug page, and change what information is displayed. The CGIDebugKeyColor and CGIDebugValueColor directives both take a string containing a color in hexidecimal format. (i.e. "#FFFFFF"). The others are simply On or Off.

    What about running the CGI and getting output?

    Yes!. Not a problem, but none of the content from a POST based request will be displayed (ok, this is not entirely true... anything that was an argument to the URI will be displayed but until Apache 2.1 comes out there is nothing we can do about data sent to STDIN. To dink with that would require us to do something like mod_ssl which would mean compiling into Apache... that would be a mess). For it to work you need to tell mod_cgi to handle the content type. For this to work you would need use "CGIDebugHandler cgi-script" or for mod_perl "CGIDebugHandler perl-script". For PHP you would need to use its handler types. To enable different sections to be display add to your URI arguments "_DEBUG=headsersin". The different values that are supported currently are:

  • banner (prints out host information and such)
  • headersin (prints out the HTTP headers that arrived from the browser)
  • headersout (prints out the HTTP headers that we are sending out (only partially supported)
  • unparsed_uri (what the URI looked like on the way in)
  • path_info
  • get_args (arguments on the URI)
    Note that the key used in arguments, "_DEBUG", can be changed by using the CGIDebugHandlerKey directive.