[fix] proxying to https

This commit is contained in:
yawnt 2013-09-15 13:06:39 +02:00
parent 3c91ed3d26
commit 26c4c43a06
2 changed files with 3 additions and 3 deletions

View File

@ -86,14 +86,14 @@ function XHeaders(req, res, options) {
function stream(req, res, options) {
if(options.forward) {
var forwardReq = (options.ssl ? https : http).request(
var forwardReq = (options.target.protocol === 'https:' ? https : http).request(
common.setupOutgoing(options.ssl || {}, options, req, 'forward')
);
req.pipe(forwardReq);
return res.end();
}
var proxyReq = (options.ssl ? https : http).request(
var proxyReq = (options.target.protocol === 'https:' ? https : http).request(
common.setupOutgoing(options.ssl || {}, options, req)
);

View File

@ -74,7 +74,7 @@ function XHeaders(req, socket, options) {
*/
function stream(req, socket, options, head) {
common.setupSocket(socket);
console.log(options.target.protocol);
var proxyReq = (~['https:', 'wss:'].indexOf(options.target.protocol) ? https : http).request(
common.setupOutgoing(options.ssl || {}, options, req)
);