perl-asp mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Chamas <>
Subject Re: Can't add an `Expires' header manually in new versions
Date Fri, 15 Feb 2002 23:05:39 GMT
ivan wrote:
> In Apache::ASP 2.30,
>   $Response->AddHeader('Expires' => 0);
> triggers this fatal error:
>   Response->ExpiresAbsolute(): date format 0 not accepted at /usr/local/lib/perl5/site_perl/5.6.1/Apache/
line 3946

The latest Apache::ASP release code makes the $Response->AddHeader() 
code go through the ExpiresAbsolute API for the Expires header.
This is good in that people setting ExpiresAbsolute as a
member & as a header won't create duplicate headers as
was the point of the fix.

> This worked in Apache::ASP 2.07.
> How do I manually set the Expires header with new versions?  Since this is
> for a publicly distributed application, I'm interested in supporting old
> versions too, when possible.

In your case I think this caught a bug in your program, and
would call this good behavior of the application.  The Expires
header is supposed to be an HTTP date header of a very particular
format, not 0 which is likely an illegal value ( not sure but probably ).
This format is:

  Wed, 09 Feb 1994 22:23:32 GMT

which is what one would expect being passed to 

  $Response->AddHeader('Expires', $value);
    or with direct API
  $Response->{ExpiresAbsolute} = $value;

What you probably should use for what you want is 

  $Response->{Expires} = 0;

which will convert 0 to the HTTP date formatted for the 
currect system time.  Note that because this expiration
is web client driven, and because client system clocks may
be set incorrectly, you should probably set 0 to be a large
negative number like:

  $Response->{Expires} = 86400 * -400;  # expires 400 days ago

This will let the page to expire immediately for even clock set
to a year behind!! ( probably a more frequent occurance that one might think )


Joshua Chamas                           Chamas Enterprises Inc.
NodeWorks Founder                       Huntington Beach, CA  USA                1-714-625-4051

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message