Cairo provides the
writeHeaderHandler for plugins to add fields to the HTTP header.
Unfortunately this method is rather poorly defined. It is a only-once handler, which means that only one plugin can implement it. It also stops the plugin from changing the headers defined by the core, which is very inflexible.
I propose to deprecate the
writeHeaderHandler and replace with a
modifyHeaderHandler, specified as follows:
modifyHeaderHandler( \@headers, $query )
-
\@headers - reference to an array of existing header-value pairs
-
$query - reference to CGI query object
Lets the plugin modify the HTTP headers that will be emitted when an
HTML page is written to the browser. The
\@headers array will contain
the headers proposed by the core, plus any modifications made by other plugins that also implement this method that come earlier in the plugins
list. You can add key-value pairs to the array simply by pushing them on; for example:
push( @$headers, expires => '+1h' );
--
CrawfordCurrie - 30 Mar 2005
Sensible enhancement. Please deprecate
writeHeaderHandler but do not remove, or existing Plugins might break.
--
PeterThoeny - 11 Apr 2005
Changed to a more natural interface:
modifyHeaderHandler( \%headers, $query )
-
\%headers - reference to a hash of existing header values
-
$query - reference to CGI query object
Lets the plugin modify the HTTP headers that will be emitted when an
HTML
page is written to the browser. \%headers= will contain the headers
proposed by the core, plus any modifications made by other plugins that also
implement this method that come earlier in the plugins list.
$headers->{expires} = '+1h';
SVN 4300
--
CrawfordCurrie - 22 May 2005