Skip to content

Instantly share code, notes, and snippets.

@halk
Created October 10, 2013 12:40
Show Gist options
  • Save halk/6917675 to your computer and use it in GitHub Desktop.
Save halk/6917675 to your computer and use it in GitHub Desktop.
Fix candidate for Magento core bug: Magento API does not work with HTTP Basic Auth in combination with https backend
diff --git a/public/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php b/public/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php
index aca1f93..0212822 100644
--- a/public/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php
+++ b/public/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php
@@ -206,7 +206,7 @@ class Mage_Api_Model_Server_Adapter_Soap
$phpAuthPw = $this->getController()->getRequest()->getServer('PHP_AUTH_PW', false);
if ($phpAuthUser && $phpAuthPw) {
- $wsdlUrl = sprintf("http://%s:%s@%s", $phpAuthUser, $phpAuthPw, str_replace('http://', '', $wsdlUrl ) );
+ $wsdlUrl = sprintf("http://%s:%s@%s", $phpAuthUser, $phpAuthPw, str_replace(array('http://', 'https://'), '', $wsdlUrl ) );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment