Permalink
Browse files

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

  • Loading branch information...
mrmark authored and danpoltawski committed Jun 27, 2013
1 parent 59f8555 commit 0f0fa7a86cda87f7a4caebf377a29140bb251980
Showing with 7 additions and 1 deletion.
  1. +1 −1 mod/lti/locallib.php
  2. +6 −0 mod/lti/tests/locallib_test.php
View
@@ -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);
}
}
@@ -139,4 +139,10 @@ public function disabled_test_parse_grade_replace_message() {
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'));
+ }
}

0 comments on commit 0f0fa7a

Please sign in to comment.