guzzle / psr7

PSR-7 HTTP message library
MIT License
7.86k stars 2 forks source link

Make a request with a popen() stream will fail #155

Closed iget-master closed 3 years ago

iget-master commented 7 years ago

This is duplicate of #79 because it's out of attention. There is a fix proposed on slimphp/Slim#1838 that solves this issue.

The steps to reproduce the bug is:

$stream = popen('ls', 'r'); $guzzleClient->post('http://someurl.com/', [ 'headers' => [ 'content-type' => 'application/octet-stream'], 'body' => $stream ];

The http request will be made before the ls process run since guzzle http detects the size as zero, ignoring the fact of it being a pipe (pipes always will read zero, but can be detected by reading the fstat()['mode'].

If you guys agree, I can do a PR to solve this, but I need a confirmation that this idea is valid to don't waste time.

This issue is affecting the spatie/dropbox-api and some other projects, forcing me to read the stream to a string (using too much memory)

iget-master commented 6 years ago

Could someone help here? This issue is stopped for half year!

Tobion commented 6 years ago

Looks like a valid use-case that should be supported. I'd gladly see a PR.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 2 weeks if no further activity occurs. Thank you for your contributions.