From 9ce3f0d462892eeb1980a9b68cc12bc9a8230bb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=8E=E8=B5=B7?= Date: Thu, 22 Sep 2016 10:44:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20https=20=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `upload` 和 `download` 会使用 `var http = opt.protocol === 'https:' ? require('https') : require('http');` 这样的语法判断引入的库 但是 `opt = _.parseUrl(url, opt);` 返回的没没有 `protocol` --- lib/util.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/util.js b/lib/util.js index 4b8e488..87db7e7 100644 --- a/lib/util.js +++ b/lib/util.js @@ -720,6 +720,7 @@ _.parseUrl = function(url, opt){ opt = opt || {}; url = Url.parse(url); var ssl = url.protocol === 'https:'; + opt.protocol = url.protocol; opt.host = opt.host || opt.hostname || ((ssl || url.protocol === 'http:') ? url.hostname : 'localhost');