diff --git a/sites/all/modules/contrib/varnish/varnish.admin.inc b/sites/all/modules/contrib/varnish/varnish.admin.inc
index 66a897b..be20e68 100644
--- a/sites/all/modules/contrib/varnish/varnish.admin.inc
+++ b/sites/all/modules/contrib/varnish/varnish.admin.inc
@@ -44,26 +44,21 @@ function varnish_admin_settings_form() {
   );
 
   $form['varnish_control_terminal'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Varnish Control Terminal'),
+    '#type' => 'textarea',
+    '#title' => t('Varnish Control Terminals'),
     '#default_value' => variable_get('varnish_control_terminal', '127.0.0.1:6082'),
     '#required' => TRUE,
-    '#description' => t('Set this to the server IP or hostname that varnish runs on (e.g. 127.0.0.1:6082). This must be configured for Drupal to talk to Varnish. Separate multiple servers with spaces.'),
+    '#description' => t('Set this to the server IP or hostname that varnish runs on (format: "server_ip:server_port control_key" - Example: "127.0.0.1:6082 raO>kC37W"). This must be configured for Drupal to talk to Varnish. If you have several varnish servers, enter a server per line. For servers that do not need authentication, just omit the control keys.'),
   );
 
-  $form['varnish_control_key'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Varnish Control Key'),
-    '#default_value' => variable_get('varnish_control_key', ''),
-    '#description' => t('Optional: if you have established a secret key for control terminal access, please put it here.'),
-  );
   $form['varnish_socket_timeout'] = array(
-   '#type' => 'textfield',
-   '#title' => t('Varnish connection timeout (milliseconds)'),
-   '#default_value' => variable_get('varnish_socket_timeout', VARNISH_DEFAULT_TIMEOUT),
-   '#description' => t('If Varnish is running on a different server, you may need to increase this value.'),
-   '#required' => TRUE,
+    '#type' => 'textfield',
+    '#title' => t('Varnish connection timeout (milliseconds)'),
+    '#default_value' => variable_get('varnish_socket_timeout', VARNISH_DEFAULT_TIMEOUT),
+    '#description' => t('If Varnish is running on a different server, you may need to increase this value.'),
+    '#required' => TRUE,
   );
