From 8a87239adbba9c018fa9a5239f1444de260b6f24 Mon Sep 17 00:00:00 2001 From: Brian Ziemek Date: Sun, 18 Mar 2018 13:36:18 -0400 Subject: [PATCH] Handle redundant slashes in ticker config I.e. `https://api.example.com//ticker/target` becomes `https://api.example.com/ticker/target` --- include/classes/tools.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/classes/tools.class.php b/include/classes/tools.class.php index f0eb8694..029b8cb4 100644 --- a/include/classes/tools.class.php +++ b/include/classes/tools.class.php @@ -44,9 +44,13 @@ class Tools extends Base { curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; PHP client; '.php_uname('s').'; PHP/'.phpversion().')'); } - curl_setopt($ch, CURLOPT_URL, $url . $target); + + $url = rtrim($url, '/'); + $target = ltrim($target, '/'); + curl_setopt($ch, CURLOPT_URL, $url . '/' . $target); // curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);