Commit c80a5526 authored by antoor's avatar antoor

Add ignore-https switch

增加忽略HTTPS证书选项
parent 05ecc277
...@@ -91,15 +91,17 @@ class Request { ...@@ -91,15 +91,17 @@ class Request {
* @return {[type]} [description] * @return {[type]} [description]
*/ */
onRequest(event, opts) { onRequest(event, opts) {
logger.debug('onRequest::opts', opts);
logger.debug('onRequest::url', opts['url']);
logger.debug('onRequest::data', opts['data']);
superagent superagent
.post(opts['url']) .post(opts['url'])
.set('User-Agent', USER_AGENT) .set('User-Agent', USER_AGENT)
.proxy(APROXY_CONF['uri']) .proxy(APROXY_CONF['uri'])
.type('form') .type('form')
// 超时
.timeout(REQ_TIMEOUT) .timeout(REQ_TIMEOUT)
// 忽略HTTPS
.ignoreHTTPS(opts['ignoreHTTPS'])
.send(opts['data']) .send(opts['data'])
.parse((res, callback) => { .parse((res, callback) => {
this.parse(opts['tag_s'], opts['tag_e'], (chunk) => { this.parse(opts['tag_s'], opts['tag_e'], (chunk) => {
...@@ -145,6 +147,8 @@ class Request { ...@@ -145,6 +147,8 @@ class Request {
.type('form') .type('form')
// 设置超时会导致文件过大时写入出错 // 设置超时会导致文件过大时写入出错
// .timeout(timeout) // .timeout(timeout)
// 忽略HTTPS
.ignoreHTTPS(opts['ignoreHTTPS'])
.send(opts['data']) .send(opts['data'])
.pipe(through( .pipe(through(
(chunk) => { (chunk) => {
......
...@@ -215,7 +215,8 @@ class Base { ...@@ -215,7 +215,8 @@ class Base {
data: opt['data'], data: opt['data'],
tag_s: opt['tag_s'], tag_s: opt['tag_s'],
tag_e: opt['tag_e'], tag_e: opt['tag_e'],
encode: this.__opts__['encode'] encode: this.__opts__['encode'],
ignoreHTTPS: (this.__opts__['otherConf'] || {})['ignore-https'] === 1
}); });
}) })
} }
......
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