File tree Expand file tree Collapse file tree 4 files changed +28
-2
lines changed
app/code/Magento/Customer
view/frontend/templates/js
lib/internal/Magento/Framework/Url Expand file tree Collapse file tree 4 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -18,4 +18,15 @@ public function getCookieLifeTime()
18
18
\Magento \Store \Model \ScopeInterface::SCOPE_STORE
19
19
);
20
20
}
21
+
22
+ /**
23
+ * Get url for customer data ajax requests. Returns url with protocol matching used to request page.
24
+ *
25
+ * @param $route
26
+ * @return string
27
+ */
28
+ public function getCustomerDataUrl ($ route )
29
+ {
30
+ return $ this ->getUrl ($ route , ['_secure ' => $ this ->getRequest ()->isSecure ()]);
31
+ }
21
32
}
Original file line number Diff line number Diff line change 11
11
<argument name =" secureUrlList" xsi : type =" array" >
12
12
<item name =" customer" xsi : type =" string" >/customer/</item >
13
13
</argument >
14
+ <argument name =" excludedUrlList" xsi : type =" array" >
15
+ <item name =" customer_sections" xsi : type =" string" >/customer/section/load</item >
16
+ </argument >
14
17
</arguments >
15
18
</type >
16
19
<type name =" Magento\Framework\View\Layout" >
Original file line number Diff line number Diff line change 11
11
<?php
12
12
echo $ this ->helper ('Magento\Framework\Json\Helper\Data ' )->jsonEncode ([
13
13
'* ' => ['Magento_Customer/js/customer-data ' => [
14
- 'sectionLoadUrl ' => $ block ->getUrl ('customer/section/load ' ),
14
+ 'sectionLoadUrl ' => $ block ->getCustomerDataUrl ('customer/section/load ' ),
15
15
'cookieLifeTime ' => $ block ->getCookieLifeTime (),
16
16
]],
17
17
]);
Original file line number Diff line number Diff line change @@ -16,6 +16,11 @@ class SecurityInfo implements \Magento\Framework\Url\SecurityInfoInterface
16
16
*/
17
17
protected $ secureUrlsList = [];
18
18
19
+ /**
20
+ * List of patterns excluded form secure url list
21
+ */
22
+ protected $ excludedUrlsList = [];
23
+
19
24
/**
20
25
* List of already checked urls
21
26
*
@@ -25,10 +30,12 @@ class SecurityInfo implements \Magento\Framework\Url\SecurityInfoInterface
25
30
26
31
/**
27
32
* @param string[] $secureUrlList
33
+ * @param string[] $excludedUrlList
28
34
*/
29
- public function __construct ($ secureUrlList = [])
35
+ public function __construct ($ secureUrlList = [], $ excludedUrlList = [] )
30
36
{
31
37
$ this ->secureUrlsList = $ secureUrlList ;
38
+ $ this ->excludedUrlsList = $ excludedUrlList ;
32
39
}
33
40
34
41
/**
@@ -41,6 +48,11 @@ public function isSecure($url)
41
48
{
42
49
if (!isset ($ this ->secureUrlsCache [$ url ])) {
43
50
$ this ->secureUrlsCache [$ url ] = false ;
51
+ foreach ($ this ->excludedUrlsList as $ match ) {
52
+ if (strpos ($ url , (string )$ match ) === 0 ) {
53
+ return $ this ->secureUrlsCache [$ url ];
54
+ }
55
+ }
44
56
foreach ($ this ->secureUrlsList as $ match ) {
45
57
if (strpos ($ url , (string )$ match ) === 0 ) {
46
58
$ this ->secureUrlsCache [$ url ] = true ;
You can’t perform that action at this time.
0 commit comments