User tests: Successful: Unsuccessful:
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.
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:
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
Title |
|
Title |
|
Category | ⇒ | Libraries |
Labels |
Added:
?
|
Works as described. Fixes a problem I have had. Thanx for the patch.
I have tested this item successfully on fd2305c
Status | Pending | ⇒ | Ready to Commit |
Labels |
MERGER - I am setting this RTC but not sure if should be merged here or in the upstream package?
Labels |
Added:
?
|
Milestone |
Added: |
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.
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
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.
@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
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 |
@joomla-cms-bot. This here is one more to fix :P
Labels |
Removed:
?
|
@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.