protected function get_whitelisted_ports() {
        global $CFG;
        if (!isset($CFG->curlsecurityallowedport)) {
            return [];
        }
        return array_filter(array_map('trim', explode("\n", $CFG->curlsecurityallowedport)), function($entry) {
            return !empty($entry);
        });
    }