Tags:
create new tag
view all tags

Bug: TWiki::Func::redirectCgiQuery should never return

The documentation of TWiki::Func::redirectCgiQuery says "never returns", which makes sense, since this function normally acts as some sort of error exit of a plugin.

However, the function does return, and plugin code following this call is executed, which may result in unexpected side effects.

Test case

Environment

TWiki version: TWikiRelease02Sep2004
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Solaris 8
Web server: Apache 1.3.x
Perl version: 5.8.x
Client OS: various
Web Browser: various

-- JChristophFuchs - 13 Apr 2005

Impact and Available Solutions

Follow up

Fix record

In Func.pm, change the body of subroutine redirectCgiQuery from

return &TWiki::redirect( @_ );

to

&TWiki::redirect( @_ );
exit 0;

(Alternatively, state in the documentation of this routine that it does return and the author of a plugin has to exit the script if this appropriate)

Discussion

No; there are circumstances under which it must return - for example, if the redirect is to be printed but then further processing that does not generate output done. The documentation is wrong, it should state that the function returns but that the caller should not print anything else before exiting if an HTTP redirect is required.

-- CrawfordCurrie - 13 Apr 2005

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2005-04-13 - 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-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.