私はApacheの逆プロキシにhttps要求を行い、いくつかの統計を測定するマルチスレッドPHPクライアントを作成しています。私は、TLSセッション再開でパフォーマンスを向上させることに関する学士論文を書いています。今私はそれを証明する/否定する概念の証明をする必要があります。私はこのコードを持っている現時点では:PHPでのTLSセッション再開
$this->synchronized(function($this){
$this->before = microtime(true);
}, $this);
$url = 'https://192.168.0.171/';
# Some dummy data
$data = array('name' => 'Nicolas', 'bank account' => '123462343');
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data)
),
"ssl" => array(
"verify_peer" => false,
"verify_peer_name" => false,
"ciphers" => "HIGH:!SSLv2:!SSLv3"
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
$this->synchronized(function($this){
$this->after = microtime(true);
}, $this);
$this->counter_group->write($this->before, $this->after, $result);
このコードは、完全なハンドシェイクを行うために動作しますが、私はPHPで再開ハンドシェイクを行う方法を見つけ出すように見えることはできませんか?
ご協力いただければ幸いです!
...またはその反対です。 :) – bishop
file_get_contents()はリクエストの直後にTCP接続を閉じます。通常は。キープアライブ接続ヘッダーが必要で、ハンドルを使ってfopen()が必要です...私は悲しいことに、今すぐ調査する時間がありません: -/ – bwoebi