W3C httpd manual

cgiutils Manual

cgiutils program is provided to make it easier to produce easily a full HTTP1 response header by NPH [No-Parse-Headers] scripts. It can also be used to just calculate the Expires: header, given the time to live in a human-friendly way, like
        1 year 3 months 2 weeks 4 days 12 hours 30 mins 15 secs

Command Line Options

cgiutils -version
print the version information.

don't produce the Date: header.

don't print the empty line after headers [in case you want to output other MIME headers yourself after the initial header lines].

-status nnn
give full HTTP1 response, instead of just a set of HTTP headers, with HTTP status code nnn.

-reason explanation
specify the reason line for HTTP1 response [can only be used with the -status nnn options.

-ct type/subtype
specify the MIME content-type.

-ce encoding
specify the content-encoding [e.g. x-compress, x-gzip].

-dl language-code
specify the content-languge code.

-length nnn
specify the MIME content-length value.

-expires time-spec
specify the time to live, like "2 days 12 hours", and cgiutils will compute the Expires: field value [which is the actual expiry date and time in GMT and in format specified by HTTP spec].

-expires now
means immediate expiry. Often this is exactly what the scripts should output.

-uri URI
specify the URI for the returned document.

-extra xxx: yyy
specify an extra header which cannot otherwise be specified for cgiutils.

IMPORTANT: Make sure that you quote the option arguments that are more than one word:
        cgiutils -expires "2 days 12 hours 30 mins"


        cgiutils -status 200 -reason "Virtual doc follows" -expires now
        HTTP/1.0 200 Virtual doc follows
        MIME-Version: 1.0
        Server: CERN/2.17beta
        Date: Tuesday, 05-Apr-94 03:43:46 GMT
        Expires: Tuesday, 05-Apr-94 03:43:46 GMT

Note: There is an empty line after the output to mark the end of the MIME header section; if you don't want this [you want to output some more headers yourself], specify the -noel (NO-Empty-Line) option.

Note also that cgiutils gives automatically the Server: header because it is available in the CGI environment. The Date: field is also automatically generated unless -nodate option is specified.

To get only the expires field don't specify the -status option. If you don't want the empty line after the header line use also the -noel option:

        cgiutils -noel -expires "2 days"
        Expires: Thursday, 07-Apr-94 03:44:02 GMT

httpd@w3.org, July 1995