note 96442 added to function.header

From: Date: Sat, 27 Feb 2010 08:58:33 +0000
Subject: note 96442 added to function.header
Groups: php.notes 
Request: Send a blank email to php-notes+get-166426@lists.php.net to get a copy of this message
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! ---- Server IP: 64.71.164.2 Probable Submitter: 72.11.143.208 ---- Manual Page -- http://www.php.net/manual/en/function.header.php Edit -- https://master.php.net/note/edit/96442 Del: integrated -- https://master.php.net/note/delete/96442/integrated Del: useless -- https://master.php.net/note/delete/96442/useless Del: bad code -- https://master.php.net/note/delete/96442/bad+code Del: spam -- https://master.php.net/note/delete/96442/spam Del: non-english -- https://master.php.net/note/delete/96442/non-english Del: in docs -- https://master.php.net/note/delete/96442/in+docs Del: other reasons-- https://master.php.net/note/delete/96442 Reject -- https://master.php.net/note/reject/96442 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#166426) next »