? ? Success

User tests: Successful: Unsuccessful:

avatar matrikular
matrikular
12 May 2016

Summary of Changes

This PR changes the api scheme / protocol for the geocodeAddress call to https instead of http. Currently the JGoogleEmbedMaps::geocodeAddress() api call uses http.

Though, e.g. if you call the api url directly, google redirects you to https, an exception will be returned from google when using the api together with an api key without using https.

object(JHttpResponse)[1247]
public 'code' => int 200
public 'headers' =>
array (size=12)
'Content-Type' => string 'application/json; charset=UTF-8' (length=31)
'Date' => string 'Thu, 12 May 2016 10:18:22 GMT' (length=29)
'Pragma' => string 'no-cache' (length=8)
'Expires' => string 'Fri, 01 Jan 1990 00:00:00 GMT' (length=29)
'Cache-Control' => string 'no-cache, must-revalidate' (length=25)
'Access-Control-Allow-Origin' => string '*' (length=1)
'Server' => string 'mafe' (length=4)
'X-XSS-Protection' => string '1; mode=block' (length=13)
'X-Frame-Options' => string 'SAMEORIGIN' (length=10)
'Accept-Ranges' => string 'none' (length=4)
'Vary' => string 'Accept-Language,Accept-Encoding' (length=31)
'Transfer-Encoding' => string 'chunked' (length=7)
public 'body' => string '{
"error_message" : "Requests to this API must be over SSL. Load the API with "https://" instead of "http://".",
"results" : [],
"status" : "REQUEST_DENIED"
}
' (length=172)

Speaking of the api key; The google library allows you to set an api key that will be used in the javascript rendering part but not in the geocodeAddress() method. This PR also adds a key to the request if present so that you won't run into your quota limit any time soon.

Testing Instructions

Download and install the test modul I attached to this PR. Enable the module, assign it to e.g. the position-3 of the protostar template. Don't forget to set the module to show on all pages.

Depending on the settings (key, address) you've made, you will see a debug message with information about the last request. Now, there aren't really that much visible errors to indicate something not working correctly. The debug message in the module only show that the request works as before.

You can provoke the exception mentioned above by applying the patch and changing the https back to http on line 785 in /libraries/joomla/google/embed/maps.php. Given you've provided an api key you would see a message similar to this one:
api_key_exception

Attachment

mod_geocodepr.zip

avatar matrikular matrikular - open - 12 May 2016
avatar matrikular matrikular - change - 12 May 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 12 May 2016
Labels Added: ?
avatar matrikular matrikular - change - 12 May 2016
The description was changed
avatar matrikular matrikular - change - 12 May 2016
Title
Change api scheme for the maps api call to https and include an api key if one was set
Change scheme for the google maps api call to https and include an api key if one was set
avatar matrikular matrikular - change - 12 May 2016
Title
Change api scheme for the maps api call to https and include an api key if one was set
Change scheme for the google maps api call to https and include an api key if one was set
avatar brianteeman brianteeman - change - 12 May 2016
Category Libraries
avatar brianteeman
brianteeman - comment - 12 May 2016

@mbabker is this a PR that should be made to the framework as well / instead ?


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10439.

avatar joomla-cms-bot joomla-cms-bot - change - 12 May 2016
Labels Added: ?
avatar kolvar
kolvar - comment - 13 May 2016

Works as described. Fixes a problem I have had. Thanx for the patch.

avatar bembelimen bembelimen - test_item - 13 May 2016 - Tested successfully
avatar bembelimen
bembelimen - comment - 13 May 2016

I have tested this item :white_check_mark: successfully on fd2305c


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10439.

avatar brianteeman brianteeman - alter_testresult - 13 May 2016 - kolvar: Tested successfully
avatar brianteeman brianteeman - change - 13 May 2016
Status Pending Ready to Commit
Labels
avatar brianteeman
brianteeman - comment - 13 May 2016

MERGER - I am setting this RTC but not sure if should be merged here or in the upstream package?


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10439.

avatar joomla-cms-bot joomla-cms-bot - change - 13 May 2016
Labels Added: ?
avatar brianteeman brianteeman - change - 13 May 2016
Milestone Added:
avatar mbabker
mbabker - comment - 13 May 2016

Yes it needs to be merged here because the CMS isn't using any of the HTTP adapter code (which includes all of the API packages) from the Framework.

avatar brianteeman
brianteeman - comment - 13 May 2016

Thanks for confirming @mbabker

avatar andrepereiradasilva
andrepereiradasilva - comment - 13 May 2016

IMHO it would be a good practice to make this change also in the joomla framework repository
https://github.com/joomla-framework/google-api/blob/master/src/Embed/Maps.php#L685

avatar mbabker
mbabker - comment - 13 May 2016

Should be fixed there, yes. But since it's not a Composer pulled library here, it should be merged here and dealt with on the FW separately.

avatar andrepereiradasilva
andrepereiradasilva - comment - 13 May 2016

@mbabker yes of course. This is RTC and can be merged.
The framework PR is another thing.

@matrikular can you do a PR also in the framework repository?
https://github.com/joomla-framework/google-api/blob/master/src/Embed/Maps.php#L685

avatar matrikular
matrikular - comment - 13 May 2016

Not sure if it has got the correct format, but - of course - here you go: #10.

avatar matrikular matrikular - change - 13 May 2016
The description was changed
avatar rdeutz rdeutz - change - 16 May 2016
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2016-05-16 16:20:03
Closed_By rdeutz
avatar zero-24
zero-24 - comment - 16 May 2016

@joomla-cms-bot. This here is one more to fix :P

avatar joomla-cms-bot joomla-cms-bot - change - 16 May 2016
Labels Removed: ?

Add a Comment

Login with GitHub to post a comment