MDL-38419: External tool - when force SSL checked, URLs get corrupted

This commit is contained in:
Mark Nielsen
2013-10-28 12:35:07 +08:00
committed by Dan Poltawski
parent 59f8555512
commit 0f0fa7a86c
2 changed files with 7 additions and 1 deletions
+1 -1
View File
@@ -1168,7 +1168,7 @@ function lti_ensure_url_is_https($url) {
} else {
//If the URL starts with http, replace with https
if (stripos($url, 'http://') === 0) {
$url = 'https://' . substr($url, 8);
$url = 'https://' . substr($url, 7);
}
}
+6
View File
@@ -139,4 +139,10 @@ class mod_lti_locallib_testcase extends basic_testcase {
lti_verify_sourcedid($ltiinstance, $parsed);
}
public function test_lti_ensure_url_is_https() {
$this->assertEquals('https://moodle.org', lti_ensure_url_is_https('http://moodle.org'));
$this->assertEquals('https://moodle.org', lti_ensure_url_is_https('moodle.org'));
$this->assertEquals('https://moodle.org', lti_ensure_url_is_https('https://moodle.org'));
}
}