| 
	
 | 
 Posted by Rasmus Lerdorf on 09/02/05 22:38 
Rasmus Lerdorf wrote: 
> Chris Shiflett wrote: 
>  
>>Rasmus Lerdorf wrote: 
>> 
>> 
>>>Why modify my test? 
>> 
>> 
>>Because it has less delay. Thus, it's more difficult to tell if the 
>>browser is requesting the new URL before or after receiving the entire 
>>response. My script is essentially the same thing, but the script takes 
>>30 seconds to execute. It makes the distinction very clear. 
>> 
>>The addition of flush() forces the chunked response. You can remove that 
>>if your server uses chunked transfer encoding without it. 
>> 
>> 
>>>What did you see in log.txt from my version and on your screen? 
>> 
>> 
>>You would see the output "Count0\nCount1\n..." in the log and the PHP 
>>web site in the browser. I'm not sure how that's relevant. No browser is 
>>going to render content from a 302 response, but that doesn't prove that 
>>it won't wait for it. 
>  
>  
> Yes it does.  The last number in log.txt tells you exactly when the 
> browser stopped listening to the response and closed the socket because 
> PHP will abort the script at that point.  If what you are saying is 
> true, how do you explain the fact that you don't see a count all the way 
> up to 999,999 in my test in the log.txt file? 
 
Also, just add a single line to your own test script and make it look 
like this: 
 
header('Location: http://www.php.net/'); 
$fp = fopen('/tmp/log.txt', 'w'); 
for ($i = 0; $i < 30; $i++) 
{ 
    $str = "Count $i\n"; 
    echo str_repeat($str,1000); 
    fputs($fp, $str); 
    sleep(1); 
    flush(); 
} 
 
Then time how long it takes for the redirect to happen.  Is it still 
taking 30 seconds?  If not, why not? 
 
-Rasmus
 
  
Navigation:
[Reply to this message] 
 |