ZF-6078: Auto-switch http/https scheme for Google Ajax Libraries URLs
Description
Hello,
It would be nice if depending on whether current page was requested via secured connection or unsecured, the helpers would return secured/unsecured URLs appropriately. Why this is important:
Suppose I have a secured page https://domain.com/test All images/asset files are served via HTTPS. However, the helpers output:
Causing some browsers to show security dialogs that not all content is secured.
Comments
Posted by Benjamin Eberlei (beberlei) on 2009-03-21T02:45:19.000+0000
very good request, i wasn't thinking about this issue. I'll implement it.
Posted by Daniel Kraaij (daank) on 2009-03-26T01:39:00.000+0000
I made the following addition to my ZendX library.
added line: 37 const CDN_BASE_GOOGLE_HTTPS = 'https://ajax.googleapis.com/ajax/libs/jquery/';
removed line: 727 $source = ZendX_JQuery::CDN_BASE_GOOGLE . $this->getCdnVersion() . ZendX_JQuery::CDN_JQUERY_PATH_GOOGLE;
added line: 727 if ($this->_isSSL()) { $source = ZendX_JQuery::CDN_BASE_GOOGLE_HTTPS . $this->getCdnVersion() . ZendX_JQuery::CDN_JQUERY_PATH_GOOGLE; } else { $source = ZendX_JQuery::CDN_BASE_GOOGLE_HTTP . $this->getCdnVersion() . ZendX_JQuery::CDN_JQUERY_PATH_GOOGLE; }
added line: 739 /** * Check if the current connection is SSL or not. * * @return boolean / protected function _isSSL() { if($_SERVER['https'] == 1) / Apache / { return TRUE; } elseif ($_SERVER['https'] == 'on') / IIS / { return TRUE; } elseif ($_SERVER['SERVER_PORT'] == 443) / others / { return TRUE; } else { return FALSE; / just using http */ } }
Posted by Daniel Kraaij (daank) on 2009-03-26T01:41:22.000+0000
i've added the changes in a text file since formating is a bit off here :-/
Posted by Danila V. (dvershinin) on 2009-03-26T02:02:36.000+0000
Actually, I was thinking about an easier way, similar to:
thus no need for a _isSSL();
Posted by Benjamin Eberlei (beberlei) on 2009-04-20T14:15:35.000+0000
fixed by adding boolean flag function on the jQuery Container to handle SSL or not SSL.