Ticket #8226: 8226.2.diff

File 8226.2.diff, 1.0 KB (added by ryan, 4 years ago)

Unified patch plus explanatory comment

Line 
1Index: wp-app.php
2===================================================================
3--- wp-app.php  (revision 9816)
4+++ wp-app.php  (working copy)
5@@ -1392,7 +1392,7 @@
6                nocache_headers();
7                header('WWW-Authenticate: Basic realm="WordPress Atom Protocol"');
8                header("HTTP/1.1 401 $msg");
9-               header('Status: ' . $msg);
10+               header('Status: 401 ' . $msg);
11                header('Content-Type: text/html');
12                $content = <<<EOD
13 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
14@@ -1469,6 +1469,11 @@
15                if(isset($_SERVER['HTTP_AUTHORIZATION'])) {
16                        list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) =
17                                explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
18+               } else if (isset($_SERVER['REDIRECT_REMOTE_USER'])) {
19+                       // Workaround for setups that do not forward HTTP_AUTHORIZATION
20+                       // See http://trac.wordpress.org/ticket/7361
21+                       list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) =
22+                               explode(':', base64_decode(substr($_SERVER['REDIRECT_REMOTE_USER'], 6)));
23                }
24 
25                // If Basic Auth is working...