--- z3950.module	2007-09-08 13:50:39.000000000 +0200
+++ z3950.module	2009-06-11 19:42:06.000000000 +0200
@@ -172,8 +172,27 @@
     // setup the YAZ search on each server
     $ids = array();
     foreach ($servers as $server_index => $server) {
+      // separate list of options from server 
+      //	opt1=val1,opt2=val2:server ...
+      preg_match('/^(([^:]+):)?((([^:.\/]+)([.][^:.\/]+)+)(:([0-9]+))?(\/([^:\/]+))?)$/',$server,$server_args);
+	  //  drupal_set_message('options='.$server_args[2], 'info');
+	  //  drupal_set_message('domain='.$server_args[4], 'info');
+	  //  drupal_set_message('port='.$server_args[8], 'info');
+	  //  drupal_set_message('db='.$server_args[10], 'info');
+      $optionlist=explode(',', $server_args[2]);
+      $server = $server_args[3];
+      foreach ($optionlist as $optval) {
+        preg_match('/^([^=]+)=(.*)/',$optval, $option);
+        if ($option[2]) {
+          $options[$option[1]] = $option[2];
+        } else
+        { // option name without value like "tcp"
+          // push it back to front of server
+        }
+      }
+
       // connect to the yaz server
-      $id = $ids[$server_index] = yaz_connect($server);
+      $id = $ids[$server_index] = yaz_connect($server, $options);
 
       // tell the yaz server the preferred syntax
       yaz_syntax($id, variable_get('z3950_syntax', YAZ_DEFAULT_SYNTAX));