+
   $form['varnish_cache_clear'] = array(
     '#type' => 'radios',
     '#title' => t('Varnish Cache Clearing'),
@@ -113,6 +108,44 @@ function varnish_admin_settings_form_validate($form, &$form_state) {
   else {
     $form_state['values']['varnish_socket_timeout'] = (int) $form_state['values']['varnish_socket_timeout'];
   }
+  // Left-trim each server line :
+  // Right part may contain trailing spaces for control key,
+  // Remove any empty lines:
+  $server_settings = _varnish_explode_lines($form_state['values']['varnish_control_terminal']);
+  $ltrimmed_settings = array();
+  foreach ($server_settings as $line) {
+    $ltrimmed_line = ltrim($line);
+    // Keep this line if not empty:
+    if (!empty($ltrimmed_line)) {
+      $ltrimmed_settings[] = $ltrimmed_line;
+    }
+  }
+
+  // Update form with cleaned server list:
+  $form_state['values']['varnish_control_terminal'] = implode("\n", $ltrimmed_settings);
+
+  // Test each server line to ensure it matches expected format:
+  // (server_ip:server_port[ control_key]).
+  $server_settings = _varnish_explode_lines($form_state['values']['varnish_control_terminal']);
+  $server_settings_errors = array();
+  foreach ($server_settings as $line) {
+    // Tested format won't matche IPv6 as _varnish_terminal_run();
+    // Has been implemented.
+    // to open the socket with IPV4 protocol (cf socket_create(AF_INET, ...)).
+    if (!preg_match('/^[^\s]*:\d{1,5}\s[^\s]*$/', $line)) {
+      $server_settings_errors[] = '"' . $line . '" ';
+    }
+  }
+
+  if (!empty($server_settings_errors)) {
+    form_set_error(
+      'varnish_control_terminal',
+      t(
+        'Following varnish control terminals are not well formatted:<br /> %misformatted_servers',
+        array('%misformatted_servers' => implode(', ', $server_settings_errors))
+      )
+    );
+  }
 }
 
 
diff --git a/sites/all/modules/contrib/varnish/varnish.cache.inc b/sites/all/modules/contrib/varnish/varnish.cache.inc
index 7628579..412506d 100644
--- a/sites/all/modules/contrib/varnish/varnish.cache.inc
+++ b/sites/all/modules/contrib/varnish/varnish.cache.inc
@@ -36,8 +36,7 @@ class VarnishCache implements DrupalCacheInterface {
     global $user;
     // Check that we really want to do a cache flush.
     if (!module_exists('varnish') ||
-      (variable_get('varnish_cache_clear', VARNISH_DEFAULT_CLEAR) == VARNISH_NO_CLEAR) ||
-      (!variable_get('varnish_flush_cron', 0) && !lock_may_be_available('cron'))) {
+      (variable_get('varnish_flush_cron', 0) && lock_may_be_available('cron')) && !variable_get('varnish_cache_clear', 1)) {
       return;
     }
     if (empty($cid) && variable_get('varnish_cache_clear', 1)) {
diff --git a/sites/all/modules/contrib/varnish/varnish.info b/sites/all/modules/contrib/varnish/varnish.info
index 38619ab..68b90b6 100644
--- a/sites/all/modules/contrib/varnish/varnish.info
+++ b/sites/all/modules/contrib/varnish/varnish.info
@@ -6,10 +6,3 @@ package = Caching
 files[] = varnish.admin.inc
 files[] = varnish.cache.inc
 files[] = varnish.test
-
-; Information added by Drupal.org packaging script on 2014-09-11
-version = "7.x-1.0-beta3"
-core = "7.x"
-project = "varnish"
-datestamp = "1410442429"
-
diff --git a/sites/all/modules/contrib/varnish/varnish.module b/sites/all/modules/contrib/varnish/varnish.module
index 633f9b0..72fbfe8 100644
--- a/sites/all/modules/contrib/varnish/varnish.module
+++ b/sites/all/modules/contrib/varnish/varnish.module
@@ -85,9 +85,9 @@ function varnish_permission() {
  * adds a varnish cache to the list of caches
  */
 function varnish_flush_caches() {
-  if (variable_get('cache_class_external_varnish_page', FALSE)) {
-    return array('external_varnish_page');
-  }
+	if (variable_get('cache_class_external_varnish_page', FALSE)) {
+	  return array('external_varnish_page');
+	}
 }
 
 /**
@@ -126,36 +126,22 @@ function varnish_requirements($phase) {
  * Implements hook_expire_cache().
  *
  * Takes an array from expire.module and issue purges.
- * You may also safely call this function directly with an array of local urls to purge.
+ * You may also safely call this function directly
+ * With an array of local urls to purge.
  */
 function varnish_expire_cache($paths) {
-  if (module_exists('expire') && variable_get('expire_include_base_url', constant('EXPIRE_INCLUDE_BASE_URL'))) {
-    // Sort the URLs by domain and batch by domain
-    $host_buckets = array();
-    foreach ($paths as $url) {
-      $parts = parse_url($url);
-      $host_buckets[$parts['host']][] = $parts['path'].(!empty($parts['query']) ? '?'.$parts['query'] : '');
-    }
-    foreach ($host_buckets as $host => $purges) {
-      $purge = implode('$|^' , $purges);
-      $purge = '^'. $purge .'$';
-      varnish_purge($host, $purge);
-    }
-  }
-  else {
-    $host = _varnish_get_host();
-    $base = base_path();
-    $purge = implode('$|^' . $base, $paths);
-    $purge = '^'. $base . $purge .'$';
-    varnish_purge($host, $purge);
-  }
+  $host = _varnish_get_host();
+  $base = base_path();
+  $purge = implode('$|^' . $base, $paths);
+  $purge = '^' . $base . $purge . '$';
+  varnish_purge($host, $purge);
 }
 
 /**
  * Helper function to quickly flush all caches for the current site.
  */
 function varnish_purge_all_pages() {
-  $path = base_path();
+  $path = "^(?!/sites/all/themes).*"; //base_path();
   $host = _varnish_get_host();
   varnish_purge($host, $path);
 }
@@ -163,93 +149,59 @@ function varnish_purge_all_pages() {
 /**
  * Helper function to purge items for a host that matches the provided pattern.
  *
- * Take care to limit the length of $pattern to params.cli_buffer on your
- * Varnish server, otherwise Varnish will truncate the command. Use
- * varnish_purge_paths() to protect you from this, if applicable.
- *
- * @param string $host the host to purge.
- * @param string $pattern the pattern to look for and purge.
+ * @param string $host
+ *   the host to purge.
+ * @param string $pattern
+ *   the pattern to look for and purge.
  */
 function varnish_purge($host, $pattern) {
-  global $base_path, $base_root;
   // Get the current varnish version, if we are using Varnish 3.x, then we can
   // need to use ban instead of purge.
   $version = floatval(variable_get('varnish_version', 2.1));
   $command = $version >= 3 ? "ban" : "purge";
   $bantype = variable_get('varnish_bantype', VARNISH_DEFAULT_BANTYPE);
-
-  // Modify the patterns to remove base url and base path.
-  $patterns = explode('|', $pattern);
-  foreach ($patterns as $num => $single_pattern) {
-    if (substr($single_pattern, 1, strlen($base_path)) == $base_path) {
-      $single_pattern = substr_replace($single_pattern, '', 1, strlen($base_path));
-    }
-    if (substr($single_pattern, 1, strlen($base_root)) == $base_root) {
-      $single_pattern = substr_replace($single_pattern, '', 1, strlen($base_root));
-    }
-    $patterns[$num] = $single_pattern;
-  }
-  $pattern = implode('|', $patterns);
-
   switch ($bantype) {
     case VARNISH_BANTYPE_NORMAL:
-      _varnish_terminal_run(array("$command req.http.host ~ $host && req.url ~ \"$pattern\""));
+      // Orginal code was
+      // _varnish_terminal_run(array("$command req.http.host ~ $host && req.url ~ \"$pattern\""));
+      // update to not purge/ban api.q-music.be, images.q-music.be
+      _varnish_terminal_run(array("$command req.http.host == \"$host\" && req.url ~ \"$pattern\""));
       break;
+
     case VARNISH_BANTYPE_BANLURKER:
       _varnish_terminal_run(array("$command obj.http.x-host ~ $host && obj.http.x-url  ~ \"$pattern\""));
       break;
+
     default:
-      // We really should NEVER get here. Log WATCHDOG_ERROR. I can only see this happening if a user switches between different versions of the module where we remove a ban type.
+      // We really should NEVER get here.
+      // Log WATCHDOG_ERROR.
+      // I can only see this happening if a user switches between:
+      // Different versions of the module where we remove a ban type.
       watchdog('varnish', 'Varnish ban type is out of range.', array(), WATCHDOG_ERROR);
   }
 }
 
 /**
- * Helper function that wraps around varnish_purge() and compiles a regular
- * expression of all paths supplied to it. This function takes care to chunk
- * commands into no more than 7500 bytes each, to avoid hitting
- * params.cli_buffer.
- *
- * @param string $host The host to purge.
- * @param array $paths The paths (no leading slash) to purge for this host.
- */
-function varnish_purge_paths($host, $paths) {
-  // Subtract the hostname length from the global length limit.
-  // Note we use strlen() because we're counting bytes, not characters.
-  $length_limit = variable_get('varnish_cmdlength_limit', 7500) - strlen($host);
-  $base_path = base_path();
-  while (!empty($paths)) {
-    // Construct patterns and send them to the server when they're full.
-    $purge_pattern = '^';
-    while (strlen($purge_pattern) < $length_limit && !empty($paths)) {
-      $purge_pattern .= $base_path . array_shift($paths) . '$|^';
-    }
-    // Chop the final "|^" off the string, leaving "$".
-    $purge_pattern = substr($purge_pattern, 0, -2);
-    // Submit this purge chunk.
-    varnish_purge($host, $purge_pattern);
-  }
-}
-
-/**
  * Get the status (up/down) of each of the varnish servers.
  *
- * @return An array of server statuses, keyed by varnish terminal addresses.
- * The status will be a numeric constant, either:
+ * @return array()
+ *   An array of server statuses, keyed by varnish terminal addresses.
+ *   The status will be a numeric constant, either:
  * - VARNISH_SERVER_STATUS_UP
  * - VARNISH_SERVER_STATUS_DOWN
  */
 function varnish_get_status() {
-  // use a static-cache so this can be called repeatedly without incurring
-  // socket-connects for each call.
+  // Use a static-cache so this can be called repeatedly without incurring:
+  // Socket-connects for each call.
   static $results = NULL;
   if (is_null($results)) {
     $results = array();
     $status = _varnish_terminal_run(array('status'));
-    $terminals = explode(' ', variable_get('varnish_control_terminal', '127.0.0.1:6082'));
+    $terminals = _varnish_get_server_list();
     foreach ($terminals as $terminal) {
-      $stat = array_shift($status);
-      $results[$terminal] = ($stat['status']['code'] == 200) ? VARNISH_SERVER_STATUS_UP : VARNISH_SERVER_STATUS_DOWN;
+      $cur_server_address = $terminal['server'] . ':' . $terminal['port'];
+      $stat = $status[$cur_server_address];
+      $results[$cur_server_address] = ($stat['status']['code'] == 200) ? VARNISH_SERVER_STATUS_UP : VARNISH_SERVER_STATUS_DOWN;
     }
   }
   return $results;
@@ -261,7 +213,8 @@ function varnish_get_status() {
 function theme_varnish_status($status) {
   $items = array();
   foreach ($status as $terminal => $state) {
-    list($server, $port) = explode(':', $terminal);
+    list($host, $secret) = explode(' ', $terminal);
+    list($server, $port) = explode(':', $host);
     if ($state == VARNISH_SERVER_STATUS_UP) {
       $icon = theme('image', array('path' => 'misc/watchdog-ok.png', 'alt' => t("Server OK: @server:@port", array('@server' => $server, '@port' => $port)), 'title' => "{$server}:{$port}"));
       $version = floatval(variable_get('varnish_version', 2.1));
@@ -290,76 +243,87 @@ function _varnish_get_host() {
   return $parts['host'];
 }
 
-
 /**
  * Helper function that sends commands to Varnish.
- * Utilizes sockets to talk to varnish terminal.
  */
 function _varnish_terminal_run($commands) {
+  // Utilizes sockets to talk to varnish terminal.
   if (!extension_loaded('sockets')) {
     // Prevent fatal errors if people don't have requirements.
     return FALSE;
   }
-  // Convert single commands to an array so we can handle everything in the same way.
+  // Convert single commands to an array,
+  // So we can handle everything in the same way.
   if (!is_array($commands)) {
     $commands = array($commands);
   }
   $ret = array();
-  $terminals = explode(' ', variable_get('varnish_control_terminal', '127.0.0.1:6082'));
+  $terminals = _varnish_get_server_list();
   // The variable varnish_socket_timeout defines the timeout in milliseconds.
   $timeout = variable_get('varnish_socket_timeout', VARNISH_DEFAULT_TIMEOUT);
-  $seconds = (int)($timeout / 1000);
-  $microseconds = (int)($timeout % 1000 * 1000);
+  $seconds = (int) ($timeout / 1000);
+  $microseconds = (int) ($timeout % 1000 * 1000);
   foreach ($terminals as $terminal) {
-    list($server, $port) = explode(':', $terminal);
+    $cur_server_address = $terminal['server'] . ':' . $terminal['port'];
     $client = socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp'));
     socket_set_option($client, SOL_SOCKET, SO_SNDTIMEO, array('sec' => $seconds, 'usec' => $microseconds));
     socket_set_option($client, SOL_SOCKET, SO_RCVTIMEO, array('sec' => $seconds, 'usec' => $microseconds));
-    if (@!socket_connect($client, $server, $port)) {
-      watchdog('varnish', 'Unable to connect to server socket @server:@port: %error', array(
-        '@server' => $server,
-        '@port' => $port,
-        '%error' => socket_strerror(socket_last_error($client))
+    if (@!socket_connect($client, $terminal['server'], $terminal['port'])) {
+      watchdog('varnish', 'Unable to connect to server socket !server:!port: %error', array(
+        '!server' => $terminal['server'],
+        '!port' => $terminal['port'],
+        '%error' => socket_strerror(socket_last_error($client)),
         ), WATCHDOG_ERROR);
-      $ret[$terminal] = FALSE;
+      $ret[$cur_server_address] = FALSE;
       // If a varnish server is unavailable, move on to the next in the list.
       continue;
     }
-    // If there is a CLI banner message (varnish >= 2.1.x), try to read it and move on.
-    if(floatval(variable_get('varnish_version', 2.1)) > 2.0) {
+    // If there is a CLI banner message (varnish >= 2.1.x),
+    // Try to read it and move on.
+    if (floatval(variable_get('varnish_version', 2.1)) > 2.0) {
       $status = _varnish_read_socket($client);
       // Do we need to authenticate?
-      if ($status['code'] == 107) { // Require authentication
-        $secret = variable_get('varnish_control_key', '');
+      if ($status['code'] == 107) {
+        // Require authentication.
         $challenge = substr($status['msg'], 0, 32);
-        $pack = $challenge . "\x0A" . $secret . "\x0A" . $challenge . "\x0A";
+        $pack = $challenge . "\x0A" . $terminal['control_key'] . "\x0A" . $challenge . "\x0A";
         $key = hash('sha256', $pack);
         socket_write($client, "auth $key\n");
         $status = _varnish_read_socket($client);
         if ($status['code'] != 200) {
           watchdog('varnish', 'Authentication to server failed!', array(), WATCHDOG_ERROR);
+          $ret[$cur_server_address] = FALSE;
+          // If authentication to a varnish server failed, move on to next.
+          continue;
         }
       }
     }
     foreach ($commands as $command) {
       if ($status = _varnish_execute_command($client, $command)) {
-        $ret[$terminal][$command] = $status;
+        $ret[$cur_server_address][$command] = $status;
       }
     }
   }
   return $ret;
 }
 
+/**
+ * Execute a varnish command.
+ */
 function _varnish_execute_command($client, $command) {
   // Send command and get response.
   $result = socket_write($client, "$command\n");
   $status = _varnish_read_socket($client);
   if ($status['code'] != 200) {
-    watchdog('varnish', 'Recieved status code @code running %command. Full response text: @error', array('@code' => $status['code'], '%command' => $command, '@error' => $status['msg']), WATCHDOG_ERROR);
+    watchdog('varnish', 'Recieved status code !code running %command. Full response text: !error', array(
+      '!code' => $status['code'],
+      '%command' => $command,
+      '!error' => $status['msg'],
+    ), WATCHDOG_ERROR);
     return FALSE;
   }
   else {
-    // successful connection
+    // Successful connection.
     return $status;
   }
 }
@@ -380,20 +344,89 @@ function _varnish_read_socket($client, $retry = 2) {
     // 35 = socket-unavailable, so it might be blocked from our write.
     // This is an acceptable place to retry.
     if ($error == 35 && $retry > 0) {
-      return _varnish_read_socket($client, $retry-1);
+      return _varnish_read_socket($client, $retry - 1);
     }
     else {
-      watchdog('varnish', 'Socket error: @error', array('@error' => socket_strerror($error)), WATCHDOG_ERROR);
+      watchdog('varnish', 'Socket error: !error', array('!error' => socket_strerror($error)), WATCHDOG_ERROR);
       return array(
         'code' => $error,
         'msg' => socket_strerror($error),
       );
     }
   }
-  $msg_len = (int)substr($header, 4, 6) + 1;
+  $msg_len = (int) substr($header, 4, 6) + 1;
   $status = array(
     'code' => substr($header, 0, 3),
-    'msg' => socket_read($client, $msg_len, PHP_BINARY_READ)
+    'msg' => socket_read($client, $msg_len, PHP_BINARY_READ),
   );
   return $status;
 }
+
+
+/**
+ * Extracts an array out of the textual setting variable that lists servers.
+ *
+ * @param string $text_settings
+ *   The textual settings to parse. If not given,
+ *   Variable 'varnish_control_terminal' is retrieved with variable_get().
+ *   Expected format for each line: server_ip:server_port control_key
+ *
+ * @return array()
+ *   An array with all varnish servers and their properties, like this:
+ *         array(
+ *           0 => array(
+ *             'server'      => string // Server IP or name
+ *             'port'        => string // Server port if given, 6082 otherwise
+ *             'control_key' => string // varnish's secret key if given|Empty
+ *           ),
+ *           1 => ...
+ *         )
+ */
+function _varnish_get_server_list($text_settings = NULL) {
+  $server_list = array();
+
+  // Retrieve textual setting:
+  if ($text_settings === NULL) {
+    $text_settings = variable_get('varnish_control_terminal', '127.0.0.1:6082');
+  }
+  // Explode settings on line breaks:
+  $array_settings = _varnish_explode_lines($text_settings);
+  // Browse each line to extract IPs, ports and control keys:
+  foreach ($array_settings as $a_server) {
+    // Split server and control key (default value for control key is ""):
+    list($server, $control_key) = explode(' ', $a_server, 2);
+    if (!isset($control_key)) {
+      $control_key = '';
+    }
+    // Split server IP/name and server PORT (default value for port is 6082):
+    list($server_name, $server_port) = explode(':', $server);
+    if (!isset($server_port)) {
+      $server_port = '6082';
+    }
+
+    // Add these extracted info into the server list:
+    $server_list[] = array(
+      'server' => $server_name,
+      'port' => $server_port,
+      'control_key' => $control_key,
+    );
+  }
+  return $server_list;
+}
+
+/**
+ * Explodes given text on line breaks. Takes care of line break formats.
+ *
+ * @param string $text
+ *   Text to explode.
+ *
+ * @return array
+ *   : A cell per line.
+ */
+function _varnish_explode_lines($text) {
+  // Convert all Windows and Mac newlines to a single newline,
+  // To deal with one possibility.
+  $text = str_replace(array("\r\n", "\r"), "\n", $text);
+
+  return explode("\n", $text);
+}
