Merge branch 'no-connect' into develop
This commit is contained in:
Коммит
d03056ab77
|
@ -37,6 +37,8 @@ proxy:
|
|||
pac:
|
||||
# PAC server listen port.
|
||||
port: 55155
|
||||
# Whether or not to tunnel SSL traffic.
|
||||
tunnelSsl: false
|
||||
|
||||
|
||||
# Plugin settings below.
|
||||
|
|
20
lib/pac.js
20
lib/pac.js
|
@ -5,6 +5,18 @@ var util = require('util');
|
|||
var http = require('http');
|
||||
var log = require('./log');
|
||||
|
||||
var PAC_TUNNEL_HTTPS = 'function FindProxyForURL(url, host) {\n' +
|
||||
' return "HTTPS %s:%d";\n' +
|
||||
'}\n';
|
||||
|
||||
var PAC_NO_TUNNEL = 'function FindProxyForURL(url, host) {\n' +
|
||||
' if (url.substring(0, 6) == "https:") {\n' +
|
||||
' return "DIRECT";\n' +
|
||||
' } else {\n' +
|
||||
' return "HTTPS %s:%d";\n' +
|
||||
' }\n' +
|
||||
'}\n';
|
||||
|
||||
// Default PAC server.
|
||||
var PacServer = function(options) {
|
||||
|
||||
|
@ -16,9 +28,11 @@ var PacServer = function(options) {
|
|||
function handleRequest(request, response) {
|
||||
|
||||
function createPacFile(host, port) {
|
||||
var pac = 'function FindProxyForURL(url, host) {\n' +
|
||||
' return "HTTPS ' + host + ':' + port + '";\n}';
|
||||
return pac;
|
||||
if (options.pac.tunnelSsl) {
|
||||
return util.format(PAC_TUNNEL_HTTPS, host, port);
|
||||
} else {
|
||||
return util.format(PAC_NO_TUNNEL, host, port);
|
||||
}
|
||||
}
|
||||
|
||||
var httpOpts = {
|
||||
|
|
Загрузка…
Ссылка в новой задаче