postdoc 0.1.2 → 0.2.0.beta4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/pdf.js +27 -0
- data/lib/postdoc.rb +3 -7
- data/node_modules/agent-base/History.md +113 -0
- data/node_modules/agent-base/README.md +145 -0
- data/node_modules/agent-base/index.js +160 -0
- data/node_modules/agent-base/package.json +35 -0
- data/node_modules/agent-base/patch-core.js +37 -0
- data/node_modules/agent-base/test/ssl-cert-snakeoil.key +15 -0
- data/node_modules/agent-base/test/ssl-cert-snakeoil.pem +12 -0
- data/node_modules/agent-base/test/test.js +673 -0
- data/node_modules/async-limiter/LICENSE +8 -0
- data/node_modules/async-limiter/coverage/coverage.json +1 -0
- data/node_modules/async-limiter/coverage/lcov-report/async-throttle/index.html +73 -0
- data/node_modules/async-limiter/coverage/lcov-report/async-throttle/index.js.html +246 -0
- data/node_modules/async-limiter/coverage/lcov-report/base.css +182 -0
- data/node_modules/async-limiter/coverage/lcov-report/index.html +73 -0
- data/node_modules/async-limiter/coverage/lcov-report/prettify.css +1 -0
- data/node_modules/async-limiter/coverage/lcov-report/prettify.js +1 -0
- data/node_modules/async-limiter/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- data/node_modules/async-limiter/coverage/lcov-report/sorter.js +156 -0
- data/node_modules/async-limiter/coverage/lcov.info +74 -0
- data/node_modules/async-limiter/index.js +67 -0
- data/node_modules/async-limiter/package.json +35 -0
- data/node_modules/async-limiter/readme.md +132 -0
- data/node_modules/balanced-match/LICENSE.md +21 -0
- data/node_modules/balanced-match/README.md +91 -0
- data/node_modules/balanced-match/index.js +59 -0
- data/node_modules/balanced-match/package.json +49 -0
- data/node_modules/brace-expansion/LICENSE +21 -0
- data/node_modules/brace-expansion/README.md +129 -0
- data/node_modules/brace-expansion/index.js +201 -0
- data/node_modules/brace-expansion/package.json +47 -0
- data/node_modules/buffer-from/index.js +69 -0
- data/node_modules/buffer-from/package.json +16 -0
- data/node_modules/buffer-from/readme.md +69 -0
- data/node_modules/buffer-from/test.js +12 -0
- data/node_modules/concat-map/LICENSE +18 -0
- data/node_modules/concat-map/README.markdown +62 -0
- data/node_modules/concat-map/example/map.js +6 -0
- data/node_modules/concat-map/index.js +13 -0
- data/node_modules/concat-map/package.json +43 -0
- data/node_modules/concat-map/test/map.js +39 -0
- data/node_modules/concat-stream/LICENSE +24 -0
- data/node_modules/concat-stream/index.js +144 -0
- data/node_modules/concat-stream/package.json +55 -0
- data/node_modules/concat-stream/readme.md +102 -0
- data/node_modules/core-util-is/LICENSE +19 -0
- data/node_modules/core-util-is/README.md +3 -0
- data/node_modules/core-util-is/float.patch +604 -0
- data/node_modules/core-util-is/lib/util.js +107 -0
- data/node_modules/core-util-is/package.json +32 -0
- data/node_modules/core-util-is/test.js +68 -0
- data/node_modules/debug/CHANGELOG.md +395 -0
- data/node_modules/debug/LICENSE +19 -0
- data/node_modules/debug/Makefile +58 -0
- data/node_modules/debug/README.md +368 -0
- data/node_modules/debug/karma.conf.js +70 -0
- data/node_modules/debug/node.js +1 -0
- data/node_modules/debug/package.json +43 -0
- data/node_modules/debug/src/browser.js +195 -0
- data/node_modules/debug/src/debug.js +225 -0
- data/node_modules/debug/src/index.js +10 -0
- data/node_modules/debug/src/node.js +186 -0
- data/node_modules/es6-promise/CHANGELOG.md +151 -0
- data/node_modules/es6-promise/LICENSE +19 -0
- data/node_modules/es6-promise/README.md +97 -0
- data/node_modules/es6-promise/auto.js +4 -0
- data/node_modules/es6-promise/dist/es6-promise.auto.js +1181 -0
- data/node_modules/es6-promise/dist/es6-promise.auto.map +1 -0
- data/node_modules/es6-promise/dist/es6-promise.auto.min.js +1 -0
- data/node_modules/es6-promise/dist/es6-promise.auto.min.map +1 -0
- data/node_modules/es6-promise/dist/es6-promise.js +1179 -0
- data/node_modules/es6-promise/dist/es6-promise.map +1 -0
- data/node_modules/es6-promise/dist/es6-promise.min.js +1 -0
- data/node_modules/es6-promise/dist/es6-promise.min.map +1 -0
- data/node_modules/es6-promise/es6-promise.d.ts +81 -0
- data/node_modules/es6-promise/lib/es6-promise/-internal.js +266 -0
- data/node_modules/es6-promise/lib/es6-promise/asap.js +119 -0
- data/node_modules/es6-promise/lib/es6-promise/enumerator.js +113 -0
- data/node_modules/es6-promise/lib/es6-promise/polyfill.js +35 -0
- data/node_modules/es6-promise/lib/es6-promise/promise/all.js +52 -0
- data/node_modules/es6-promise/lib/es6-promise/promise/race.js +84 -0
- data/node_modules/es6-promise/lib/es6-promise/promise/reject.js +46 -0
- data/node_modules/es6-promise/lib/es6-promise/promise/resolve.js +48 -0
- data/node_modules/es6-promise/lib/es6-promise/promise.js +427 -0
- data/node_modules/es6-promise/lib/es6-promise/then.js +32 -0
- data/node_modules/es6-promise/lib/es6-promise/utils.js +21 -0
- data/node_modules/es6-promise/lib/es6-promise.auto.js +3 -0
- data/node_modules/es6-promise/lib/es6-promise.js +7 -0
- data/node_modules/es6-promise/package.json +75 -0
- data/node_modules/es6-promisify/README.md +89 -0
- data/node_modules/es6-promisify/dist/promise.js +73 -0
- data/node_modules/es6-promisify/dist/promisify.js +85 -0
- data/node_modules/es6-promisify/package.json +41 -0
- data/node_modules/extract-zip/CONTRIBUTING.md +1 -0
- data/node_modules/extract-zip/LICENSE +23 -0
- data/node_modules/extract-zip/cli.js +20 -0
- data/node_modules/extract-zip/index.js +205 -0
- data/node_modules/extract-zip/node_modules/debug/CHANGELOG.md +362 -0
- data/node_modules/extract-zip/node_modules/debug/LICENSE +19 -0
- data/node_modules/extract-zip/node_modules/debug/Makefile +50 -0
- data/node_modules/extract-zip/node_modules/debug/README.md +312 -0
- data/node_modules/extract-zip/node_modules/debug/component.json +19 -0
- data/node_modules/extract-zip/node_modules/debug/karma.conf.js +70 -0
- data/node_modules/extract-zip/node_modules/debug/node.js +1 -0
- data/node_modules/extract-zip/node_modules/debug/package.json +49 -0
- data/node_modules/extract-zip/node_modules/debug/src/browser.js +185 -0
- data/node_modules/extract-zip/node_modules/debug/src/debug.js +202 -0
- data/node_modules/extract-zip/node_modules/debug/src/index.js +10 -0
- data/node_modules/extract-zip/node_modules/debug/src/inspector-log.js +15 -0
- data/node_modules/extract-zip/node_modules/debug/src/node.js +248 -0
- data/node_modules/extract-zip/package.json +35 -0
- data/node_modules/extract-zip/readme.md +49 -0
- data/node_modules/fd-slicer/CHANGELOG.md +49 -0
- data/node_modules/fd-slicer/LICENSE +21 -0
- data/node_modules/fd-slicer/README.md +189 -0
- data/node_modules/fd-slicer/index.js +277 -0
- data/node_modules/fd-slicer/package.json +36 -0
- data/node_modules/fd-slicer/test/test.js +350 -0
- data/node_modules/fs.realpath/LICENSE +43 -0
- data/node_modules/fs.realpath/README.md +33 -0
- data/node_modules/fs.realpath/index.js +66 -0
- data/node_modules/fs.realpath/old.js +303 -0
- data/node_modules/fs.realpath/package.json +26 -0
- data/node_modules/glob/LICENSE +15 -0
- data/node_modules/glob/README.md +368 -0
- data/node_modules/glob/changelog.md +67 -0
- data/node_modules/glob/common.js +240 -0
- data/node_modules/glob/glob.js +790 -0
- data/node_modules/glob/package.json +43 -0
- data/node_modules/glob/sync.js +486 -0
- data/node_modules/https-proxy-agent/History.md +124 -0
- data/node_modules/https-proxy-agent/README.md +137 -0
- data/node_modules/https-proxy-agent/index.js +229 -0
- data/node_modules/https-proxy-agent/package.json +35 -0
- data/node_modules/https-proxy-agent/test/ssl-cert-snakeoil.key +15 -0
- data/node_modules/https-proxy-agent/test/ssl-cert-snakeoil.pem +12 -0
- data/node_modules/https-proxy-agent/test/test.js +342 -0
- data/node_modules/inflight/LICENSE +15 -0
- data/node_modules/inflight/README.md +37 -0
- data/node_modules/inflight/inflight.js +54 -0
- data/node_modules/inflight/package.json +29 -0
- data/node_modules/inherits/LICENSE +16 -0
- data/node_modules/inherits/README.md +42 -0
- data/node_modules/inherits/inherits.js +7 -0
- data/node_modules/inherits/inherits_browser.js +23 -0
- data/node_modules/inherits/package.json +29 -0
- data/node_modules/isarray/Makefile +6 -0
- data/node_modules/isarray/README.md +60 -0
- data/node_modules/isarray/component.json +19 -0
- data/node_modules/isarray/index.js +5 -0
- data/node_modules/isarray/package.json +45 -0
- data/node_modules/isarray/test.js +20 -0
- data/node_modules/mime/CHANGELOG.md +225 -0
- data/node_modules/mime/CONTRIBUTING.md +5 -0
- data/node_modules/mime/LICENSE +21 -0
- data/node_modules/mime/Mime.js +89 -0
- data/node_modules/mime/README.md +188 -0
- data/node_modules/mime/cli.js +10 -0
- data/node_modules/mime/index.js +4 -0
- data/node_modules/mime/lite.js +4 -0
- data/node_modules/mime/package.json +43 -0
- data/node_modules/mime/src/README_js.md +179 -0
- data/node_modules/mime/src/build.js +71 -0
- data/node_modules/mime/src/test.js +257 -0
- data/node_modules/mime/types/other.json +1 -0
- data/node_modules/mime/types/standard.json +1 -0
- data/node_modules/minimatch/LICENSE +15 -0
- data/node_modules/minimatch/README.md +209 -0
- data/node_modules/minimatch/minimatch.js +923 -0
- data/node_modules/minimatch/package.json +30 -0
- data/node_modules/minimist/LICENSE +18 -0
- data/node_modules/minimist/example/parse.js +2 -0
- data/node_modules/minimist/index.js +187 -0
- data/node_modules/minimist/package.json +40 -0
- data/node_modules/minimist/readme.markdown +73 -0
- data/node_modules/minimist/test/dash.js +24 -0
- data/node_modules/minimist/test/default_bool.js +20 -0
- data/node_modules/minimist/test/dotted.js +16 -0
- data/node_modules/minimist/test/long.js +31 -0
- data/node_modules/minimist/test/parse.js +318 -0
- data/node_modules/minimist/test/parse_modified.js +9 -0
- data/node_modules/minimist/test/short.js +67 -0
- data/node_modules/minimist/test/whitespace.js +8 -0
- data/node_modules/mkdirp/LICENSE +21 -0
- data/node_modules/mkdirp/bin/cmd.js +33 -0
- data/node_modules/mkdirp/bin/usage.txt +12 -0
- data/node_modules/mkdirp/examples/pow.js +6 -0
- data/node_modules/mkdirp/index.js +98 -0
- data/node_modules/mkdirp/package.json +27 -0
- data/node_modules/mkdirp/readme.markdown +100 -0
- data/node_modules/mkdirp/test/chmod.js +41 -0
- data/node_modules/mkdirp/test/clobber.js +38 -0
- data/node_modules/mkdirp/test/mkdirp.js +28 -0
- data/node_modules/mkdirp/test/opts_fs.js +29 -0
- data/node_modules/mkdirp/test/opts_fs_sync.js +27 -0
- data/node_modules/mkdirp/test/perm.js +32 -0
- data/node_modules/mkdirp/test/perm_sync.js +36 -0
- data/node_modules/mkdirp/test/race.js +37 -0
- data/node_modules/mkdirp/test/rel.js +32 -0
- data/node_modules/mkdirp/test/return.js +25 -0
- data/node_modules/mkdirp/test/return_sync.js +24 -0
- data/node_modules/mkdirp/test/root.js +19 -0
- data/node_modules/mkdirp/test/sync.js +32 -0
- data/node_modules/mkdirp/test/umask.js +28 -0
- data/node_modules/mkdirp/test/umask_sync.js +32 -0
- data/node_modules/ms/index.js +152 -0
- data/node_modules/ms/license.md +21 -0
- data/node_modules/ms/package.json +37 -0
- data/node_modules/ms/readme.md +51 -0
- data/node_modules/once/LICENSE +15 -0
- data/node_modules/once/README.md +79 -0
- data/node_modules/once/once.js +42 -0
- data/node_modules/once/package.json +33 -0
- data/node_modules/path-is-absolute/index.js +20 -0
- data/node_modules/path-is-absolute/license +21 -0
- data/node_modules/path-is-absolute/package.json +43 -0
- data/node_modules/path-is-absolute/readme.md +59 -0
- data/node_modules/pend/LICENSE +23 -0
- data/node_modules/pend/README.md +41 -0
- data/node_modules/pend/index.js +55 -0
- data/node_modules/pend/package.json +18 -0
- data/node_modules/pend/test.js +137 -0
- data/node_modules/process-nextick-args/index.js +44 -0
- data/node_modules/process-nextick-args/license.md +19 -0
- data/node_modules/process-nextick-args/package.json +25 -0
- data/node_modules/process-nextick-args/readme.md +18 -0
- data/node_modules/progress/CHANGELOG.md +115 -0
- data/node_modules/progress/LICENSE +22 -0
- data/node_modules/progress/Makefile +8 -0
- data/node_modules/progress/README.md +146 -0
- data/node_modules/progress/index.js +1 -0
- data/node_modules/progress/lib/node-progress.js +231 -0
- data/node_modules/progress/package.json +25 -0
- data/node_modules/proxy-from-env/README.md +131 -0
- data/node_modules/proxy-from-env/index.js +103 -0
- data/node_modules/proxy-from-env/package.json +35 -0
- data/node_modules/proxy-from-env/test.js +393 -0
- data/node_modules/puppeteer/CONTRIBUTING.md +206 -0
- data/node_modules/puppeteer/DeviceDescriptors.js +704 -0
- data/node_modules/puppeteer/LICENSE +202 -0
- data/node_modules/puppeteer/README.md +306 -0
- data/node_modules/puppeteer/index.js +28 -0
- data/node_modules/puppeteer/install.js +122 -0
- data/node_modules/puppeteer/lib/Browser.js +186 -0
- data/node_modules/puppeteer/lib/BrowserFetcher.js +279 -0
- data/node_modules/puppeteer/lib/Connection.js +246 -0
- data/node_modules/puppeteer/lib/Coverage.js +301 -0
- data/node_modules/puppeteer/lib/Dialog.js +84 -0
- data/node_modules/puppeteer/lib/ElementHandle.js +328 -0
- data/node_modules/puppeteer/lib/EmulationManager.js +89 -0
- data/node_modules/puppeteer/lib/ExecutionContext.js +232 -0
- data/node_modules/puppeteer/lib/FrameManager.js +997 -0
- data/node_modules/puppeteer/lib/Input.js +309 -0
- data/node_modules/puppeteer/lib/Launcher.js +310 -0
- data/node_modules/puppeteer/lib/Multimap.js +95 -0
- data/node_modules/puppeteer/lib/NavigatorWatcher.js +137 -0
- data/node_modules/puppeteer/lib/NetworkManager.js +796 -0
- data/node_modules/puppeteer/lib/Page.js +1098 -0
- data/node_modules/puppeteer/lib/Pipe.js +69 -0
- data/node_modules/puppeteer/lib/Puppeteer.js +60 -0
- data/node_modules/puppeteer/lib/Target.js +88 -0
- data/node_modules/puppeteer/lib/TaskQueue.js +17 -0
- data/node_modules/puppeteer/lib/Tracing.js +99 -0
- data/node_modules/puppeteer/lib/USKeyboardLayout.js +281 -0
- data/node_modules/puppeteer/lib/helper.js +248 -0
- data/node_modules/puppeteer/node6/lib/Browser.js +394 -0
- data/node_modules/puppeteer/node6/lib/BrowserFetcher.js +357 -0
- data/node_modules/puppeteer/node6/lib/Connection.js +350 -0
- data/node_modules/puppeteer/node6/lib/Coverage.js +561 -0
- data/node_modules/puppeteer/node6/lib/Dialog.js +136 -0
- data/node_modules/puppeteer/node6/lib/ElementHandle.js +796 -0
- data/node_modules/puppeteer/node6/lib/EmulationManager.js +115 -0
- data/node_modules/puppeteer/node6/lib/ExecutionContext.js +414 -0
- data/node_modules/puppeteer/node6/lib/FrameManager.js +1621 -0
- data/node_modules/puppeteer/node6/lib/Input.js +569 -0
- data/node_modules/puppeteer/node6/lib/Launcher.js +362 -0
- data/node_modules/puppeteer/node6/lib/Multimap.js +95 -0
- data/node_modules/puppeteer/node6/lib/NavigatorWatcher.js +163 -0
- data/node_modules/puppeteer/node6/lib/NetworkManager.js +1108 -0
- data/node_modules/puppeteer/node6/lib/Page.js +2242 -0
- data/node_modules/puppeteer/node6/lib/Pipe.js +69 -0
- data/node_modules/puppeteer/node6/lib/Puppeteer.js +60 -0
- data/node_modules/puppeteer/node6/lib/Target.js +114 -0
- data/node_modules/puppeteer/node6/lib/TaskQueue.js +17 -0
- data/node_modules/puppeteer/node6/lib/Tracing.js +177 -0
- data/node_modules/puppeteer/node6/lib/USKeyboardLayout.js +281 -0
- data/node_modules/puppeteer/node6/lib/helper.js +274 -0
- data/node_modules/puppeteer/package.json +61 -0
- data/node_modules/readable-stream/CONTRIBUTING.md +38 -0
- data/node_modules/readable-stream/GOVERNANCE.md +136 -0
- data/node_modules/readable-stream/LICENSE +47 -0
- data/node_modules/readable-stream/README.md +58 -0
- data/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +60 -0
- data/node_modules/readable-stream/duplex-browser.js +1 -0
- data/node_modules/readable-stream/duplex.js +1 -0
- data/node_modules/readable-stream/lib/_stream_duplex.js +131 -0
- data/node_modules/readable-stream/lib/_stream_passthrough.js +47 -0
- data/node_modules/readable-stream/lib/_stream_readable.js +1019 -0
- data/node_modules/readable-stream/lib/_stream_transform.js +214 -0
- data/node_modules/readable-stream/lib/_stream_writable.js +687 -0
- data/node_modules/readable-stream/lib/internal/streams/BufferList.js +79 -0
- data/node_modules/readable-stream/lib/internal/streams/destroy.js +74 -0
- data/node_modules/readable-stream/lib/internal/streams/stream-browser.js +1 -0
- data/node_modules/readable-stream/lib/internal/streams/stream.js +1 -0
- data/node_modules/readable-stream/package.json +52 -0
- data/node_modules/readable-stream/passthrough.js +1 -0
- data/node_modules/readable-stream/readable-browser.js +7 -0
- data/node_modules/readable-stream/readable.js +19 -0
- data/node_modules/readable-stream/transform.js +1 -0
- data/node_modules/readable-stream/writable-browser.js +1 -0
- data/node_modules/readable-stream/writable.js +8 -0
- data/node_modules/rimraf/LICENSE +15 -0
- data/node_modules/rimraf/README.md +101 -0
- data/node_modules/rimraf/bin.js +50 -0
- data/node_modules/rimraf/package.json +26 -0
- data/node_modules/rimraf/rimraf.js +364 -0
- data/node_modules/safe-buffer/LICENSE +21 -0
- data/node_modules/safe-buffer/README.md +584 -0
- data/node_modules/safe-buffer/index.d.ts +187 -0
- data/node_modules/safe-buffer/index.js +62 -0
- data/node_modules/safe-buffer/package.json +37 -0
- data/node_modules/string_decoder/LICENSE +48 -0
- data/node_modules/string_decoder/README.md +47 -0
- data/node_modules/string_decoder/lib/string_decoder.js +296 -0
- data/node_modules/string_decoder/package.json +31 -0
- data/node_modules/typedarray/LICENSE +35 -0
- data/node_modules/typedarray/example/tarray.js +4 -0
- data/node_modules/typedarray/index.js +630 -0
- data/node_modules/typedarray/package.json +55 -0
- data/node_modules/typedarray/readme.markdown +61 -0
- data/node_modules/typedarray/test/server/undef_globals.js +19 -0
- data/node_modules/typedarray/test/tarray.js +10 -0
- data/node_modules/ultron/LICENSE +22 -0
- data/node_modules/ultron/README.md +113 -0
- data/node_modules/ultron/index.js +136 -0
- data/node_modules/ultron/package.json +41 -0
- data/node_modules/util-deprecate/History.md +16 -0
- data/node_modules/util-deprecate/LICENSE +24 -0
- data/node_modules/util-deprecate/README.md +53 -0
- data/node_modules/util-deprecate/browser.js +67 -0
- data/node_modules/util-deprecate/node.js +6 -0
- data/node_modules/util-deprecate/package.json +27 -0
- data/node_modules/wrappy/LICENSE +15 -0
- data/node_modules/wrappy/README.md +36 -0
- data/node_modules/wrappy/package.json +29 -0
- data/node_modules/wrappy/wrappy.js +33 -0
- data/node_modules/ws/LICENSE +21 -0
- data/node_modules/ws/README.md +341 -0
- data/node_modules/ws/index.js +15 -0
- data/node_modules/ws/lib/BufferUtil.js +71 -0
- data/node_modules/ws/lib/Constants.js +10 -0
- data/node_modules/ws/lib/ErrorCodes.js +28 -0
- data/node_modules/ws/lib/EventTarget.js +151 -0
- data/node_modules/ws/lib/Extensions.js +203 -0
- data/node_modules/ws/lib/PerMessageDeflate.js +507 -0
- data/node_modules/ws/lib/Receiver.js +553 -0
- data/node_modules/ws/lib/Sender.js +412 -0
- data/node_modules/ws/lib/Validation.js +17 -0
- data/node_modules/ws/lib/WebSocket.js +717 -0
- data/node_modules/ws/lib/WebSocketServer.js +326 -0
- data/node_modules/ws/package.json +46 -0
- data/node_modules/yauzl/LICENSE +21 -0
- data/node_modules/yauzl/README.md +467 -0
- data/node_modules/yauzl/index.js +626 -0
- data/node_modules/yauzl/package.json +36 -0
- data/package.json +5 -0
- data/yarn.lock +240 -0
- metadata +372 -7
- data/app/assets/stylesheets/default.css +0 -4
- data/lib/postdoc/postdoc_view_helper.rb +0 -22
@@ -0,0 +1,131 @@
|
|
1
|
+
# proxy-from-env
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/Rob--W/proxy-from-env.svg?branch=master)](https://travis-ci.org/Rob--W/proxy-from-env)
|
4
|
+
[![Coverage Status](https://coveralls.io/repos/github/Rob--W/proxy-from-env/badge.svg?branch=master)](https://coveralls.io/github/Rob--W/proxy-from-env?branch=master)
|
5
|
+
|
6
|
+
`proxy-from-env` is a Node.js package that exports a function (`getProxyForUrl`)
|
7
|
+
that takes an input URL (a string or
|
8
|
+
[`url.parse`](https://nodejs.org/docs/latest/api/url.html#url_url_parsing)'s
|
9
|
+
return value) and returns the desired proxy URL (also a string) based on
|
10
|
+
standard proxy environment variables. If no proxy is set, an empty string is
|
11
|
+
returned.
|
12
|
+
|
13
|
+
It is your responsibility to actually proxy the request using the given URL.
|
14
|
+
|
15
|
+
Installation:
|
16
|
+
|
17
|
+
```sh
|
18
|
+
npm install proxy-from-env
|
19
|
+
```
|
20
|
+
|
21
|
+
## Example
|
22
|
+
This example shows how the data for a URL can be fetched via the
|
23
|
+
[`http` module](https://nodejs.org/api/http.html), in a proxy-aware way.
|
24
|
+
|
25
|
+
```javascript
|
26
|
+
var http = require('http');
|
27
|
+
var parseUrl = require('url').parse;
|
28
|
+
var getProxyForUrl = require('proxy-from-env').getProxyForUrl;
|
29
|
+
|
30
|
+
var some_url = 'http://example.com/something';
|
31
|
+
|
32
|
+
// // Example, if there is a proxy server at 10.0.0.1:1234, then setting the
|
33
|
+
// // http_proxy environment variable causes the request to go through a proxy.
|
34
|
+
// process.env.http_proxy = 'http://10.0.0.1:1234';
|
35
|
+
//
|
36
|
+
// // But if the host to be proxied is listed in NO_PROXY, then the request is
|
37
|
+
// // not proxied (but a direct request is made).
|
38
|
+
// process.env.no_proxy = 'example.com';
|
39
|
+
|
40
|
+
var proxy_url = getProxyForUrl(some_url); // <-- Our magic.
|
41
|
+
if (proxy_url) {
|
42
|
+
// Should be proxied through proxy_url.
|
43
|
+
var parsed_some_url = parseUrl(some_url);
|
44
|
+
var parsed_proxy_url = parseUrl(proxy_url);
|
45
|
+
// A HTTP proxy is quite simple. It is similar to a normal request, except the
|
46
|
+
// path is an absolute URL, and the proxied URL's host is put in the header
|
47
|
+
// instead of the server's actual host.
|
48
|
+
httpOptions = {
|
49
|
+
protocol: parsed_proxy_url.protocol,
|
50
|
+
hostname: parsed_proxy_url.hostname,
|
51
|
+
port: parsed_proxy_url.port,
|
52
|
+
path: parsed_some_url.href,
|
53
|
+
headers: {
|
54
|
+
Host: parsed_some_url.host, // = host name + optional port.
|
55
|
+
},
|
56
|
+
};
|
57
|
+
} else {
|
58
|
+
// Direct request.
|
59
|
+
httpOptions = some_url;
|
60
|
+
}
|
61
|
+
http.get(httpOptions, function(res) {
|
62
|
+
var responses = [];
|
63
|
+
res.on('data', function(chunk) { responses.push(chunk); });
|
64
|
+
res.on('end', function() { console.log(responses.join('')); });
|
65
|
+
});
|
66
|
+
|
67
|
+
```
|
68
|
+
|
69
|
+
## Environment variables
|
70
|
+
The environment variables can be specified in lowercase or uppercase, with the
|
71
|
+
lowercase name having precedence over the uppercase variant. A variable that is
|
72
|
+
not set has the same meaning as a variable that is set but has no value.
|
73
|
+
|
74
|
+
### NO\_PROXY
|
75
|
+
|
76
|
+
`NO_PROXY` is a list of host names (optionally with a port). If the input URL
|
77
|
+
matches any of the entries in `NO_PROXY`, then the input URL should be fetched
|
78
|
+
by a direct request (i.e. without a proxy).
|
79
|
+
|
80
|
+
Matching follows the following rules:
|
81
|
+
|
82
|
+
- `NO_PROXY=*` disables all proxies.
|
83
|
+
- Space and commas may be used to separate the entries in the `NO_PROXY` list.
|
84
|
+
- If `NO_PROXY` does not contain any entries, then proxies are never disabled.
|
85
|
+
- If a port is added after the host name, then the ports must match. If the URL
|
86
|
+
does not have an explicit port name, the protocol's default port is used.
|
87
|
+
- Generally, the proxy is only disabled if the host name is an exact match for
|
88
|
+
an entry in the `NO_PROXY` list. The only exceptions are entries that start
|
89
|
+
with a dot or with a wildcard; then the proxy is disabled if the host name
|
90
|
+
ends with the entry.
|
91
|
+
|
92
|
+
See `test.js` for examples of what should match and what does not.
|
93
|
+
|
94
|
+
### \*\_PROXY
|
95
|
+
|
96
|
+
The environment variable used for the proxy depends on the protocol of the URL.
|
97
|
+
For example, `https://example.com` uses the "https" protocol, and therefore the
|
98
|
+
proxy to be used is `HTTPS_PROXY` (_NOT_ `HTTP_PROXY`, which is _only_ used for
|
99
|
+
http:-URLs).
|
100
|
+
|
101
|
+
The library is not limited to http(s), other schemes such as
|
102
|
+
`FTP_PROXY` (ftp:),
|
103
|
+
`WSS_PROXY` (wss:),
|
104
|
+
`WS_PROXY` (ws:)
|
105
|
+
are also supported.
|
106
|
+
|
107
|
+
If present, `ALL_PROXY` is used as fallback if there is no other match.
|
108
|
+
|
109
|
+
|
110
|
+
## External resources
|
111
|
+
The exact way of parsing the environment variables is not codified in any
|
112
|
+
standard. This library is designed to be compatible with formats as expected by
|
113
|
+
existing software.
|
114
|
+
The following resources were used to determine the desired behavior:
|
115
|
+
|
116
|
+
- cURL:
|
117
|
+
https://curl.haxx.se/docs/manpage.html#ENVIRONMENT
|
118
|
+
https://github.com/curl/curl/blob/4af40b3646d3b09f68e419f7ca866ff395d1f897/lib/url.c#L4446-L4514
|
119
|
+
https://github.com/curl/curl/blob/4af40b3646d3b09f68e419f7ca866ff395d1f897/lib/url.c#L4608-L4638
|
120
|
+
|
121
|
+
- wget:
|
122
|
+
https://www.gnu.org/software/wget/manual/wget.html#Proxies
|
123
|
+
http://git.savannah.gnu.org/cgit/wget.git/tree/src/init.c?id=636a5f9a1c508aa39e35a3a8e9e54520a284d93d#n383
|
124
|
+
http://git.savannah.gnu.org/cgit/wget.git/tree/src/retr.c?id=93c1517c4071c4288ba5a4b038e7634e4c6b5482#n1278
|
125
|
+
|
126
|
+
- W3:
|
127
|
+
https://www.w3.org/Daemon/User/Proxies/ProxyClients.html
|
128
|
+
|
129
|
+
- Python's urllib:
|
130
|
+
https://github.com/python/cpython/blob/936135bb97fe04223aa30ca6e98eac8f3ed6b349/Lib/urllib/request.py#L755-L782
|
131
|
+
https://github.com/python/cpython/blob/936135bb97fe04223aa30ca6e98eac8f3ed6b349/Lib/urllib/request.py#L2444-L2479
|
@@ -0,0 +1,103 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var parseUrl = require('url').parse;
|
4
|
+
|
5
|
+
var DEFAULT_PORTS = {
|
6
|
+
ftp: 21,
|
7
|
+
gopher: 70,
|
8
|
+
http: 80,
|
9
|
+
https: 443,
|
10
|
+
ws: 80,
|
11
|
+
wss: 443,
|
12
|
+
};
|
13
|
+
|
14
|
+
var stringEndsWith = String.prototype.endsWith || function(s) {
|
15
|
+
return s.length <= this.length &&
|
16
|
+
this.indexOf(s, this.length - s.length) !== -1;
|
17
|
+
};
|
18
|
+
|
19
|
+
/**
|
20
|
+
* @param {string|object} url - The URL, or the result from url.parse.
|
21
|
+
* @return {string} The URL of the proxy that should handle the request to the
|
22
|
+
* given URL. If no proxy is set, this will be an empty string.
|
23
|
+
*/
|
24
|
+
function getProxyForUrl(url) {
|
25
|
+
var parsedUrl = typeof url === 'string' ? parseUrl(url) : url || {};
|
26
|
+
var proto = parsedUrl.protocol;
|
27
|
+
var hostname = parsedUrl.host;
|
28
|
+
var port = parsedUrl.port;
|
29
|
+
if (typeof hostname !== 'string' || !hostname || typeof proto !== 'string') {
|
30
|
+
return ''; // Don't proxy URLs without a valid scheme or host.
|
31
|
+
}
|
32
|
+
|
33
|
+
proto = proto.split(':', 1)[0];
|
34
|
+
// Stripping ports in this way instead of using parsedUrl.hostname to make
|
35
|
+
// sure that the brackets around IPv6 addresses are kept.
|
36
|
+
hostname = hostname.replace(/:\d*$/, '');
|
37
|
+
port = parseInt(port) || DEFAULT_PORTS[proto] || 0;
|
38
|
+
if (!shouldProxy(hostname, port)) {
|
39
|
+
return ''; // Don't proxy URLs that match NO_PROXY.
|
40
|
+
}
|
41
|
+
|
42
|
+
var proxy = getEnv(proto + '_proxy') || getEnv('all_proxy');
|
43
|
+
if (proxy && proxy.indexOf('://') === -1) {
|
44
|
+
// Missing scheme in proxy, default to the requested URL's scheme.
|
45
|
+
proxy = proto + '://' + proxy;
|
46
|
+
}
|
47
|
+
return proxy;
|
48
|
+
}
|
49
|
+
|
50
|
+
/**
|
51
|
+
* Determines whether a given URL should be proxied.
|
52
|
+
*
|
53
|
+
* @param {string} hostname - The host name of the URL.
|
54
|
+
* @param {number} port - The effective port of the URL.
|
55
|
+
* @returns {boolean} Whether the given URL should be proxied.
|
56
|
+
* @private
|
57
|
+
*/
|
58
|
+
function shouldProxy(hostname, port) {
|
59
|
+
var NO_PROXY = getEnv('no_proxy').toLowerCase();
|
60
|
+
if (!NO_PROXY) {
|
61
|
+
return true; // Always proxy if NO_PROXY is not set.
|
62
|
+
}
|
63
|
+
if (NO_PROXY === '*') {
|
64
|
+
return false; // Never proxy if wildcard is set.
|
65
|
+
}
|
66
|
+
|
67
|
+
return NO_PROXY.split(/[,\s]/).every(function(proxy) {
|
68
|
+
if (!proxy) {
|
69
|
+
return true; // Skip zero-length hosts.
|
70
|
+
}
|
71
|
+
var parsedProxy = proxy.match(/^(.+):(\d+)$/);
|
72
|
+
var parsedProxyHostname = parsedProxy ? parsedProxy[1] : proxy;
|
73
|
+
var parsedProxyPort = parsedProxy ? parseInt(parsedProxy[2]) : 0;
|
74
|
+
if (parsedProxyPort && parsedProxyPort !== port) {
|
75
|
+
return true; // Skip if ports don't match.
|
76
|
+
}
|
77
|
+
|
78
|
+
if (!/^[.*]/.test(parsedProxyHostname)) {
|
79
|
+
// No wildcards, so stop proxying if there is an exact match.
|
80
|
+
return hostname !== parsedProxyHostname;
|
81
|
+
}
|
82
|
+
|
83
|
+
if (parsedProxyHostname.charAt(0) === '*') {
|
84
|
+
// Remove leading wildcard.
|
85
|
+
parsedProxyHostname = parsedProxyHostname.slice(1);
|
86
|
+
}
|
87
|
+
// Stop proxying if the hostname ends with the no_proxy host.
|
88
|
+
return !stringEndsWith.call(hostname, parsedProxyHostname);
|
89
|
+
});
|
90
|
+
}
|
91
|
+
|
92
|
+
/**
|
93
|
+
* Get the value for an environment variable.
|
94
|
+
*
|
95
|
+
* @param {string} key - The name of the environment variable.
|
96
|
+
* @return {string} The value of the environment variable.
|
97
|
+
* @private
|
98
|
+
*/
|
99
|
+
function getEnv(key) {
|
100
|
+
return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || '';
|
101
|
+
}
|
102
|
+
|
103
|
+
exports.getProxyForUrl = getProxyForUrl;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
{
|
2
|
+
"name": "proxy-from-env",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "Offers getProxyForUrl to get the proxy URL for a URL, respecting the *_PROXY (e.g. HTTP_PROXY) and NO_PROXY environment variables.",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"lint": "jscs *.js && jshint *.js",
|
8
|
+
"test": "mocha ./test.js --reporter spec",
|
9
|
+
"test-coverage": "istanbul cover ./node_modules/.bin/_mocha -- --reporter spec"
|
10
|
+
},
|
11
|
+
"repository": {
|
12
|
+
"type": "git",
|
13
|
+
"url": "https://github.com/Rob--W/proxy-from-env.git"
|
14
|
+
},
|
15
|
+
"keywords": [
|
16
|
+
"proxy",
|
17
|
+
"http_proxy",
|
18
|
+
"https_proxy",
|
19
|
+
"no_proxy",
|
20
|
+
"environment"
|
21
|
+
],
|
22
|
+
"author": "Rob Wu <rob@robwu.nl> (https://robwu.nl/)",
|
23
|
+
"license": "MIT",
|
24
|
+
"bugs": {
|
25
|
+
"url": "https://github.com/Rob--W/proxy-from-env/issues"
|
26
|
+
},
|
27
|
+
"homepage": "https://github.com/Rob--W/proxy-from-env#readme",
|
28
|
+
"devDependencies": {
|
29
|
+
"coveralls": "^2.11.6",
|
30
|
+
"istanbul": "^0.4.2",
|
31
|
+
"jscs": "^2.10.1",
|
32
|
+
"jshint": "^2.9.1",
|
33
|
+
"mocha": "^2.4.5"
|
34
|
+
}
|
35
|
+
}
|
@@ -0,0 +1,393 @@
|
|
1
|
+
/* jshint mocha:true */
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
var assert = require('assert');
|
5
|
+
var parseUrl = require('url').parse;
|
6
|
+
|
7
|
+
var getProxyForUrl = require('./').getProxyForUrl;
|
8
|
+
|
9
|
+
// Runs the callback with process.env temporarily set to env.
|
10
|
+
function runWithEnv(env, callback) {
|
11
|
+
var originalEnv = process.env;
|
12
|
+
process.env = env;
|
13
|
+
try {
|
14
|
+
callback();
|
15
|
+
} finally {
|
16
|
+
process.env = originalEnv;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
// Defines a test case that checks whether getProxyForUrl(input) === expected.
|
21
|
+
function testProxyUrl(env, expected, input) {
|
22
|
+
assert(typeof env === 'object' && env !== null);
|
23
|
+
// Copy object to make sure that the in param does not get modified between
|
24
|
+
// the call of this function and the use of it below.
|
25
|
+
env = JSON.parse(JSON.stringify(env));
|
26
|
+
|
27
|
+
var title = 'getProxyForUrl(' + JSON.stringify(input) + ')' +
|
28
|
+
' === ' + JSON.stringify(expected);
|
29
|
+
|
30
|
+
// Save call stack for later use.
|
31
|
+
var stack = {};
|
32
|
+
Error.captureStackTrace(stack, testProxyUrl);
|
33
|
+
// Only use the last stack frame because that shows where this function is
|
34
|
+
// called, and that is sufficient for our purpose. No need to flood the logs
|
35
|
+
// with an uninteresting stack trace.
|
36
|
+
stack = stack.stack.split('\n', 2)[1];
|
37
|
+
|
38
|
+
it(title, function() {
|
39
|
+
var actual;
|
40
|
+
runWithEnv(env, function() {
|
41
|
+
actual = getProxyForUrl(input);
|
42
|
+
});
|
43
|
+
if (expected === actual) {
|
44
|
+
return; // Good!
|
45
|
+
}
|
46
|
+
try {
|
47
|
+
assert.strictEqual(expected, actual); // Create a formatted error message.
|
48
|
+
// Should not happen because previously we determined expected !== actual.
|
49
|
+
throw new Error('assert.strictEqual passed. This is impossible!');
|
50
|
+
} catch (e) {
|
51
|
+
// Use the original stack trace, so we can see a helpful line number.
|
52
|
+
e.stack = e.message + stack;
|
53
|
+
throw e;
|
54
|
+
}
|
55
|
+
});
|
56
|
+
}
|
57
|
+
|
58
|
+
describe('getProxyForUrl', function() {
|
59
|
+
describe('No proxy variables', function() {
|
60
|
+
var env = {};
|
61
|
+
testProxyUrl(env, '', 'http://example.com');
|
62
|
+
testProxyUrl(env, '', 'https://example.com');
|
63
|
+
testProxyUrl(env, '', 'ftp://example.com');
|
64
|
+
});
|
65
|
+
|
66
|
+
describe('Invalid URLs', function() {
|
67
|
+
var env = {};
|
68
|
+
env.ALL_PROXY = 'http://unexpected.proxy';
|
69
|
+
testProxyUrl(env, '', 'bogus');
|
70
|
+
testProxyUrl(env, '', '//example.com');
|
71
|
+
testProxyUrl(env, '', '://example.com');
|
72
|
+
testProxyUrl(env, '', '://');
|
73
|
+
testProxyUrl(env, '', '/path');
|
74
|
+
testProxyUrl(env, '', '');
|
75
|
+
testProxyUrl(env, '', 'http:');
|
76
|
+
testProxyUrl(env, '', 'http:/');
|
77
|
+
testProxyUrl(env, '', 'http://');
|
78
|
+
testProxyUrl(env, '', 'prototype://');
|
79
|
+
testProxyUrl(env, '', 'hasOwnProperty://');
|
80
|
+
testProxyUrl(env, '', '__proto__://');
|
81
|
+
testProxyUrl(env, '', undefined);
|
82
|
+
testProxyUrl(env, '', null);
|
83
|
+
testProxyUrl(env, '', {});
|
84
|
+
testProxyUrl(env, '', {host: 'x', protocol: 1});
|
85
|
+
testProxyUrl(env, '', {host: 1, protocol: 'x'});
|
86
|
+
});
|
87
|
+
|
88
|
+
describe('http_proxy and HTTP_PROXY', function() {
|
89
|
+
var env = {};
|
90
|
+
env.HTTP_PROXY = 'http://http-proxy';
|
91
|
+
|
92
|
+
testProxyUrl(env, '', 'https://example');
|
93
|
+
testProxyUrl(env, 'http://http-proxy', 'http://example');
|
94
|
+
testProxyUrl(env, 'http://http-proxy', parseUrl('http://example'));
|
95
|
+
|
96
|
+
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
|
97
|
+
env.http_proxy = 'http://priority';
|
98
|
+
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
|
99
|
+
testProxyUrl(env, 'http://priority', 'http://example');
|
100
|
+
});
|
101
|
+
|
102
|
+
describe('http_proxy with non-sensical value', function() {
|
103
|
+
var env = {};
|
104
|
+
// Crazy values should be passed as-is. It is the responsibility of the
|
105
|
+
// one who launches the application that the value makes sense.
|
106
|
+
// TODO: Should we be stricter and perform validation?
|
107
|
+
env.HTTP_PROXY = 'Crazy \n!() { ::// }';
|
108
|
+
testProxyUrl(env, 'Crazy \n!() { ::// }', 'http://wow');
|
109
|
+
|
110
|
+
// The implementation assumes that the HTTP_PROXY environment variable is
|
111
|
+
// somewhat reasonable, and if the scheme is missing, it is added.
|
112
|
+
// Garbage in, garbage out some would say...
|
113
|
+
env.HTTP_PROXY = 'crazy without colon slash slash';
|
114
|
+
testProxyUrl(env, 'http://crazy without colon slash slash', 'http://wow');
|
115
|
+
});
|
116
|
+
|
117
|
+
describe('https_proxy and HTTPS_PROXY', function() {
|
118
|
+
var env = {};
|
119
|
+
// Assert that there is no fall back to http_proxy
|
120
|
+
env.HTTP_PROXY = 'http://unexpected.proxy';
|
121
|
+
testProxyUrl(env, '', 'https://example');
|
122
|
+
|
123
|
+
env.HTTPS_PROXY = 'http://https-proxy';
|
124
|
+
testProxyUrl(env, 'http://https-proxy', 'https://example');
|
125
|
+
|
126
|
+
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
|
127
|
+
env.https_proxy = 'http://priority';
|
128
|
+
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
|
129
|
+
testProxyUrl(env, 'http://priority', 'https://example');
|
130
|
+
});
|
131
|
+
|
132
|
+
describe('ftp_proxy', function() {
|
133
|
+
var env = {};
|
134
|
+
// Something else than http_proxy / https, as a sanity check.
|
135
|
+
env.FTP_PROXY = 'http://ftp-proxy';
|
136
|
+
|
137
|
+
testProxyUrl(env, 'http://ftp-proxy', 'ftp://example');
|
138
|
+
testProxyUrl(env, '', 'ftps://example');
|
139
|
+
});
|
140
|
+
|
141
|
+
describe('all_proxy', function() {
|
142
|
+
var env = {};
|
143
|
+
env.ALL_PROXY = 'http://catch-all';
|
144
|
+
testProxyUrl(env, 'http://catch-all', 'https://example');
|
145
|
+
|
146
|
+
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
|
147
|
+
env.all_proxy = 'http://priority';
|
148
|
+
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
|
149
|
+
testProxyUrl(env, 'http://priority', 'https://example');
|
150
|
+
});
|
151
|
+
|
152
|
+
describe('all_proxy without scheme', function() {
|
153
|
+
var env = {};
|
154
|
+
env.ALL_PROXY = 'noscheme';
|
155
|
+
testProxyUrl(env, 'http://noscheme', 'http://example');
|
156
|
+
testProxyUrl(env, 'https://noscheme', 'https://example');
|
157
|
+
|
158
|
+
// The module does not impose restrictions on the scheme.
|
159
|
+
testProxyUrl(env, 'bogus-scheme://noscheme', 'bogus-scheme://example');
|
160
|
+
|
161
|
+
// But the URL should still be valid.
|
162
|
+
testProxyUrl(env, '', 'bogus');
|
163
|
+
});
|
164
|
+
|
165
|
+
describe('no_proxy empty', function() {
|
166
|
+
var env = {};
|
167
|
+
env.HTTPS_PROXY = 'http://proxy';
|
168
|
+
|
169
|
+
// NO_PROXY set but empty.
|
170
|
+
env.NO_PROXY = '';
|
171
|
+
testProxyUrl(env, 'http://proxy', 'https://example');
|
172
|
+
|
173
|
+
// No entries in NO_PROXY (comma).
|
174
|
+
env.NO_PROXY = ',';
|
175
|
+
testProxyUrl(env, 'http://proxy', 'https://example');
|
176
|
+
|
177
|
+
// No entries in NO_PROXY (whitespace).
|
178
|
+
env.NO_PROXY = ' ';
|
179
|
+
testProxyUrl(env, 'http://proxy', 'https://example');
|
180
|
+
|
181
|
+
// No entries in NO_PROXY (multiple whitespace / commas).
|
182
|
+
env.NO_PROXY = ',\t,,,\n, ,\r';
|
183
|
+
testProxyUrl(env, 'http://proxy', 'https://example');
|
184
|
+
});
|
185
|
+
|
186
|
+
describe('no_proxy=example (single host)', function() {
|
187
|
+
var env = {};
|
188
|
+
env.HTTP_PROXY = 'http://proxy';
|
189
|
+
|
190
|
+
env.NO_PROXY = 'example';
|
191
|
+
testProxyUrl(env, '', 'http://example');
|
192
|
+
testProxyUrl(env, '', 'http://example:80');
|
193
|
+
testProxyUrl(env, '', 'http://example:0');
|
194
|
+
testProxyUrl(env, '', 'http://example:1337');
|
195
|
+
testProxyUrl(env, 'http://proxy', 'http://sub.example');
|
196
|
+
testProxyUrl(env, 'http://proxy', 'http://prefexample');
|
197
|
+
testProxyUrl(env, 'http://proxy', 'http://example.no');
|
198
|
+
testProxyUrl(env, 'http://proxy', 'http://a.b.example');
|
199
|
+
testProxyUrl(env, 'http://proxy', 'http://host/example');
|
200
|
+
});
|
201
|
+
|
202
|
+
describe('no_proxy=sub.example (subdomain)', function() {
|
203
|
+
var env = {};
|
204
|
+
env.HTTP_PROXY = 'http://proxy';
|
205
|
+
|
206
|
+
env.NO_PROXY = 'sub.example';
|
207
|
+
testProxyUrl(env, 'http://proxy', 'http://example');
|
208
|
+
testProxyUrl(env, 'http://proxy', 'http://example:80');
|
209
|
+
testProxyUrl(env, 'http://proxy', 'http://example:0');
|
210
|
+
testProxyUrl(env, 'http://proxy', 'http://example:1337');
|
211
|
+
testProxyUrl(env, '', 'http://sub.example');
|
212
|
+
testProxyUrl(env, 'http://proxy', 'http://no.sub.example');
|
213
|
+
testProxyUrl(env, 'http://proxy', 'http://sub-example');
|
214
|
+
testProxyUrl(env, 'http://proxy', 'http://example.sub');
|
215
|
+
});
|
216
|
+
|
217
|
+
describe('no_proxy=example:80 (host + port)', function() {
|
218
|
+
var env = {};
|
219
|
+
env.HTTP_PROXY = 'http://proxy';
|
220
|
+
|
221
|
+
env.NO_PROXY = 'example:80';
|
222
|
+
testProxyUrl(env, '', 'http://example');
|
223
|
+
testProxyUrl(env, '', 'http://example:80');
|
224
|
+
testProxyUrl(env, '', 'http://example:0');
|
225
|
+
testProxyUrl(env, 'http://proxy', 'http://example:1337');
|
226
|
+
testProxyUrl(env, 'http://proxy', 'http://sub.example');
|
227
|
+
testProxyUrl(env, 'http://proxy', 'http://prefexample');
|
228
|
+
testProxyUrl(env, 'http://proxy', 'http://example.no');
|
229
|
+
testProxyUrl(env, 'http://proxy', 'http://a.b.example');
|
230
|
+
});
|
231
|
+
|
232
|
+
describe('no_proxy=.example (host suffix)', function() {
|
233
|
+
var env = {};
|
234
|
+
env.HTTP_PROXY = 'http://proxy';
|
235
|
+
|
236
|
+
env.NO_PROXY = '.example';
|
237
|
+
testProxyUrl(env, 'http://proxy', 'http://example');
|
238
|
+
testProxyUrl(env, 'http://proxy', 'http://example:80');
|
239
|
+
testProxyUrl(env, 'http://proxy', 'http://example:1337');
|
240
|
+
testProxyUrl(env, '', 'http://sub.example');
|
241
|
+
testProxyUrl(env, '', 'http://sub.example:80');
|
242
|
+
testProxyUrl(env, '', 'http://sub.example:1337');
|
243
|
+
testProxyUrl(env, 'http://proxy', 'http://prefexample');
|
244
|
+
testProxyUrl(env, 'http://proxy', 'http://example.no');
|
245
|
+
testProxyUrl(env, '', 'http://a.b.example');
|
246
|
+
});
|
247
|
+
|
248
|
+
describe('no_proxy=*', function() {
|
249
|
+
var env = {};
|
250
|
+
env.HTTP_PROXY = 'http://proxy';
|
251
|
+
env.NO_PROXY = '*';
|
252
|
+
testProxyUrl(env, '', 'http://example.com');
|
253
|
+
});
|
254
|
+
|
255
|
+
describe('no_proxy=*.example (host suffix with *.)', function() {
|
256
|
+
var env = {};
|
257
|
+
env.HTTP_PROXY = 'http://proxy';
|
258
|
+
|
259
|
+
env.NO_PROXY = '*.example';
|
260
|
+
testProxyUrl(env, 'http://proxy', 'http://example');
|
261
|
+
testProxyUrl(env, 'http://proxy', 'http://example:80');
|
262
|
+
testProxyUrl(env, 'http://proxy', 'http://example:1337');
|
263
|
+
testProxyUrl(env, '', 'http://sub.example');
|
264
|
+
testProxyUrl(env, '', 'http://sub.example:80');
|
265
|
+
testProxyUrl(env, '', 'http://sub.example:1337');
|
266
|
+
testProxyUrl(env, 'http://proxy', 'http://prefexample');
|
267
|
+
testProxyUrl(env, 'http://proxy', 'http://example.no');
|
268
|
+
testProxyUrl(env, '', 'http://a.b.example');
|
269
|
+
});
|
270
|
+
|
271
|
+
describe('no_proxy=*example (substring suffix)', function() {
|
272
|
+
var env = {};
|
273
|
+
env.HTTP_PROXY = 'http://proxy';
|
274
|
+
|
275
|
+
env.NO_PROXY = '*example';
|
276
|
+
testProxyUrl(env, '', 'http://example');
|
277
|
+
testProxyUrl(env, '', 'http://example:80');
|
278
|
+
testProxyUrl(env, '', 'http://example:1337');
|
279
|
+
testProxyUrl(env, '', 'http://sub.example');
|
280
|
+
testProxyUrl(env, '', 'http://sub.example:80');
|
281
|
+
testProxyUrl(env, '', 'http://sub.example:1337');
|
282
|
+
testProxyUrl(env, '', 'http://prefexample');
|
283
|
+
testProxyUrl(env, '', 'http://a.b.example');
|
284
|
+
testProxyUrl(env, 'http://proxy', 'http://example.no');
|
285
|
+
testProxyUrl(env, 'http://proxy', 'http://host/example');
|
286
|
+
});
|
287
|
+
|
288
|
+
describe('no_proxy=.*example (arbitrary wildcards are NOT supported)',
|
289
|
+
function() {
|
290
|
+
var env = {};
|
291
|
+
env.HTTP_PROXY = 'http://proxy';
|
292
|
+
|
293
|
+
env.NO_PROXY = '.*example';
|
294
|
+
testProxyUrl(env, 'http://proxy', 'http://example');
|
295
|
+
testProxyUrl(env, 'http://proxy', 'http://sub.example');
|
296
|
+
testProxyUrl(env, 'http://proxy', 'http://sub.example');
|
297
|
+
testProxyUrl(env, 'http://proxy', 'http://prefexample');
|
298
|
+
testProxyUrl(env, 'http://proxy', 'http://x.prefexample');
|
299
|
+
testProxyUrl(env, 'http://proxy', 'http://a.b.example');
|
300
|
+
});
|
301
|
+
|
302
|
+
describe('no_proxy=[::1],[::2]:80,10.0.0.1,10.0.0.2:80 (IP addresses)',
|
303
|
+
function() {
|
304
|
+
var env = {};
|
305
|
+
env.HTTP_PROXY = 'http://proxy';
|
306
|
+
|
307
|
+
env.NO_PROXY = '[::1],[::2]:80,10.0.0.1,10.0.0.2:80';
|
308
|
+
testProxyUrl(env, '', 'http://[::1]/');
|
309
|
+
testProxyUrl(env, '', 'http://[::1]:80/');
|
310
|
+
testProxyUrl(env, '', 'http://[::1]:1337/');
|
311
|
+
|
312
|
+
testProxyUrl(env, '', 'http://[::2]/');
|
313
|
+
testProxyUrl(env, '', 'http://[::2]:80/');
|
314
|
+
testProxyUrl(env, 'http://proxy', 'http://[::2]:1337/');
|
315
|
+
|
316
|
+
testProxyUrl(env, '', 'http://10.0.0.1/');
|
317
|
+
testProxyUrl(env, '', 'http://10.0.0.1:80/');
|
318
|
+
testProxyUrl(env, '', 'http://10.0.0.1:1337/');
|
319
|
+
|
320
|
+
testProxyUrl(env, '', 'http://10.0.0.2/');
|
321
|
+
testProxyUrl(env, '', 'http://10.0.0.2:80/');
|
322
|
+
testProxyUrl(env, 'http://proxy', 'http://10.0.0.2:1337/');
|
323
|
+
});
|
324
|
+
|
325
|
+
describe('no_proxy=127.0.0.1/32 (CIDR is NOT supported)', function() {
|
326
|
+
var env = {};
|
327
|
+
env.HTTP_PROXY = 'http://proxy';
|
328
|
+
|
329
|
+
env.NO_PROXY = '127.0.0.1/32';
|
330
|
+
testProxyUrl(env, 'http://proxy', 'http://127.0.0.1');
|
331
|
+
testProxyUrl(env, 'http://proxy', 'http://127.0.0.1/32');
|
332
|
+
});
|
333
|
+
|
334
|
+
describe('no_proxy=127.0.0.1 does NOT match localhost', function() {
|
335
|
+
var env = {};
|
336
|
+
env.HTTP_PROXY = 'http://proxy';
|
337
|
+
|
338
|
+
env.NO_PROXY = '127.0.0.1';
|
339
|
+
testProxyUrl(env, '', 'http://127.0.0.1');
|
340
|
+
// We're not performing DNS queries, so this shouldn't match.
|
341
|
+
testProxyUrl(env, 'http://proxy', 'http://localhost');
|
342
|
+
});
|
343
|
+
|
344
|
+
describe('no_proxy with protocols that have a default port', function() {
|
345
|
+
var env = {};
|
346
|
+
env.WS_PROXY = 'http://ws';
|
347
|
+
env.WSS_PROXY = 'http://wss';
|
348
|
+
env.HTTP_PROXY = 'http://http';
|
349
|
+
env.HTTPS_PROXY = 'http://https';
|
350
|
+
env.GOPHER_PROXY = 'http://gopher';
|
351
|
+
env.FTP_PROXY = 'http://ftp';
|
352
|
+
env.ALL_PROXY = 'http://all';
|
353
|
+
|
354
|
+
env.NO_PROXY = 'xxx:21,xxx:70,xxx:80,xxx:443';
|
355
|
+
|
356
|
+
testProxyUrl(env, '', 'http://xxx');
|
357
|
+
testProxyUrl(env, '', 'http://xxx:80');
|
358
|
+
testProxyUrl(env, 'http://http', 'http://xxx:1337');
|
359
|
+
|
360
|
+
testProxyUrl(env, '', 'ws://xxx');
|
361
|
+
testProxyUrl(env, '', 'ws://xxx:80');
|
362
|
+
testProxyUrl(env, 'http://ws', 'ws://xxx:1337');
|
363
|
+
|
364
|
+
testProxyUrl(env, '', 'https://xxx');
|
365
|
+
testProxyUrl(env, '', 'https://xxx:443');
|
366
|
+
testProxyUrl(env, 'http://https', 'https://xxx:1337');
|
367
|
+
|
368
|
+
testProxyUrl(env, '', 'wss://xxx');
|
369
|
+
testProxyUrl(env, '', 'wss://xxx:443');
|
370
|
+
testProxyUrl(env, 'http://wss', 'wss://xxx:1337');
|
371
|
+
|
372
|
+
testProxyUrl(env, '', 'gopher://xxx');
|
373
|
+
testProxyUrl(env, '', 'gopher://xxx:70');
|
374
|
+
testProxyUrl(env, 'http://gopher', 'gopher://xxx:1337');
|
375
|
+
|
376
|
+
testProxyUrl(env, '', 'ftp://xxx');
|
377
|
+
testProxyUrl(env, '', 'ftp://xxx:21');
|
378
|
+
testProxyUrl(env, 'http://ftp', 'ftp://xxx:1337');
|
379
|
+
});
|
380
|
+
|
381
|
+
describe('no_proxy should not be case-sensitive', function() {
|
382
|
+
var env = {};
|
383
|
+
env.HTTP_PROXY = 'http://proxy';
|
384
|
+
env.NO_PROXY = 'XXX,YYY,ZzZ';
|
385
|
+
|
386
|
+
testProxyUrl(env, '', 'http://xxx');
|
387
|
+
testProxyUrl(env, '', 'http://XXX');
|
388
|
+
testProxyUrl(env, '', 'http://yyy');
|
389
|
+
testProxyUrl(env, '', 'http://YYY');
|
390
|
+
testProxyUrl(env, '', 'http://ZzZ');
|
391
|
+
testProxyUrl(env, '', 'http://zZz');
|
392
|
+
});
|
393
|
+
});
|