Sto scrivendo un client php multithread che fa una richiesta https a un proxy inverso di Apache e misura alcune statistiche. Sto scrivendo una tesi di laurea sul miglioramento delle prestazioni con la ripresa della sessione TLS. Ora ho bisogno di fare una dimostrazione del concetto che lo dimostri/lo smentisca. Al momento ho questo codice:TLS Session Ripr. In php
$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);
questo codice funziona per fare una stretta di mano piena, ma io non riesco a capire come fare una stretta di mano ripreso in php?
Qualsiasi aiuto sarebbe molto apprezzato!
... o smentisce. :) – bishop
file_get_contents() chiude la connessione TCP immediatamente dopo la richiesta ... di solito. Ha bisogno di intestazioni di connessione keep-alive e fopen() con un handle ... Purtroppo non ho abbastanza tempo per indagare in questo momento: -/ – bwoebi