Merge "(bug 44921) API should properly handle OPTIONS"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 26 Feb 2013 21:34:35 +0000 (21:34 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 26 Feb 2013 21:34:35 +0000 (21:34 +0000)
RELEASE-NOTES-1.21
includes/api/ApiMain.php

index c941089..3737932 100644 (file)
@@ -241,6 +241,8 @@ production.
   particular page property.
 * Added an API query module list=pagepropnames, which lists all page prop names
   currently in use on the wiki.
+* (bug 44921) ApiMain::execute() will now return after the CORS check for an
+  HTTP OPTIONS request.
 
 === API internal changes in 1.21 ===
 * For debugging only, a new global $wgDebugAPI removes many API restrictions when true.
index c3ae8b1..1dabbbf 100644 (file)
@@ -364,6 +364,12 @@ class ApiMain extends ApiBase {
                        return;
                }
 
+               // Exit here if the request method was OPTIONS
+               // (assume there will be a followup GET or POST)
+               if ( $this->getRequest()->getMethod() === 'OPTIONS' ) {
+                       return;
+               }
+
                // In case an error occurs during data output,
                // clear the output buffer and print just the error information
                ob_start();