douzhang6496 2014-06-26 07:06
浏览 23

重用https连接libcurl(PHP)

I have a server A and multiple servers that are behind in a local network with the server A (Server A has connection outside)

Server A has a webpage that does multiple ajax request to a script like this

  //Get myserverB_IP from database
  ...
  $url = "https://myserverB_IP/someurl.php"  
  $ch = curl_init();
  curl_setopt($ch,CURL_VERSION_SSL,TRUE);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
  curl_setopt($ch, CURLOPT_FRESH_CONNECT, false);
  curl_setopt ($ch, CURLOPT_TIMEOUT,30);
  curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/sess.txt');
  curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/sess.txt');
  curl_exec($ch);
  ... 

With http, everything worked fine, but when adding https there is a big delay because every single ajax call requests a new key exchange to the serverB

There is any way to reuse the connection to avoid the key exchange in every request ?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 对于这个问题的解释说明
    • ¥200 询问:python实现大地主题正反算的程序设计,有偿
    • ¥15 smptlib使用465端口发送邮件失败
    • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
    • ¥15 对于squad数据集的基于bert模型的微调
    • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
    • ¥20 steam下载游戏占用内存
    • ¥15 CST保存项目时失败
    • ¥15 树莓派5怎么用camera module 3啊
    • ¥20 java在应用程序里获取不到扬声器设备