diff --git a/xCAT-UI/lib/functions.php b/xCAT-UI/lib/functions.php index a08be7a94..fe04db9d9 100644 --- a/xCAT-UI/lib/functions.php +++ b/xCAT-UI/lib/functions.php @@ -50,13 +50,15 @@ function submit_request($req, $skipVerify){ if($fp = stream_socket_client('ssl://'.$xcathost.':'.$port,$errno,$errstr,30,STREAM_CLIENT_CONNECT,$context)){ fwrite($fp,$req->asXML()); // send the xml to xcatd while(!feof($fp)){ // and then read until there is no more - $response .= preg_replace('/\n/','', fgets($fp)); // remove newlines and add it to the response + $recentdata=fgets($fp); + $response .= preg_replace('/\n/','', $recentdata); // remove newlines and add it to the response // Look for the serverdone response $fullpattern = '/\s*\s*<\/serverdone>\s*<\/xcatresponse>/'; $mixedpattern = '/\s*<\/serverdone>.*<\/xcatresponse>/'; + $recentpattern = '/<\/xcatresponse>/'; //$shortpattern = '/\s*<\/serverdone>/'; - if(preg_match($mixedpattern,$response)) { // transaction is done, pkg up the xml and return it + if(preg_match($recentpattern,$recentdata) && preg_match($mixedpattern,$response)) { // transaction is done, pkg up the xml and return it //echo "

", htmlentities($response), "

\n"; // remove the serverdone response and put an xcat tag around the rest $count = 0;