diff --git a/VERSIONS_HOTLINE/33756 b/VERSIONS_HOTLINE/33756 new file mode 100644 index 0000000000000000000000000000000000000000..ba1a2540b5c103aa5bcc8149562b43de6ac7eed5 --- /dev/null +++ b/VERSIONS_HOTLINE/33756 @@ -0,0 +1 @@ + - ticket #33756 : Cosmogramme : correction de la prise en charge de webservices en https \ No newline at end of file diff --git a/library/Class/WebService/SIGB/AbstractRESTService.php b/library/Class/WebService/SIGB/AbstractRESTService.php index 1303ebb6ebac571764193cc3bbe0ba4201af0624..857648b26603573f365e4efc3bc6b9bfe319fac9 100644 --- a/library/Class/WebService/SIGB/AbstractRESTService.php +++ b/library/Class/WebService/SIGB/AbstractRESTService.php @@ -37,10 +37,18 @@ abstract class Class_WebService_SIGB_AbstractRESTService extends Class_WebServic * @return Class_WebService_SIGB_AbstractRESTService */ public function setServerRoot($server_root) { - $this->_server_root = 'http://' . str_replace('http://', '', $server_root); + $this->_server_root = $this->_withProtocol($server_root); return $this; } + + protected function _withProtocol($url) { + return ('http://' == substr($url, 0, 7) || 'https://' == substr($url, 0, 8) + ? '' : 'http://') + . $url; + } + + /** * @return string */