#38553 [NEW]: Improved connection handling
From: stirling dot andrew at gmail dot com
Operating system: Any
PHP version: 5.1.5
PHP Bug Type: Feature/Change Request
Bug description: Improved connection handling
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)
--
Edit bug report at http://bugs.php.net/?id=38553&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38553&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38553&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38553&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38553&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=38553&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38553&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38553&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38553&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38553&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38553&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=38553&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=38553&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38553&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38553&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38553&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38553&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38553&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38553&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38553&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38553&r=mysqlcfg
Thread (1 message)
- stirling dot andrew at gmail dot com