getting rid of some debugging output
[gwvp-mini.git] / gwvpmini / gwvpmini_gitbackend.php
index 7a0d892..5fe188a 100644 (file)
@@ -287,7 +287,7 @@ function gwvpmini_callGitBackend($username, $repo)
 
                $headers = getallheaders();
                
-               error_log("path trans'd is /$repo_base/$repo.git/$euri from $ruri with ".$_REQUEST["q"]." $strrem pre is ".print_r($_REQUEST,true)." and foff ".print_r($headers, true));
+               //error_log("path trans'd is /$repo_base/$repo.git/$euri from $ruri with ".$_REQUEST["q"]." $strrem pre is ".print_r($_REQUEST,true)." and foff ".print_r($headers, true));
                
                $pwd = "/$repo_base/";
                
@@ -323,7 +323,7 @@ function gwvpmini_callGitBackend($username, $repo)
                
                
                $stlimit = 0;
-               $fp = fopen("/tmp/gitup.".rand(0,4000000), "w");
+               //$fp = fopen("/tmp/gitup.".rand(0,4000000), "w");
                $from_client_data = "";
                // i was going to use stream_select, but i feel this works better like this
                while($continue) {
@@ -351,7 +351,7 @@ function gwvpmini_callGitBackend($username, $repo)
                                }
                                if($from_client_data !== false) {
                                        fwrite($pipes[0], $from_client_data);
-                                       fwrite($fp, $from_client_data);
+                                       //fwrite($fp, $from_client_data);
                                }
                                fflush($pipes[0]);
                                //fwrite($fl, $from_client_data);
@@ -381,18 +381,20 @@ function gwvpmini_callGitBackend($username, $repo)
                                                // or something the git-http-backend thing is doing..
                                                // TODO: find out why this happens
                                                $from_cgi_data = preg_replace("/^\r\n/", "", $from_cgi_data_t);
+                                               /*
                                                if(strlen($from_cgi_data)!=strlen($from_cgi_data_t)) {
                                                        error_log("MOOOKS - we did trunc");
                                                } else {
                                                        error_log("MOOOKS - we did not trunc");
-                                               }
+                                               }*/
                                                $firstline = false;
                                        }
                                }
                                
-                               if($from_cgi_data !== false) {
-                                       error_log("send to client");
+                               if($from_cgi_data !== false && $from_cgi_data != "") {
+                                       //error_log("send to client of size ".strlen($from_cgi_data));
                                        echo $from_cgi_data;
+                                       ob_flush();
                                        flush();
                                }
                                $cgi_len = strlen($from_cgi_data);
@@ -407,12 +409,12 @@ function gwvpmini_callGitBackend($username, $repo)
                        else {
                                if($client_len == 0 && $cgi_len == 0) {
                                        usleep(200000);
-                                       error_log("sleep tick");
+                                       //error_log("sleep tick");
                                        $stlimit++;
-                                       if($stlimit > 5000) $continue = false;
+                                       if($stlimit > 300) $continue = false; // if we get no output from git backend after 1 minute, we close..... something went wrong
                                } else {
                                        $stlimit = 0;
-                                       error_log("sizes: $client_len, $cgi_len");
+                                       //error_log("sizes: $client_len, $cgi_len");
                                        if($cgi_len > 0) {
                                                //error_log("from cgi: \"$from_cgi_data\"");
                                        }