现在只是一个函数,称为shouldUrlBeSecure
位于app/code/core/Mage/Core/Model/Config.php
上线1477
。
这是完整的功能:
/**
* Check whether given path should be secure according to configuration security requirements for URL
* "Secure" should not be confused with https protocol, it is about web/secure/*_url settings usage only
*
* @param string $url
* @return bool
*/
public function shouldUrlBeSecure($url)
{
if (!Mage::getStoreConfigFlag(Mage_Core_Model_Store::XML_PATH_SECURE_IN_FRONTEND)) {
return false;
}
if (!isset($this->_secureUrlCache[$url])) {
$this->_secureUrlCache[$url] = false;
$secureUrls = $this->getNode('frontend/secure_url');
foreach ($secureUrls->children() as $match) {
if (strpos($url, (string)$match) === 0) {
$this->_secureUrlCache[$url] = true;
break;
}
}
}
return $this->_secureUrlCache[$url];
}
要查看哪些网址应该是安全的,可以Mage::log($secureUrls)
在if
语句中添加一个简单的网址。这是我的日志条目的样子:
2014-02-12T11:55:26+00:00 DEBUG (7): Mage_Core_Model_Config_Element Object
(
[install] => /install/wizard/checkSecureHost
[customer] => /customer/
[sales] => /sales/
[authorizenet_paygate] => /paygate/authorizenet_payment
[checkout_onepage] => /checkout/onepage
[checkout_multishipping] => /checkout/multishipping
[paypal_express] => /paypal/express
[paypal_standard] => /paypal/standard
[paypal_express_callbackshippingoptions] => paypal/express/callbackshippingoptions
[googlecheckout_redirect] => /googlecheckout/redirect/
[googlecheckout_beacon] => /googlecheckout/api/beacon/
[googlecheckout_api] => /googlecheckout/api/
[review_customer] => /review/customer/
[tag_customer] => /tag/customer/
[wishlist] => /wishlist/
[paypaluk_express] => /paypaluk/express
[rss_catalog_review] => /rss/catalog/review
[rss_order_new] => /rss/order/new
[rss_catalog_notifystock] => /rss/catalog/notifystock
[centinel] => /centinel/
[newsletter_manage] => /newsletter/manage/
[downloadable] => /downloadable/customer/
[downloadable_download] => /downloadable/download/
[ogone_api] => /ogone/api
[persistent_onepage_register] => /persistent/index/saveMethod
[checkout_cart] => /checkout/cart
[storecredit_info] => /storecredit/info/
[giftcard_customer] => /giftcard/customer/
[enterprise_pbridge_pbridge] => /enterprise_pbridge/pbridge/
[invitation] => /invitation/
)
现在要弄清楚Magento的切换方式HTTP
,HTTPS
我想您很可能会深入到lib
内部的Zend框架中,lib/Zend/Http/*
因为它包含了最受欢迎的文件。好吧,无论如何希望这会有所帮助。祝好运!