From 1abb019e250b619da9a2e1954c860251d24711d4 Mon Sep 17 00:00:00 2001 From: Ryan Lane Date: Thu, 21 Feb 2013 14:45:57 -0800 Subject: [PATCH] Give a 200 response for valid user pages Rather than sending a 404 on empty user pages, send a 200 response. It's ideal to use the user's page as an OpenID identity url, but OpenID expects 200 responses on identity urls. If we send 404s on empty user pages it's necessary for all users to have content on their pages to use Wikimedia as a provider. This change eliminates that requirement. Fixes: bug 45241 Change-Id: I527aa9d9c19c5cef7bebde78ef22f426bcbb3cd6 --- includes/Article.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/Article.php b/includes/Article.php index 1dc27a7221..ed9c305d4b 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1089,6 +1089,7 @@ class Article implements Page { public function showMissingArticle() { global $wgSend404Code; $outputPage = $this->getContext()->getOutput(); + $validUserPage = false; # Show info in user (talk) namespace. Does the user exist? Is he blocked? if ( $this->getTitle()->getNamespace() == NS_USER || $this->getTitle()->getNamespace() == NS_USER_TALK ) { @@ -1115,6 +1116,9 @@ class Article implements Page { ) ) ); + $validUserPage = true; + } else { + $validUserPage = true; } } @@ -1128,7 +1132,7 @@ class Article implements Page { 'msgKey' => array( 'moveddeleted-notice' ) ) ); - if ( !$this->mPage->hasViewableContent() && $wgSend404Code ) { + if ( !$this->mPage->hasViewableContent() && $wgSend404Code && !$validUserPage ) { // If there's no backing content, send a 404 Not Found // for better machine handling of broken links. $this->getContext()->getRequest()->response()->header( "HTTP/1.1 404 Not Found" ); -- 2.20.1