Closing connection using TLS
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- php
- Lĩnh vực
- networking
Hướng nghiên cứu
Start in src/Connection.php around the shutdown logic referenced by the issue, then reproduce the provided TLS server example. Compare the proposed fclose and stream_socket_enable_crypto approaches against PHP's TLS shutdown behavior; done means closing the connection cleanly without the current TLS shutdown problem.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
When closing a connection on a server using TLS, eg:
<?php
require __DIR__ . '/vendor/autoload.php';
$server = new React\Socket\TcpServer($port = 9900);
$server = new React\Socket\SecureServer($server, null, [
'local_cert' => 'server.pem',
'passphrase' => 'secret'
]);
$server->on('connection', function (React\Socket\ConnectionInterface $connection) {
echo '[' . $connection->getRemoteAddress() . ' connected]' . PHP_EOL;
// do stuff
$connection->end();
});
the connection is not closed properly, as https://github.com/reactphp/socket/blob/e04478a14b22c2f85697b917dcc26fa8f1654098/src/Connection.php#L123-L133
uses https://www.php.net/manual/en/function.stream-socket-shutdown.php.
Note comment https://www.php.net/manual/en/function.stream-socket-shutdown.php#125659 which states tls does not get shut down properly that way.
Solution seems to be to replace @\stream_socket_shutdown($this->stream, \STREAM_SHUT_RDWR); with \fclose($this->stream).
Other solution seems to be to call @\stream_socket_enable_crypto($this->stream, false); before the socket shutdown as mentioned in comment https://www.php.net/manual/en/function.stream-socket-shutdown.php#126303
- Ngôn ngữ chính
- PHP
- Star
- 1.3k
- Fork
- 160
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của reactphp/socket
-
question
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
-
Roadmap to reactphp/socket v3 Đang mởmaintenance
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
-
help wanted new feature
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
-
Auto-generate server certs Đang mởhelp wanted new feature
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
-
Support STARTTLS Đang mởhelp wanted new feature
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
Tất cả issue của reactphp/socket
Issue tương tự
-
Admissions heading updates Đang mởa11y admissions.uiowa.edu needs grooming SiteImprove best practice
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Save States Menu Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Error on exporting the error log Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
pluginsGLPI/datainjection#673 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
octobercms/october#6130 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
getgrav/grav-plugin-form#656 ·