@@ -40,6 +40,7 @@ static public function getFromSocket($socket) {
40
40
}
41
41
switch ($ version ) {
42
42
case '4.0 ' :
43
+ case '4.1 ' :
43
44
return Mage::getModel (
44
45
'turpentine/varnish_configurator_version4 ' ,
45
46
array ('socket ' => $ socket ) );
@@ -110,8 +111,8 @@ public function save($generatedConfig) {
110
111
* @return string
111
112
*/
112
113
protected function _getVclTemplateFilename ($ baseFilename ) {
113
- $ extensionDir = Mage::getModuleDir ('' , 'Nexcessnet_Turpentine ' );
114
- return sprintf ('%s/misc/%s ' , $ extensionDir , $ baseFilename );
114
+ $ extensionDir = Mage::getModuleDir ('' , 'Nexcessnet_Turpentine ' );
115
+ return sprintf ('%s/misc/%s ' , $ extensionDir , $ baseFilename );
115
116
}
116
117
117
118
/**
@@ -130,7 +131,7 @@ protected function _getVclFilename() {
130
131
*
131
132
* @return string
132
133
*/
133
- protected function _getCustomIncludeFilename ($ position= '' ) {
134
+ protected function _getCustomIncludeFilename ($ position = '' ) {
134
135
$ key = 'custom_include_file ' ;
135
136
$ key .= ($ position ) ? '_ ' .$ position : '' ;
136
137
return $ this ->_formatTemplate (
@@ -150,8 +151,7 @@ protected function _getCustomTemplateFilename() {
150
151
Mage::getStoreConfig ('turpentine_varnish/servers/custom_vcl_template ' ),
151
152
array ('root_dir ' => Mage::getBaseDir ())
152
153
);
153
- if (is_file ($ filePath )) { return $ filePath ; }
154
- else { return null ; }
154
+ if (is_file ($ filePath )) { return $ filePath ; } else { return null ; }
155
155
}
156
156
157
157
@@ -192,8 +192,8 @@ protected function _vcl_call($subroutine) {
192
192
*/
193
193
protected function _getAdminFrontname () {
194
194
if (Mage::getStoreConfig ('admin/url/use_custom_path ' )) {
195
- if (Mage::getStoreConfig ('web/url/use_store ' )) {
196
- return Mage::getModel ('core/store ' )->load (0 )->getCode () . "/ " . Mage::getStoreConfig ('admin/url/custom_path ' );
195
+ if (Mage::getStoreConfig ('web/url/use_store ' )) {
196
+ return Mage::getModel ('core/store ' )->load (0 )->getCode (). "/ " . Mage::getStoreConfig ('admin/url/custom_path ' );
197
197
} else {
198
198
return Mage::getStoreConfig ('admin/url/custom_path ' );
199
199
}
@@ -868,6 +868,7 @@ protected function _vcl_sub_maintenance_allowed_ips() {
868
868
869
869
switch (Mage::getStoreConfig ('turpentine_varnish/servers/version ' )) {
870
870
case 4.0 :
871
+ case 4.1 :
871
872
$ tpl = <<<EOS
872
873
if (req.http.X-Forwarded-For) {
873
874
if (req.http.X-Forwarded-For !~ "{{debug_ips}}") {
@@ -907,11 +908,12 @@ protected function _vcl_sub_maintenance_allowed_ips() {
907
908
*/
908
909
protected function _vcl_sub_https_redirect_fix () {
909
910
$ baseUrl = Mage::getBaseUrl (Mage_Core_Model_Store::URL_TYPE_WEB );
910
- $ baseUrl = str_replace (array ('http:// ' ,'https:// ' ), '' , $ baseUrl );
911
- $ baseUrl = rtrim ($ baseUrl ,'/ ' );
911
+ $ baseUrl = str_replace (array ('http:// ' , 'https:// ' ), '' , $ baseUrl );
912
+ $ baseUrl = rtrim ($ baseUrl , '/ ' );
912
913
913
914
switch (Mage::getStoreConfig ('turpentine_varnish/servers/version ' )) {
914
915
case 4.0 :
916
+ case 4.1 :
915
917
$ tpl = <<<EOS
916
918
if ( (req.http.host ~ "^(?i)www. $ baseUrl" || req.http.host ~ "^(?i) $ baseUrl") && req.http.X-Forwarded-Proto !~ "(?i)https") {
917
919
return (synth(750, ""));
@@ -942,6 +944,7 @@ protected function _vcl_sub_synth()
942
944
943
945
switch (Mage::getStoreConfig ('turpentine_varnish/servers/version ' )) {
944
946
case 4.0 :
947
+ case 4.1 :
945
948
$ tpl = <<<EOS
946
949
sub vcl_synth {
947
950
if (resp.status == 999) {
@@ -978,7 +981,7 @@ protected function _vcl_sub_synth_https_fix()
978
981
{
979
982
$ tpl = $ this ->_vcl_sub_synth ();
980
983
981
- if (! $ tpl ){
984
+ if ( ! $ tpl ) {
982
985
$ tpl = <<<EOS
983
986
sub vcl_synth {
984
987
if (resp.status == 750) {
@@ -988,7 +991,7 @@ protected function _vcl_sub_synth_https_fix()
988
991
}
989
992
}
990
993
EOS ;
991
- }else {
994
+ } else {
992
995
$ tpl_750 = '
993
996
sub vcl_synth {
994
997
if (resp.status == 750) {
@@ -1085,12 +1088,12 @@ protected function _getTemplateVars() {
1085
1088
1086
1089
if (Mage::getStoreConfig ('turpentine_varnish/general/https_redirect_fix ' )) {
1087
1090
$ vars ['https_redirect ' ] = $ this ->_vcl_sub_https_redirect_fix ();
1088
- if (Mage::getStoreConfig ('turpentine_varnish/servers/version ' ) == '4.0 ' ) {
1091
+ if (Mage::getStoreConfig ('turpentine_varnish/servers/version ' ) == '4.0 ' || Mage:: getStoreConfig ( ' turpentine_varnish/servers/version ' ) == ' 4.1 ' ) {
1089
1092
$ vars ['vcl_synth ' ] = $ this ->_vcl_sub_synth_https_fix ();
1090
1093
}
1091
1094
}
1092
1095
1093
- foreach (array ('' ,'top ' ) as $ position ) {
1096
+ foreach (array ('' , 'top ' ) as $ position ) {
1094
1097
$ customIncludeFile = $ this ->_getCustomIncludeFilename ($ position );
1095
1098
if (is_readable ($ customIncludeFile )) {
1096
1099
$ key = 'custom_vcl_include ' ;
0 commit comments