stream_get_contents gets stuck on persistent (KeepAlive) connection
<p>stream_get_contents doesn't seem to handle persistent (KeepAlive) connections correctly. It waits for the connection to timeout before returning. Apache 2.2 has a KeepAliveTimeout of 5 seconds by default. Is there anything I can do about this? (Aside from disabling KeepAlive on the server, or using protocol_version 1.0)</p>

<pre><code>$opts = array('http' =&gt;
    array(
        'method' =&gt; 'GET',
        'protocol_version' =&gt; 1.1,
    )
);
$context = stream_context_create($opts);
$stream = fopen('http://google.com', 'r', false, $context);
$metadata = stream_get_meta_data($stream);
$data = stream_get_contents($stream);
fclose($stream);
</code></pre>

<p>Thanks.</p>
