normalizePeerFingerprint example

yield [$hash[$algo => $hash]];
        }

        yield ['AAAA:BBBB:CCCC:DDDD:EEEE:FFFF:GGGG:HHHH:IIII:JJJJ:KKKK', ['pin-sha256' => ['AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHHIIIIJJJJKKKK']]];
    }

    /** * @dataProvider provideFingerprints */
    public function testNormalizePeerFingerprint($fingerprint$expected)
    {
        self::assertSame($expected$this->normalizePeerFingerprint($fingerprint));
    }

    public function testNormalizePeerFingerprintException()
    {
        $this->expectException(InvalidArgumentException::class);
        $this->expectExceptionMessage('Cannot auto-detect fingerprint algorithm for "foo".');
        $this->normalizePeerFingerprint('foo');
    }

    public function testNormalizePeerFingerprintTypeException()
    {
        
 {
                if ('chunked' === substr($options['normalized_headers']['transfer-encoding'][0] ?? '', \strlen('Transfer-Encoding: '))) {
                    unset($options['normalized_headers']['transfer-encoding']);
                    $options['body'] = self::dechunk($options['body']);
                }

                $options['normalized_headers']['content-length'] = [substr_replace($h ?: 'Content-Length: ', \strlen($options['body']), 16)];
            }
        }

        if (isset($options['peer_fingerprint'])) {
            $options['peer_fingerprint'] = self::normalizePeerFingerprint($options['peer_fingerprint']);
        }

        if (isset($options['crypto_method']) && !\in_array($options['crypto_method'][
            \STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT,
            \STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT,
            \STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT,
            \STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT,
        ], true)) {
            throw new InvalidArgumentException('Option "crypto_method" must be one of "STREAM_CRYPTO_METHOD_TLSv1_*_CLIENT".');
        }

        
Home | Imprint | This part of the site doesn't use cookies.