zendframework / zend-http

Http component from Zend Framework
BSD 3-Clause "New" or "Revised" License
134 stars 85 forks source link

Avoid opening output stream twice #122

Closed mlocati closed 6 years ago

mlocati commented 7 years ago

When we set the outputstream option, the output file gets opened twice: here and here.

The second handle can be managed (eg closed) by accessing the Zend\Http\Response\Stream\getStream() method, but the first handle is simply lost: the file remains open (ie locked) until the end of the execution of the PHP script.

Let's reuse the first file handle.

mlocati commented 7 years ago

I updated this PR by adding a test to check that we can delete the downloaded file (previously this assertion would have failed on Windows).

weierophinney commented 6 years ago

Thanks, @mlocati.