If the BBB URL has a protocol, use it when making API calls

When configuring a BigBlueButton server with HTTPS, it wasn't using HTTPS
in the API calls.
Even if the server returned a redirect on HTTP calls they would not work,
since curl is not configured to follow redirects. So all API calls would
fail.
pull/3261/head
Leonardo Crauss Daronco 6 years ago
parent 19642f3032
commit 1cf87448d1
  1. 4
      plugin/bbb/lib/bbb.lib.php
  2. 4
      plugin/bbb/lib/bbb_api.php

@ -125,13 +125,15 @@ class bbb
$urlWithProtocol = $bbb_host; $urlWithProtocol = $bbb_host;
} else { } else {
// We assume it's an http, if user wants to use https, the host *must* include the protocol. // We assume it's an http, if user wants to use https, the host *must* include the protocol.
$urlWithProtocol = 'http://'.$bbb_host; $this->protocol = 'http://';
$urlWithProtocol = $this->protocol.$bbb_host;
} }
// Setting BBB api // Setting BBB api
define('CONFIG_SECURITY_SALT', $this->salt); define('CONFIG_SECURITY_SALT', $this->salt);
define('CONFIG_SERVER_URL_WITH_PROTOCOL', $urlWithProtocol); define('CONFIG_SERVER_URL_WITH_PROTOCOL', $urlWithProtocol);
define('CONFIG_SERVER_BASE_URL', $this->url); define('CONFIG_SERVER_BASE_URL', $this->url);
define('CONFIG_SERVER_PROTOCOL', $this->protocol);
$this->api = new BigBlueButtonBN(); $this->api = new BigBlueButtonBN();
$this->pluginEnabled = true; $this->pluginEnabled = true;

@ -41,6 +41,7 @@ class BigBlueButtonBN
{ {
private $_securitySalt; private $_securitySalt;
private $_bbbServerBaseUrl; private $_bbbServerBaseUrl;
private $_bbbServerProtocol;
public function __construct() public function __construct()
{ {
@ -51,6 +52,7 @@ class BigBlueButtonBN
// simply flow in here via the constants: // simply flow in here via the constants:
$this->_securitySalt = CONFIG_SECURITY_SALT; $this->_securitySalt = CONFIG_SECURITY_SALT;
$this->_bbbServerBaseUrl = CONFIG_SERVER_BASE_URL; $this->_bbbServerBaseUrl = CONFIG_SERVER_BASE_URL;
$this->_bbbServerProtocol = CONFIG_SERVER_PROTOCOL;
} }
private function _processXmlResponse($url) private function _processXmlResponse($url)
@ -62,7 +64,7 @@ class BigBlueButtonBN
$ch = curl_init() or die ( curl_error($ch) ); $ch = curl_init() or die ( curl_error($ch) );
$timeout = 10; $timeout = 10;
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt( $ch, CURLOPT_URL, $url ); curl_setopt( $ch, CURLOPT_URL, $this->_bbbServerProtocol.$url );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout);
// Following redirect required to use Scalelite, BBB's Load Balancer // Following redirect required to use Scalelite, BBB's Load Balancer

Loading…
Cancel
Save