Last modified: 2012-04-16 09:15:51 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T30214, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 28214 - When page not found, sends malformed HTTP/1.x instead of HTTP/1.1 in header of response
When page not found, sends malformed HTTP/1.x instead of HTTP/1.1 in header o...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
All All
: Normal trivial (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-03-24 03:15 UTC by Scott Mcintyre
Modified: 2012-04-16 09:15 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Scott Mcintyre 2011-03-24 03:15:42 UTC
When using suPHP and visiting a non existent entry it generates a malformed header error because its defining HTTP/1.x

The exact error is,


 malformed header from script. Bad header=HTTP/1.x 404 Not Found: index.php

The offending line is

includes/Article.php

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

This should be

$wgRequest->response()->header( "HTTP/1.1 404 Not Found" );

The same also applies to 

includes/WebStart.php

Which has the same problem when defining an 500, Internal Server Error.

Here is the diff to fix the problem,


diff -Naur mediawiki-1.16.2-original/includes/Article.php mediawiki-1.16.2/includes/Article.php
--- mediawiki-1.16.2-original/includes/Article.php	2011-01-04 06:15:54.000000000 +0000
+++ mediawiki-1.16.2/includes/Article.php	2011-03-24 03:11:42.000000000 +0000
@@ -1278,7 +1278,7 @@
 		if ( !$this->hasViewableContent() ) {
 			// If there's no backing content, send a 404 Not Found
 			// for better machine handling of broken links.
-			$wgRequest->response()->header( "HTTP/1.x 404 Not Found" );
+			$wgRequest->response()->header( "HTTP/1.1 404 Not Found" );
 		}
 		$wgOut->addWikiText( $text );
 	}
diff -Naur mediawiki-1.16.2-original/includes/WebStart.php mediawiki-1.16.2/includes/WebStart.php
--- mediawiki-1.16.2-original/includes/WebStart.php	2009-05-07 19:30:26.000000000 +0100
+++ mediawiki-1.16.2/includes/WebStart.php	2011-03-24 03:11:50.000000000 +0000
@@ -30,7 +30,7 @@
 	);
 	foreach ( $_REQUEST as $name => $value ) {
 		if( in_array( $name, $verboten ) ) {
-			header( "HTTP/1.x 500 Internal Server Error" );
+			header( "HTTP/1.1 500 Internal Server Error" );
 			echo "register_globals security paranoia: trying to overwrite superglobals, aborting.";
 			die( -1 );
 		}
Comment 1 Bawolff (Brian Wolff) 2011-03-24 04:39:55 UTC
I always thought the x got magically replaced with the relevant version number.
Comment 2 Scott Mcintyre 2011-03-24 04:42:06 UTC
I have never seen it defined as 1.x,  looking at other parts of the system it also defines 1.1.  Those 2 locations seem to be the only ones which define as 1.x
Comment 3 Platonides 2011-03-25 16:41:41 UTC
Fixed in r84729

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links