Bug: Multiple Content-Type Headers output by TWiki
All pages return a duplicate
Content-Type header. Browsers intermittently display header information, which is mildly irritating but not a showstopper. (Still worthy of a bug report though.) However, feedreaders trying to grab RSS will get stopped in their tracks since the resulting document won't parse.
Test case
GET -e http://openinteract.sourceforge.net/cgi-bin/twiki/view/ produces:
Connection: close
Date: Wed, 22 Jan 2003 21:10:18 GMT
Server: Apache/1.3.26 (Unix) PHP/4.1.2
Content-Type: text/html
Client-Date: Wed, 22 Jan 2003 21:24:58 GMT
Client-Peer: 66.35.250.209:80
Client-Response-Num: 1
Client-Transfer-Encoding: chunked
Set-Cookie: twikisession=1043269819-369606; path=/cgi-bin/twiki/view
Content-Type: text/html; charset=ISO-8859-1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ....
The last
Content-Type:... line is the culprit.
I do not think this is a server/configuration problem because
GET -e http://openinteract.sourceforge.net/cgi-bin/twiki/echo produces:
Connection: close
Date: Wed, 22 Jan 2003 21:18:23 GMT
Server: Apache/1.3.26 (Unix) PHP/4.1.2
Content-Type: text/plain
Client-Date: Wed, 22 Jan 2003 21:33:00 GMT
Client-Peer: 66.35.250.209:80
Client-Response-Num: 1
Client-Transfer-Encoding: chunked
And your headers are...
echo is a simple Perl script to dump the environment, using
CGI.pm to ensure it's not a library problem:
#!/usr/bin/perl
use strict;
use CGI;
my $q = new CGI;
print $q->header( -content_type => 'text/plain' );
print "And your headers are...\n";
while ( my ( $key, $value ) = each %ENV ) {
print "$key = $value\n";
}
print "All done!\n";
Environment
| TWiki version: |
20021230 |
| TWiki plugins: |
DefaultPlugin, GaugePlugin, GnuSkinPlugin, InterwikiPlugin, PerlDocPlugin, SessionPlugin, TigerSkinPlugin, TreePlugin (GnuSkin is active) |
| Server OS: |
Linux 2.4.18 |
| Web server: |
Apache 1.3.26 |
| Perl version: |
5.6.1 |
| Client OS: |
Linux 2.4.19 |
| Web Browser: |
Mozilla, IE, command-line fetch |
--
ChrisWinters - 22 Jan 2003
Follow up
Thanks for providing a very clear bug report with all the details needed!
This is a bug in
SessionPlugin, I believe - it needs updating to use the
BeijingRelease plugin API. Plugins should not print any headers directly, but instead should just use the API so that the core can generate mandatory headers - this is required by the fix for
BackFromPreviewLosesText. I put a patch to fix this problem on
SessionPluginDev some time ago (the 'fix for plugin API' patch), but it may not have been applied to the core code. This plugin should note the Plugin API version and use the appropriate header API if appropriate - see
writeHeaderHandler in
MorePluginHooks.
It would also be useful IMO to turn off most or all plugins when generating RSS feeds - this is something that has come up already.
--
RichardDonkin - 23 Jan 2003
Applying the patch did the trick -- thanks!
--
ChrisWinters - 23 Jan 2003
Fix record