php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57793 http_send_file
Submitted: 2007-08-20 16:57 UTC Modified: 2014-07-10 14:52 UTC
From: phpbug at darkbeer dot org Assigned: mike (profile)
Status: Wont fix Package: pecl_http (PECL)
PHP Version: 4.4.5 OS: FreeBSD
Private report: No CVE-ID: None
 [2007-08-20 16:57 UTC] phpbug at darkbeer dot org
Description:
------------
http_send_file returns 1 even when a stream has been interrupted.

Reproduce code:
---------------
Just http_send_file any large file and hit stop, it will return 1.

Expected result:
----------------
Well, for http_send_file I would expect it to return 1 on successfully sending the entire file _or_ successfully sending an entire range request. For http_send_data I would expect a 1 for successfully sending any random amount of data.

It's current operation makes it impossible to tell when a completely sucessful request has been completed.  This is important for something like a download counter for instance which is probably one of the largest reasons you would send a file through php and not statically serve it.

I would suggest keeping it's current operation and add a flag to change the meaning of the return value.  And as a purely 'feature-request' another flag to return an array of bytes-requested (0 for all) and the 2nd value being bytes sent, and a final flag for just bytes-sent.

Feel free to file this as a feature-request but I do honestly belive it to be a bug.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-21 04:00 UTC] mike@php.net
It would mean a rewrite of major parts of the code, due to the current implementation. Something for 2.0.
 [2007-08-21 19:43 UTC] phpbug at darkbeer dot org
Fair enough, I didn't look at the code to see if I could do it myself, if it's going to require rewriting parts of the code then I'll just settle with avidly waiting for 2.0.  I'll keep tabs though and may bother you in the future about this.  Thanks for the prompt response!
 [2014-07-10 14:52 UTC] mike@php.net
-Status: Suspended +Status: Wont fix
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 11:01:30 2024 UTC