Skip to content

Commit

Permalink
Merge pull request Binaryify#1787 from movefreechen/master
Browse files Browse the repository at this point in the history
update: 增加对带用户名密码的代理支持
  • Loading branch information
Binaryify authored Aug 20, 2023
2 parents 8913131 + 8c70630 commit 7f21fbc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion util/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,11 @@ const createRequest = (method, url, data = {}, options) => {
} else {
const purl = new URL(options.proxy)
if (purl.hostname) {
const agent = tunnel.httpsOverHttp({
const agent = tunnel[purl.protocol === 'https' ? 'httpsOverHttp' : 'httpOverHttp']({
proxy: {
host: purl.hostname,
port: purl.port || 80,
proxyAuth: purl.username && purl.password ? (purl.username + ':' + purl.password) : ''
},
})
settings.httpsAgent = agent
Expand Down

0 comments on commit 7f21fbc

Please sign in to comment.