From: Chad Horohoe Date: Tue, 20 Aug 2013 00:29:43 +0000 (-0700) Subject: Add some logging for weird redirected POSTs X-Git-Tag: 1.31.0-rc.0~18933 X-Git-Url: http://git.cyclocoop.org///%22%40url%40//%22?a=commitdiff_plain;h=d95454b44fd560bffd2b480dc60b6d821ca7e6f8;p=lhc%2Fweb%2Fwiklou.git Add some logging for weird redirected POSTs Change-Id: Ib19ebc2306e85fdb8c29b5850f2306bec7907938 --- diff --git a/includes/Wiki.php b/includes/Wiki.php index 6e72b9dcf7..998ec41a2f 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -513,8 +513,20 @@ class MediaWiki { ) && $request->detectProtocol() == 'http' ) { - $redirUrl = $request->getFullRequestURL(); - $redirUrl = str_replace( 'http://', 'https://', $redirUrl ); + $oldUrl = $request->getFullRequestURL(); + $redirUrl = str_replace( 'http://', 'https://', $oldUrl ); + + if ( $request->wasPosted() ) { + // This is weird and we'd hope it almost never happens. This + // means that a POST came in via HTTP and policy requires us + // redirecting to HTTPS. It's likely such a request is going + // to fail due to post data being lost, but let's try anyway + // and just log the instance. + // + // @todo @fixme See if we could issue a 307 or 308 here, need + // to see how clients (automated & browser) behave when we do + wfDebugLog( 'RedirectedPosts', "Redirected from HTTP to HTTPS: $oldUrl" ); + } // Setup dummy Title, otherwise OutputPage::redirect will fail $title = Title::newFromText( NS_MAIN, 'REDIR' );