From 42b00572f250ed3c71ee1d1821969fab558b2b25 Mon Sep 17 00:00:00 2001 From: Jaime Perez Crespo <jaime.perez@uninett.no> Date: Thu, 24 Sep 2015 11:27:05 +0200 Subject: [PATCH] Add support for UNIX sockets in memcache. --- lib/SimpleSAML/Memcache.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/SimpleSAML/Memcache.php b/lib/SimpleSAML/Memcache.php index 94c439c76..d6f1e5162 100644 --- a/lib/SimpleSAML/Memcache.php +++ b/lib/SimpleSAML/Memcache.php @@ -207,8 +207,17 @@ class SimpleSAML_Memcache ); } + // check if we are told to use a socket + $socket = false; + if (strpos($hostname, 'unix:///') === 0) { + $socket = true; + } + // check if the user has specified a port number - if (array_key_exists('port', $server)) { + if ($socket) { + // force port to be 0 for sockets + $port = 0; + } elseif (array_key_exists('port', $server)) { // get the port number from the array, and validate it $port = (int) $server['port']; if (($port <= 0) || ($port > 65535)) { -- GitLab