Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1005 from piotr-cz/patch-4

When sending new requests to same URI, need to close connection first.
  • Loading branch information...
commit 4686e89787e3b70e806ae58078565df91b4472a4 2 parents 3264bbe + a7cc45d
@LouisLandry LouisLandry authored
Showing with 10 additions and 2 deletions.
  1. +10 −2 libraries/joomla/http/transport/socket.php
View
12 libraries/joomla/http/transport/socket.php
@@ -224,9 +224,17 @@ protected function connect(JUri $uri, $timeout = null)
// If the connection already exists, use it.
if (!empty($this->connections[$key]) && is_resource($this->connections[$key]))
{
- // Make sure the connection has not timed out.
+ // Connection reached EOF, cannot be used anymore
$meta = stream_get_meta_data($this->connections[$key]);
- if (!$meta['timed_out'])
+ if ($meta['eof'])
+ {
+ if (!fclose($this->connections[$key]))
+ {
+ throw new RuntimeException('Cannot close connection');
+ }
+ }
+ // Make sure the connection has not timed out.
+ elseif (!$meta['timed_out'])
{
return $this->connections[$key];
}
Please sign in to comment.
Something went wrong with that request. Please try again.