diff --git a/composer.json b/composer.json index 3a7e00ba..32deb3f2 100755 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "description" : "HTTP protocol support for the XP Framework", "keywords": ["module", "xp"], "require" : { - "xp-framework/core": "^12.0 | ^11.0 | ^10.0", + "xp-framework/core": "^12.11 | ^11.11", "xp-framework/logging": "^11.0 | ^10.0", "xp-framework/networking": "^11.0 | ^10.0 | ^9.3", "php" : ">=7.4.0" diff --git a/src/main/php/peer/http/CurlHttpTransport.class.php b/src/main/php/peer/http/CurlHttpTransport.class.php index 45cf3531..94342ccd 100755 --- a/src/main/php/peer/http/CurlHttpTransport.class.php +++ b/src/main/php/peer/http/CurlHttpTransport.class.php @@ -1,6 +1,6 @@ close(); @@ -98,7 +98,7 @@ public function finish($stream) { $error= curl_errno($stream->handle); $message= curl_error($stream->handle); curl_close($stream->handle); - throw new IOException($error.' '.$message); + throw new OperationFailed($error.' '.$message); } // Strip "HTTP/x.x 200 Connection established" which is followed by @@ -120,7 +120,7 @@ public function finish($stream) { * @param int $timeout default 60 * @param float $connecttimeout default 2.0 * @return peer.http.HttpResponse response object - * @throws io.IOException + * @throws io.OperationFailed */ public function send(HttpRequest $request, $timeout= 60, $connecttimeout= 2.0) { static $versions= [ @@ -176,7 +176,7 @@ public function send(HttpRequest $request, $timeout= 60, $connecttimeout= 2.0) { $errno= curl_errno($handle); $error= curl_error($handle); curl_close($handle); - throw new \io\IOException(sprintf('%d: %s', $errno, $error)); + throw new \io\OperationFailed(sprintf('%d: %s', $errno, $error)); } // ensure handle is closed curl_close($handle); diff --git a/src/main/php/peer/http/HttpConnection.class.php b/src/main/php/peer/http/HttpConnection.class.php index 7d5fed59..82dd08f4 100755 --- a/src/main/php/peer/http/HttpConnection.class.php +++ b/src/main/php/peer/http/HttpConnection.class.php @@ -177,7 +177,7 @@ public function create(HttpRequest $r) { * @param var $parameters * @param [:string] $headers default array() * @return peer.http.HttpResponse response object - * @throws io.IOException + * @throws io.OperationFailed */ public function request($method, $parameters= null, $headers= []) { $r= new HttpRequest($this->url); diff --git a/src/main/php/peer/http/HttpResponse.class.php b/src/main/php/peer/http/HttpResponse.class.php index 1ee04118..edf52b6f 100755 --- a/src/main/php/peer/http/HttpResponse.class.php +++ b/src/main/php/peer/http/HttpResponse.class.php @@ -148,7 +148,7 @@ public function readData($size= 8192) { if (!($indicator= $this->scanUntil("\n"))) return $this->closeStream(); if (!(sscanf($indicator, "%x%s\r", $chunksize, $extension))) { $this->closeStream(); - throw new \io\IOException(sprintf( + throw new \io\OperationFailed(sprintf( 'Chunked transfer encoding: Indicator line "%s" invalid', addcslashes($indicator, "\0..\17") )); diff --git a/src/main/php/peer/http/SSLSocketHttpTransport.class.php b/src/main/php/peer/http/SSLSocketHttpTransport.class.php index c879790f..9a053831 100755 --- a/src/main/php/peer/http/SSLSocketHttpTransport.class.php +++ b/src/main/php/peer/http/SSLSocketHttpTransport.class.php @@ -1,6 +1,6 @@ read(); if (4 !== ($r= sscanf($handshake, "HTTP/%*d.%*d %d %[^\r]", $status, $message))) { - throw new IOException('Proxy did not answer with valid HTTP: '.$handshake); + throw new OperationFailed('Proxy did not answer with valid HTTP: '.$handshake); } // Verify proxy answers with a 200 status code while ($line= $s->readLine()) $handshake.= $line."\n"; $this->cat && $this->cat->info('<<<', $handshake); if (200 !== $status) { - throw new IOException('Cannot connect through proxy: #'.$status.' '.$message); + throw new OperationFailed('Cannot connect through proxy: #'.$status.' '.$message); } // Enable cryptography @@ -87,7 +87,7 @@ protected function proxy($s, $request, $url) { foreach (self::$crypto as $name => $flag) { if ($flag === $this->socket->cryptoImpl & $flag) $methods.= ', '.$name; } - throw new IOException('Cannot establish secure connection, tried '.substr($methods, 2)); + throw new OperationFailed('Cannot establish secure connection, tried '.substr($methods, 2)); } $this->cat && $this->cat->debug('@@@ Enabled cryptography: '.Objects::stringOf(stream_get_meta_data($s->getHandle())['crypto']));