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
cgiutils -version
-nodate
Date:
header.
-noel
-status
nnn
-reason
explanation
-status
nnn options.
-ct
type/subtype
-ce
encoding
x-compress
,
x-gzip
].
-dl
language-code
-length
nnn
-expires
time-spec
"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
-uri
URI
-extra
xxx: yyy
cgiutils
.
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 GMTThere 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