diff --git a/httprl.module b/httprl.module
index 3d9b5be..d5bb09b 100644
--- a/httprl.module
+++ b/httprl.module
@@ -428,8 +428,6 @@ function httprl_send_request($fp = NULL, $url = '', $request = '', $options = ''
           $rw_done = TRUE;
         }
         $responses[$id]->data .= $chunk;
-        // Get stream data.
-        $info = stream_get_meta_data($r);
 
         // Process the headers if we have some data.
         if (!empty($responses[$id]->data) && empty($responses[$id]->headers) &&
@@ -453,7 +451,9 @@ function httprl_send_request($fp = NULL, $url = '', $request = '', $options = ''
           }
         }
 
-        $alive = !$info['eof'] && !$info['timed_out'] && strlen($chunk);
+        // Get stream data.
+        $info = stream_get_meta_data($r);
+        $alive = !$info['eof'] && !feof($r) && !$info['timed_out'] && strlen($chunk);
         if (!$alive) {
           if ($responses[$id]->status == 'in progress') {
             $responses[$id]->status = 'Failed to connect.';
