Skip to content

Commit

Permalink
CONTRIB-9549: Fix content-type
Browse files Browse the repository at this point in the history
* Changed content-type from text/xml to application/xml
* Backported 3.0 logic for checking data before making POST request
  • Loading branch information
ssj365 committed Apr 12, 2024
1 parent 920a81f commit 35524fe
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ function bigbluebuttonbn_get_server_version() {
*
* @return object
*/
function bigbluebuttonbn_wrap_xml_load_file($url, $method = 'GET', $data = null, $contenttype = 'text/xml') {
function bigbluebuttonbn_wrap_xml_load_file($url, $method = 'GET', $data = null, $contenttype = 'application/xml') {
if (extension_loaded('curl')) {
$response = bigbluebuttonbn_wrap_xml_load_file_curl_request($url, $method, $data, $contenttype);
if (!$response) {
Expand Down Expand Up @@ -595,14 +595,15 @@ function bigbluebuttonbn_wrap_xml_load_file($url, $method = 'GET', $data = null,
*
* @return object
*/
function bigbluebuttonbn_wrap_xml_load_file_curl_request($url, $method = 'GET', $data = null, $contenttype = 'text/xml') {
function bigbluebuttonbn_wrap_xml_load_file_curl_request($url, $method = 'GET', $data = null, $contenttype = 'application/xml') {
global $CFG;
require_once($CFG->libdir . '/filelib.php');
$c = new curl();
$c->setopt(array('SSL_VERIFYPEER' => true));
if ($method == 'POST') {
if (is_null($data) || is_array($data)) {
return $c->post($url);
if (is_null($data) || !is_string($data)) {
debugging('Only string parameters are supported', DEBUG_DEVELOPER);
$data = '';
}
$options = array();
$options['CURLOPT_HTTPHEADER'] = array(
Expand Down

0 comments on commit 35524fe

Please sign in to comment.