Merge pull request #98 from radiorabe/feature/tls-support

General fixes for TLS
This commit is contained in:
Robb 2017-03-18 12:36:57 -04:00 committed by GitHub
commit fcebafbc6b
2 changed files with 10 additions and 4 deletions

View File

@ -510,6 +510,10 @@ SQL;
$serverPort = $_SERVER['SERVER_PORT']; $serverPort = $_SERVER['SERVER_PORT'];
$subDir = $CC_CONFIG['baseDir']; $subDir = $CC_CONFIG['baseDir'];
if ($protocol === 'https' && $serverPort == 80) {
$serverPort = 443;
}
if ($subDir[0] === "/") { if ($subDir[0] === "/") {
$subDir = substr($subDir, 1, strlen($subDir) - 1); $subDir = substr($subDir, 1, strlen($subDir) - 1);
} }

View File

@ -186,8 +186,9 @@ class RequestProvider(object):
self.requests = {} self.requests = {}
if self.config["general"]["base_dir"].startswith("/"): if self.config["general"]["base_dir"].startswith("/"):
self.config["general"]["base_dir"] = self.config["general"]["base_dir"][1:] self.config["general"]["base_dir"] = self.config["general"]["base_dir"][1:]
self.url = ApcUrl("http://%s:%s/%s%s/%s" \ self.url = ApcUrl("%s://%s:%s/%s%s/%s" \
% (self.config["general"]["base_url"], str(self.config["general"]["base_port"]), % (str(("https", "http")[self.config["general"]["base_port"] == 443]),
self.config["general"]["base_url"], str(self.config["general"]["base_port"]),
self.config["general"]["base_dir"], self.config["api_base"], self.config["general"]["base_dir"], self.config["api_base"],
'%%action%%')) '%%action%%'))
# Now we must discover the possible actions # Now we must discover the possible actions
@ -323,8 +324,9 @@ class AirtimeApiClient(object):
# TODO : Make other methods in this class use this this method. # TODO : Make other methods in this class use this this method.
if self.config["general"]["base_dir"].startswith("/"): if self.config["general"]["base_dir"].startswith("/"):
self.config["general"]["base_dir"] = self.config["general"]["base_dir"][1:] self.config["general"]["base_dir"] = self.config["general"]["base_dir"][1:]
url = "http://%s:%s/%s%s/%s" % \ url = "%s://%s:%s/%s%s/%s" % \
(self.config["general"]["base_url"], str(self.config["general"]["base_port"]), (str(("https", "http")[self.config["general"]["base_port"] == 443]),
self.config["general"]["base_url"], str(self.config["general"]["base_port"]),
self.config["general"]["base_dir"], self.config["api_base"], self.config["general"]["base_dir"], self.config["api_base"],
self.config[config_action_key]) self.config[config_action_key])
url = url.replace("%%api_key%%", self.config["general"]["api_key"]) url = url.replace("%%api_key%%", self.config["general"]["api_key"])