Keep-Alive problem

From: Date: Fri, 23 Mar 2007 10:53:33 +0000
Subject: Keep-Alive problem
Groups: php.general 
Request: Send a blank email to php-general+get-251161@lists.php.net to get a copy of this message
Hy, I've a problem with a keep-alive connection. I've describe it in http://bugs.php.net/bug.php?id=40895 but it seems to not be a bug. The problem is simple: My browser calls the same page twice with a keep-alive connection. The first time, I answer quickly but i have some stuff to do so I use the "Content-Length" to indicate to the browser that the response is done: ignore_user_abort(true); $msg="toto"; header("Content-Length: ".strlen($msg)); echo $msg; flush(); ... some long time stuff here The browser clearly understand the Content-Length because it makes the second Http Request before the end of the first call (after the read of the strlen($msg) bytes). Then, the second call is blocked until the first call is entirely done. Now, If I explicitly ask the browser for closing the connection: header("Cache-Control: no-cache, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Connection: close"); $msg="toto"; header("Content-Length: ".strlen($msg)); echo $msg; flush(); all work fine. To my question is really simple: How could I tell to php to notify apache that the response is done so it will treat the second response hence if the first call is not finished? Note: *I look for something like closing standard output but I didn't find a solution *I'm not interested in solution like putting the job into a database table and having a cron process. *I think there is no php functions/way to do so, so isn't it a bug? (missing important feature). Thx Julien Allali. -- Julien Allali LaBRI Modeles et Algorithmes pour la Bioinformatique et la Visualisation 351, cours de la Libération 33405 Talence Cedex 33405 France email: julien.allali@labri.fr phone: +33(0)5 40 00 36 11 mobil: +33(0)6 10 46 48 43 homepage: http://igm.univ-mlv.fr/~allali/

« previous php.general (#251161) next »