ZF-11519: Zend_Dojo doesn't take into account https with the CDN

Description

Zend_Dojo only contains the http url for the Google CDN, If someone wanted to use a https connection for their application they will receive the "unsecure elements" message in the browser while using the CDN.

ZendX_JQuery has implemented a mechanism for switching to the https connection on the Google CDN There should be comparable functionality available in Zend_Dojo.

Comments

Will work on this over the weekend.

I noticed that AOL doesn't have an SSL version of the CDN, so I'll implement it for Google only.

Patch + tests attached.

Reassigning to Matthew to review the patch and tests.

I've reviewed the patch and confirm it operates as intended. Recommend committing to trunk and merging to release branch.

Please don't commit to trunk. The patch works, but it only loads the dojo.js file over SSL. It then xhrloads the rest of default modulepaths (/dojo, /dijit & /dojox) and any additional module-namespaces over non SSL connection. This could be fixed by including the right paths through registerModulePath() but it wouldn't solve the main problem.

SSL should always work. ATM it also doesn't work when Dojo's hosted locally, which should be first priority. Also Google and AOL both support SSL for their CDN's (only AOL's unsigned). There's also a new CDN for Dojo (Yandex) which supports signed SSL, so SSL should work for any CDN. Fixing this problem by hardcoding the scheme into the class is not the way to go. There would need to be some kind of scheme detection, either through inspecting $_SERVER['HTTPS'] or $request->isSecure(). A correct fix opens up a whole can of worms, some of which i've already addressed but i needed to break BC and can in the light of ZF2.

Reworked my solution intented for ZF2 to not break ZF1. Setting of scheme is now applies to all dojo assets: base, source, layer, module and stylesheetpaths. Setting of scheme is per default based on $_SERVER['HTTPS'] but can be forced through setting resources.dojo.secure = true/false or api setSecure(true/false). Added tests to confirm behaviour. Please comment and/or review.

Reformatted and applied Paul's patches ({{ZF-11519-combined.patch}}). The Dojo suite ran (after adding it to Zend_AllTests) without any issues related to the dojo view helper itself, though I did get three failures in other view helpers due to encoding of attribute values (see ZF-11875).