|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #38553 Improved connection handling
Submitted: 2006-08-22 23:54 UTC Modified: -
Avg. Score:4.5 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:3 (100.0%)
From: stirling dot andrew at gmail dot com Assigned:
Status: Open Package: Feature/Change Request
PHP Version: 5.1.5 OS: Any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: stirling dot andrew at gmail dot com
New email:
PHP Version: OS:


 [2006-08-22 23:54 UTC] stirling dot andrew at gmail dot com
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:
// Pseudo-php.
function check_allowed( $id );
function setup_data( $id );

if( check_allowed($_GET['id']) )
  $xml = '<response approved=1 />';
  $xml = '<response approved=0 />';

echo $xml;
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)


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 07:01:34 2024 UTC