Skip to content

Commit 6636c00

Browse files
bastnicjoelwurtz
authored andcommitted
TLS v1 is not accepted anymore
I got errors like that all the time since the servers I contact updated their lib. > OpenSSL Error messages: error:1409442E:SSL routines:SSL3_READ_BYTES:tlsv1 alert protocol version
1 parent 4a1b34a commit 6636c00

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Client implements HttpClient
3232
'stream_context_param' => [],
3333
'ssl' => null,
3434
'write_buffer_size' => 8192,
35-
'ssl_method' => STREAM_CRYPTO_METHOD_TLS_CLIENT,
35+
'ssl_method' => STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT,
3636
];
3737

3838
/**
@@ -47,7 +47,7 @@ class Client implements HttpClient
4747
* @var array $stream_context_param Context params as defined in the PHP documentation
4848
* @var bool $ssl Use ssl, default to scheme from request, false if not present
4949
* @var int $write_buffer_size Buffer when writing the request body, defaults to 8192
50-
* @var int $ssl_method Crypto method for ssl/tls, see PHP doc, defaults to STREAM_CRYPTO_METHOD_TLS_CLIENT
50+
* @var int $ssl_method Crypto method for ssl/tls, see PHP doc, defaults to STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT
5151
* }
5252
*/
5353
public function __construct(ResponseFactory $responseFactory = null, array $config = [])

tests/server/tcp-ssl-server-client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
$client = stream_socket_accept($socketServer);
1717
stream_set_blocking($client, true);
18-
stream_socket_enable_crypto($client, true, STREAM_CRYPTO_METHOD_TLS_SERVER);
18+
stream_socket_enable_crypto($client, true, STREAM_CRYPTO_METHOD_TLSv1_2_SERVER);
1919

2020
// Verify client certificate
2121
$name = null;

tests/server/tcp-ssl-server.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
$client = stream_socket_accept($socketServer);
1515
stream_set_blocking($client, true);
16-
if (@stream_socket_enable_crypto($client, true, STREAM_CRYPTO_METHOD_TLS_SERVER)) {
16+
if (@stream_socket_enable_crypto($client, true, STREAM_CRYPTO_METHOD_TLSv1_2_SERVER)) {
1717
fwrite($client, str_replace("\n", "\r\n", <<<EOR
1818
HTTP/1.1 200 OK
1919
Content-Type: text/plain

0 commit comments

Comments
 (0)