[Mediawiki-l] Can't create new pages

Tim Starling tstarling at wikimedia.org
Thu Feb 3 03:17:01 UTC 2011


On 03/02/11 09:39, Ashar Voultoiz wrote:
> For some reason, the edit link returns pure HTML but mark it as encoded 
> with gzip. This confuse the browser which is expecting gzipped content. 
> I reproduce it in both Safari and Firefox. IE might be able to guess it.
> 
> $ curl -I -H 'Accept-Encoding: gzip' 
> 'http://www.incrediblemusicmachine.se/index.php?title=FOOBAR'
> HTTP/1.1 404 Not Found
> Date: Wed, 02 Feb 2011 22:32:55 GMT
> Server: Apache/1.3.37 (Unix) mod_gzip/1.3.26.1a mod_fastcgi/FSDATA-1.1 
> mod_jk/1.1.0 Embperl/2.0b8 mod_perl/1.29 PHP/4.4.3 mod_ssl/2.8.28 
> OpenSSL/0.9.8b
> X-Powered-By: PHP/5.2.14
> Content-language: en
> Vary: Accept-Encoding,Cookie
> Expires: Thu, 01 Jan 1970 00:00:00 GMT
> Cache-Control: private, must-revalidate, max-age=0
> Content-Encoding: gzip
> X-Powered-By: PHP/4.4.3
> Content-Type: text/html
> 
> I have noticed a strange character at the top of the output:
> 
> curl -H 'Accept-Encoding: gzip' 
> 'http://www.incrediblemusicmachine.se/index.php?title=FOOBAR' | hexdump -C
> 00000000  0a 3c 21 44 4f 43 54 59  50 45 20 68 74 6d |.<!DOCTYPE htm|
>            ^^^^^
> 
> Not really helpful, but at least it gives the cause.

That's a line break. It's not really that strange, you're allowed to
have line breaks at the top of HTML documents.

The strange thing is the rest of the body. The body of the MediaWiki
response has been removed and replaced with an advertisement for
fsdata.se, masquerading as an error page. Instead of removing the
headers from MediaWiki, it has appended to them, so for instance there
are two X-Powered-By headers. The replacement was presumably triggered
by the 404 error code which MediaWiki gives in this case.

The solution is to switch to a hosting provider that doesn't mangle
your output. Or failing that, comment out the 404 header in MediaWiki.
It's somewhere around line 1281 in includes/Article.php. You want to
change this:

$wgRequest->response()->header( "HTTP/1.x 404 Not Found" );

To this:

// LOCAL PATCH
// Removed because it breaks on fsdata.se
// $wgRequest->response()->header( "HTTP/1.x 404 Not Found" );

Gustaf Josefsson wrote:
> I don't have the option of changing php.ini, but i'm able to override through .htaccess
> I added this to .htaccess:
> php_flag display_errors off
> 
> With no change :(

Yeah, sorry for not doing a full analysis the first time around.

-- Tim Starling




More information about the MediaWiki-l mailing list