Feature/Change Request Bug #38553https://bugs.php.net/bug.php?id=38553
[Open] Improved connection handlingTue, 22 Aug 2006 23:54:05 +0000Tue, 22 Aug 2006 23:54:05 +0000stirling.andrew@... [2006-08-22 23:54:05]Feature/Change Request Feature/Change Request
Reported by stirling.andrew@...
Tue, 22 Aug 2006 23:54:05 +0000
PHP: 5.1.5, OS: Any
Description:
------------
I'm looking to be able to close a connection before the PHP script has finished. An example of this functionality's application:
1. XMLHttpRequest requests PHP page 'setup.php';
2. setup.php checks request, approves that it is possible, and outputs a positive response, then closes the connection.
3. setup.php then does time-intensive setup procedure for later use.
This would allow this things to be started by an XMLHttpRequest, but not require the client to have to hang around waiting before it can return a positive or negative response. While the approval will come within less than a second, the rest of the script might take up to 10 seconds to be finished during a peak period. Having to wait for the full script to run is less than ideal.
Reproduce code:
---------------
<?php
// Pseudo-php.
function check_allowed( $id );
function setup_data( $id );
if( check_allowed($_GET['id']) )
$xml = '<response approved=1 />';
else
$xml = '<response approved=0 />';
echo $xml;
flush();
close_connection(); // Requested feature
setup_data( $_GET['id'] );
?>
Expected result:
----------------
The XMLHttpRequest object will be ready to use as soon as the connection is closed at close_connection(). While I have included a flush() call in the above example, ideally close_connection() should include an output buffer flush.
Actual result:
--------------
N/A (Feature does not exist, and simply using ignore_user_abort() and flush() is not sufficient)
]]>Tue, 22 Aug 2006 23:54:05 +0000https://bugs.php.net/bug.php?id=38553