From: Roan Kattouw Date: Fri, 24 Apr 2009 19:50:50 +0000 (+0000) Subject: API: (bug 13049) This'll hopefully fix the 403 Forbidden error in api.php for the... X-Git-Tag: 1.31.0-rc.0~42038 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=13d180553d128193c6fbfeac1ff92c2695676316;p=lhc%2Fweb%2Fwiklou.git API: (bug 13049) This'll hopefully fix the 403 Forbidden error in api.php for the setups that were getting them (most notably FastCGI and IIS). Patch by Chris Wrinn --- diff --git a/CREDITS b/CREDITS index 71066b5af9..f43ecca865 100644 --- a/CREDITS +++ b/CREDITS @@ -61,6 +61,7 @@ following names for their contribution to the product. * Brent G * Brianna Laugher * Carlin +* Chris Wrinn * church of emacs * Daniel Arnold * Danny B. diff --git a/RELEASE-NOTES b/RELEASE-NOTES index a37d1f5721..16e1410deb 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -425,6 +425,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 18546) Added timestamp of new revision to action=edit output * (bug 18554) Also list hidden revisions in list=usercontribs for privileged users +* (bug 13049) "API must be accessed from the primary script entry point" error === Languages updated in 1.15 === diff --git a/api.php b/api.php index eb223994d0..546969f23f 100644 --- a/api.php +++ b/api.php @@ -51,10 +51,10 @@ wfProfileIn('api.php'); // // Ensure that all access is through the canonical entry point... // -if( isset( $_SERVER['SCRIPT_URL'] ) ) { - $url = $_SERVER['SCRIPT_URL']; +if( isset( $_SERVER['SCRIPT_NAME'] ) ) { + $url = $_SERVER['SCRIPT_NAME']; } else { - $url = $_SERVER['PHP_SELF']; + $url = $_SERVER['URL']; } if( strcmp( "$wgScriptPath/api$wgScriptExtension", $url ) ) { wfHttpError( 403, 'Forbidden',