diff --git a/httprl.module b/httprl.module index b72a251..ef51c6c 100644 --- a/httprl.module +++ b/httprl.module @@ -955,11 +955,8 @@ function httprl_send_request($results = NULL) { foreach ($responses as $id => &$result) { if (!empty($result->error)) { $result->status = 'Connection not made.'; - // Copy the result to the output array. - if (isset($result->url)) { - $output[$result->url] = $result; - } - unset($responses[$id]); + // Do post processing on the stream. + httprl_post_processing($id, $responses, $output); continue; } @@ -1055,13 +1052,10 @@ function httprl_send_request($results = NULL) { } } - // Connection was handled elsewhere. Copy to output and remove. + // Connection was handled elsewhere. if (!isset($result->fp) && $result->status != 'in progress') { - // Copy the result to the output array. - if (isset($result->url)) { - $output[$result->url] = $result; - } - unset($responses[$id]); + // Do post processing on the stream. + httprl_post_processing($id, $responses, $output); } // Set the connection limits for this run. @@ -1091,11 +1085,8 @@ function httprl_send_request($results = NULL) { // If connection can not be established bail out here. if (!$result->fp) { - // Copy the result to the output array. - if (isset($result->url)) { - $output[$result->url] = $result; - } - unset($responses[$id]); + // Do post processing on the stream. + httprl_post_processing($id, $responses, $output); $domain_connection_count[$host]--; $global_connection_count--; continue;