Issues

ZF-6078: Auto-switch http/https scheme for Google Ajax Libraries URLs

Issue Type: Improvement Created: 2009-03-21T02:24:57.000+0000 Last Updated: 2009-04-20T14:15:36.000+0000 Status: Resolved Fix version(s): - 1.8.0 (30/Apr/09)

Reporter: Danila V. (dvershinin) Assignee: Benjamin Eberlei (beberlei) Tags: - ZendX_JQuery

Related issues: Attachments: - changes.txt

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.

ZendX\Jquery.php removed line: 37 const CDN_BASE_GOOGLE = 'http://ajax.googleapis.com/ajax/libs/jquery/';

added line: 37 const CDN_BASE_GOOGLE_HTTPS = 'https://ajax.googleapis.com/ajax/libs/jquery/';

const CDN_BASE_GOOGLE_HTTP = '<a rel="nofollow" href="http://ajax.googleapis.com/ajax/libs/jquery/">http://ajax.googleapis.com/ajax/libs/jquery/</a>';

ZendX\JQuery\View\Helper\Jquery\Container.php

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:

<pre class="highlight">
const CDN_BASE_GOOGLE = 'ajax.googleapis.com/ajax/libs/jquery/';
Zend_Controller_Front::getInstance()->getRequest()->getScheme();
//...
$source = Zend_Controller_Front::getInstance()->getRequest()->getScheme() . '://' . ZendX_JQuery::CDN_BASE_GOOGLE . $this->getCdnVersion() . ...

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.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts