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 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?
    • ¥15 matlab(相关搜索:紧聚焦)
    • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
    • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
    • ¥50 需求一个up主付费课程
    • ¥20 模型在y分布之外的数据上预测能力不好如何解决