note 96442 deleted from function.header by tularis

From: Date: Fri, 04 Apr 2014 11:25:00 +0000
Subject: note 96442 deleted from function.header by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-199145@lists.php.net to get a copy of this message
Note Submitter: xxxbunker dot com ---- we use 204's extensively. after doing some spring cleanup, we found out (as many others might have), that even tho you header('204..., the user agent will wait until the content-length header is received. which, at least via apache 2 (others probably) is not sent until the script has completed executing completely. so, after doing some testing: HTTP/1.0 204 No Content Date: Sat, 27 Feb 2010 08:23:49 GMT Server: Apache Content-Length: 0 Vary: User-Agent,Accept-Encoding Connection: close Content-Type: text/html is what is sent during a standard 204 response... so to reproduce this, the function we are using is: header('HTTP/1.0 204 No Content'); header('Content-Length: 0',true); header('Content-Type: text/html',true); flush(); when the above is called prior to doing any processing, the user agent will be left alone to do other things, and you may continue doing (at times 'time' heavy) processing on the server end. enjoy!

« previous php.notes (#199145) next »