Comparing version 3.2.0-beta5 to 3.2.1
@@ -50,5 +50,3 @@ 'use strict'; | ||
hash : u.hash, | ||
host : u.host, | ||
hostname : u.hostname, | ||
port : u.port, | ||
protocol : u.protocol, | ||
@@ -68,4 +66,5 @@ path : u.pathname, | ||
urlobj.path = sockarr[1]; | ||
delete urlobj.host; | ||
delete urlobj.port; | ||
} else { | ||
urlobj.host = u.host; | ||
urlobj.port = u.port; | ||
} | ||
@@ -541,48 +540,2 @@ | ||
/** | ||
* 快速代理模式要求你传递解析后的url对象以及其他选项,选项值参考http模块的request接口。 | ||
* 代理模式仅仅是提供了一个双向的数据传输管道。你要通过writeto传递一个可写的流,在web中就是response。 | ||
* | ||
* request --------> proxy ----> backend server | ||
* [readfrom] | ||
* | ||
* response <-------- proxy <---- backend server | ||
* [writeto] | ||
* | ||
*/ | ||
gohttp.prototype.fastproxy = function (url, readfrom, writeto, autoend = true) { | ||
let h = (opts.protocol === 'https:') ? https : http; | ||
return new Promise((rv, rj) => { | ||
let r = h.request(opts, (res) => { | ||
res.on('data', chunk => { | ||
writeto.write(chunk); | ||
}); | ||
res.on('end', () => { | ||
if (autoend) { | ||
writeto.end(); | ||
} | ||
rv(true); | ||
}); | ||
res.on('error', err => { | ||
rj(err); | ||
}); | ||
}); | ||
readfrom.on('data', chunk => { | ||
r.write(chunk); | ||
}); | ||
readfrom.on('end', () => { | ||
r.end(); | ||
}); | ||
}); | ||
}; | ||
module.exports = new gohttp(); | ||
@@ -589,0 +542,0 @@ |
{ | ||
"name": "gohttp", | ||
"version": "3.2.0-beta5", | ||
"version": "3.2.1", | ||
"description": "http client for HTTP/1.1", | ||
@@ -5,0 +5,0 @@ "main": "gohttp.js", |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
66390
1083