Commit 05ecc277 authored by antoor's avatar antoor

Update ignoreHTTPS features

更新忽略HTTPS证书功能(测试
parent 4248aecb
...@@ -596,6 +596,7 @@ Request.prototype.ca = function(cert){ ...@@ -596,6 +596,7 @@ Request.prototype.ca = function(cert){
*/ */
Request.prototype.ignoreHTTPS = function(ignore) { Request.prototype.ignoreHTTPS = function(ignore) {
this._ignoreHttps = !ignore; this._ignoreHttps = !ignore;
process.env.NODE_TLS_REJECT_UNAUTHORIZED = ignore ? '0' : undefined;
return this; return this;
}; };
...@@ -625,7 +626,10 @@ Request.prototype.request = function(){ ...@@ -625,7 +626,10 @@ Request.prototype.request = function(){
options.host = url.hostname; options.host = url.hostname;
options.ca = this._ca; options.ca = this._ca;
options.agent = this._agent; options.agent = this._agent;
options.requestCert = this._ignoreHttps; // 卧槽,设置了这么多选项都没用,不过还好解决了,先留着吧。。
// options.requestCert = this._ignoreHttps;
// options.strictSSL = false;
// options.rejectUnhauthorized = false;
// initiate request // initiate request
var mod = exports.protocols[url.protocol]; var mod = exports.protocols[url.protocol];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment