I try to download images from some remote urls via regular GET-request. But for the some urls corrupted images with truncated contents are retrieved. Content length header in response does not correspond to recieved data length.

The problem is in line 1635 http_send_request():
$alive = !$info['eof'] && !feof($r) && !$info['timed_out'] && strlen($chunk);
So case of fread() returns empty data indicates the end of a stream in current realization. But in practice it is not correct, empty data does not mean end of stream (or dead socket). Following fread() calls return remained data.

So may be the last condition is not neccessary?

Comments

StrVL created an issue. See original summary.

StrVL’s picture

Patch for 7.x-1.14.

StrVL’s picture

Status: Active » Needs work
mikeytown2’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.