Version 4.7.6

This commit is contained in:
Neo committed 2025-12-19 16:05:19 -08:00
1 parent 8ba7d43898
commit 7b7404e741
1085 files changed
+30590 -7837

No files matched your search

+15 -15
View File
@@ -9,7 +9,7 @@
*/
namespace IPS\Http\Request;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
@@ -41,7 +41,7 @@ class _Sockets
* @brief Timeout
*/
protected $timeout = 5;
/**
* @brief Headers
*/
@@ -56,7 +56,7 @@ class _Sockets
* @brief Allowed protocols
*/
protected $allowedProtocols = array();
/**
* Contructor
*
@@ -75,7 +75,7 @@ class _Sockets
$this->timeout = $timeout;
$this->followRedirects = $followRedirects;
$this->allowedProtocols = $allowedProtocols ?: array( 'http', 'https', 'ftp', 'scp', 'sftp', 'ftps' );
/* Set our basic settings */
stream_context_set_option( $this->context, array(
'http' => array(
@@ -103,7 +103,7 @@ class _Sockets
$this->setHeaders( array( 'Authorization' => 'Basic ' . base64_encode( "{$username}:{$password}" ) ) );
return $this;
}
/**
* Set Headers
*
@@ -112,10 +112,10 @@ class _Sockets
*/
public function setHeaders( $headers )
{
$this->headers = array_merge( $this->headers, $headers );
$this->headers = array_merge( $this->headers, $headers );
return $this;
}
/**
* Toggle SSL checks
*
@@ -133,7 +133,7 @@ class _Sockets
return $this;
}
/**
* Force TLS
*
@@ -142,7 +142,7 @@ class _Sockets
public function forceTls()
{
if ( \defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT') )
{
{
stream_context_set_option( $this->context, array(
'ssl' => array(
'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT
@@ -150,14 +150,14 @@ class _Sockets
) );
}
elseif ( \defined('STREAM_CRYPTO_METHOD_TLS_CLIENT') )
{
{
stream_context_set_option( $this->context, array(
'ssl' => array(
'crypto_method' => STREAM_CRYPTO_METHOD_TLS_CLIENT
)
) );
}
return $this;
}
@@ -212,7 +212,7 @@ class _Sockets
{
$resource = stream_socket_client( $hostname, $errno, $errstr, $this->timeout, \STREAM_CLIENT_CONNECT, $this->context );
}
/* Catch issues that may arise, such as DNS failure */
/* Catch issues that may arise, such as DNS failure */
catch( \ErrorException $e )
{
throw new SocketsException( $e->getMessage(), $e->getCode() );
@@ -248,7 +248,7 @@ class _Sockets
}
\fwrite( $resource, $request );
/* Read response */
stream_set_timeout( $resource, $this->timeout );
$status = stream_get_meta_data( $resource );
@@ -259,10 +259,10 @@ class _Sockets
$response .= \fgets( $resource, 8192 );
$status = stream_get_meta_data( $resource );
}
/* Close connection */
\fclose( $resource );
/* Log - but because the output can be large, only do this if we explicitly have debug logging enabled */
if ( \defined('\IPS\DEBUG_LOG') and \IPS\DEBUG_LOG )
{