php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2929 connectopn_aborted
Submitted: 1999-12-07 09:21 UTC Modified: 1999-12-07 13:08 UTC
From: mattias at umc dot se Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.12 OS: FreeBSD
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mattias at umc dot se
New email:
PHP Version: OS:

 

 [1999-12-07 09:21 UTC] mattias at umc dot se
I can not get the connection_aborted() function to work properly,
without flushing the output buffer a couple of times first.

Snip 1. Reports the connection as aborted if you interrupt the page download with "stop". Behaves correctly.

<?
ignore_user_abort(1);

for($i=0; $i<7; $i++) {
  sleep(1);
  echo "$i<BR>";
  flush();
}


$fp = fopen("/tmp/conn.txt","a");
if(connection_aborted()) fputs($fp,"** the connection was aborted  **\n");
else fputs($fp,"** the connection was OK  **\n");
exit;

?>

Snip 2. Says that the connection is OK, even though I've hit the "stop" button on my browser.

<?
ignore_user_abort(1);

for($i=0; $i<7; $i++) {
  sleep(1);
  echo "$i<BR>";
  //  flush();
}


$fp = fopen("/tmp/conn.txt","a");
if(connection_aborted()) fputs($fp,"** the connection was aborted **\n");
else fputs($fp,"** the connection was OK  **\n");
exit;

?>



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-12-07 13:08 UTC] rasmus at cvs dot php dot net
Nothing can be done about this.  Apache buffers output and will not detect a disconnected socket until it tries to write to it.  So unless you fill up the buffer or call flush it has no way of knowing that the remote end has disconnected.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 03:02:51 2024 UTC