1
PHP stream_socket_client를 통해 ssl 버텍스를 검사하는 클래스를 작성했습니다.php stream_socket_client timeout이 예상대로 작동하지 않습니다.
그러나 일부 사이트에서는 시간 초과가 작동하지 않습니다. 스크립트는 때때로 일부 호스트의 응답을 위해 최대 60 초를 기다립니다 (PHP 구성 제한 인 것처럼 보입니다).
(연결) 제한 시간을 2 초로 설정했기 때문에 혼란 스럽습니다. SSL 전송에 대한 최대 제한 시간/전송 시간을 줄이기 위해 설정할 수있는 다른 제한이 없습니다. 내가 사용할 수있는 다른 시간 제한이 있습니까?
$options = array(
"ssl" => array(
"capture_peer_cert" => true,
"capture_peer_chain" => true,
"capture_peer_cert_chain" => true,
"verify_peer" => $verify_peer,
"allow_self_signed" => $allow_self_signed)
);
if (strlen($this->cafile) > 0) {
$options['ssl']['cafile'] = $this->cafile;
if (strlen($this->capath) > 0 && [..]) {
$options['ssl']['capath'] = $this->capath;
}
} else {
$options['verify_peer'] = false;
}
$get = @stream_context_create($options);
$read = @stream_socket_client("ssl://$host:443", $errno, $errstr, 2, STREAM_CLIENT_CONNECT, $get);
if($read){
stream_set_timeout($read, 2);
$cert = stream_context_get_params($read);
} else {
$cert = false;
}