Tags:
create new tag
, view all tags
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

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2005-05-22 - CrawfordCurrie
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.