zoukankan      html  css  js  c++  java
  • Node.js使用https请求时,出现“SSL23_GET_SERVER_HELLO”错误

    Node.js程序改造成https请求,遇到了另外一个问题

    错误提示如下:

    SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure:../deps/openssl/openssl/ssl/s23_clnt.c:772
    

    经过排查错误发现是:Node.js版本太旧默认使用TLS1.1协议请求,解决这个问题有两种方法:

    1.手动指定成TLS1.2协议,secureProtocol参数设置成TLSv1_2_method

    var https = require('https');
    
    var options = {
      hostname: 'www.yourwebiste.com',
      port: 443,
      method: 'GET',
      path: '/validate',
      secureProtocol: 'TLSv1_2_method',
    };
    
    var req = https.request(options, function (res) {
      res.on('data', function (d) {
        process.stdout.write(d);
      });
    });
    req.end();
    
    req.on('error', function (e) {
      console.error(e);
    });
    

    2.升级Node.js到最新的稳定版本

  • 相关阅读:
    注册算法入门
    call传参之通过堆栈
    winhex注意
    输入字符串长度
    integer promotion
    网页flash兼容浏览器代码
    逆向工程——注册篇
    esp定律的一点说明
    base64
    意外
  • 原文地址:https://www.cnblogs.com/reggieqiao/p/13254788.html
Copyright © 2011-2022 走看看