Grant's CGI Framework
Documentation: Web Utilities

Version: 2.0d6
Release Date: Tuesday, October 14, 1997
Expires no later than: December 31, 1997

Important: THIS DOCUMENTATION IS INCOMPLETE AND PROBABLY A BIT INACCURATE

It is subject to change as the API matures.
Feedback and contributions are encouraged:

grantcgi@list.nisto.com
or grant@achilles.net

These are general purpose World Wide Web cgi/plug-in utilities which are not dependent
on the CGI API.


SECURITY

CGIIsSecurePath

Boolean CGIIsSecurePath ( char *thePathString )

Test a given path string to ensure it won't try to 'jump' levels.

thePathString
must not be URL encoded (specifically, no %xx hex encoding).

CHARACTER CODING

CGIDecodeURLChars

void CGIDecodeURLChars ( char *theString, Boolean skipControlChars )

replaces instances of percent signs (%) followed by an ASCII char value with the actual character.

skipControlChars
if true, all characters less than 32 (including CR & LF) will be left out (other than those decoded from %xx encoding).
theString
is modified by this function.

CGICharWillHex

Boolean CGICharWillHex ( unsigned char theChar )

Returns true if theChar will be converted to hex when encoding as an URL string.

CGICharToHex

void CGICharToHex ( unsigned char theChar, char *theString )

Converts theChar to percent-hex encoding for URLs, and writes that to theString.

theString
must be at least 4 bytes long (to have enough room to write the hex encoded text).

CGIPathToMacPath

void CGIPathToMacPath ( char *ioPathString )

convert a '/' delimited path to a ':' delimited one, and make sure there's one ':' at the start if the path includes folders.

ioPathString
may be modified by this function. It MUST have an extra byte after its terminating null byte.

DATE HANDLING

DateToGMTString

CGIErr DateToGMTString ( UInt32 theDate, char *theDateString )

theDate - must be a Macintosh date value in the current time zone, e.g., as returned by GetDateTime.
theDateString - must be at least 30 bytes long (HTTP_DATE_STRING_LENGTH + 1)

DateGetDaysFromNow

UInt32 DateGetDaysFromNow ( UInt16 daysToAdd )

Returns a Mac toolbox format date (time in seconds since midnight, January 1, 1904) plus the specified number of days.

daysToAdd
number of days to add.

URL HANDLING

URLGetServerAddress

CGIErr URLGetServerAddress ( char *theURL, char **theServer, UInt16 *theServerLength )

Get a pointer to the server address within an URL.

Important: Do not attempt to deallocate theServer. Do not reference theServer once theURL has been deallocated (or moved).

theURL
must be a valid complete URL in a C format string.
theServer
will be set to point within theURL to the begining of the server address.
theServerLength
the length in bytes of the server string.

CGIErr_BadArgument will be returned if theURL is invalid.


Grant's CGI Framework

Contents: Nisto - Products - Mail Lists - Cree - Standards - Babylon 5

Privacy Statement, Legal Notices
Copyright ©1997-1998 Grant Neufeld. All rights reserved. abc