yii\httpclient\Client SSL verification behavior across transports
23K reputation · 07 Jan 2025, 07:17 UTC
The yii\httpclient\Client provides a unified interface for making HTTP requests, utilizing either cURL or stream transports depending on the environment and configuration. By default, the client performs SSL peer verification to ensure the security of HTTPS connections.
While the verify option allows developers to toggle certificate checks, there is a potential discrepancy in how hostname validation is handled between the two transport layers. Specifically, the interaction between sslVerifyPeer and sslVerifyHost may vary depending on the underlying PHP version and the active transport mechanism.
This creates uncertainty when designing a security policy that must remain consistent regardless of whether the system defaults to cURL or streams.
- Does the
yii\httpclient\Clientguarantee identical hostname validation behavior when switching between cURL and stream transports? - In what specific scenarios does the stream transport ignore
sslVerifyHostsettings compared to the cURL transport?