From 9bec98e9cc886044d63d51f86c320664067a0cd0 Mon Sep 17 00:00:00 2001 From: Tomofumi Chiba Date: Fri, 14 Aug 2020 12:31:11 +0000 Subject: [PATCH 1/2] add NO_PROXY to `deno help` and add test code --- cli/flags.rs | 2 ++ cli/tests/045_proxy_test.ts | 45 +++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/cli/flags.rs b/cli/flags.rs index 537e768f221696..0721b1ca668b3e 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -195,6 +195,8 @@ static ENV_VARIABLES_HELP: &str = "ENVIRONMENT VARIABLES: HTTP_PROXY Proxy address for HTTP requests (module downloads, fetch) HTTPS_PROXY Proxy address for HTTPS requests + (module downloads, fetch) + NO_PROXY List of hosts which do not use proxy (module downloads, fetch)"; static DENO_HELP: &str = "A secure JavaScript and TypeScript runtime diff --git a/cli/tests/045_proxy_test.ts b/cli/tests/045_proxy_test.ts index c8df8ceb2ec651..873d3a0c171ae4 100644 --- a/cli/tests/045_proxy_test.ts +++ b/cli/tests/045_proxy_test.ts @@ -67,7 +67,52 @@ async function testModuleDownload(): Promise { http.close(); } +async function testFetchNoProxy(): Promise { + const c = Deno.run({ + cmd: [ + Deno.execPath(), + "run", + "--quiet", + "--reload", + "--allow-net", + "045_proxy_client.ts", + ], + stdout: "piped", + env: { + HTTP_PROXY: "http://not.exising.proxy.server", + NO_PROXY: "localhost", + }, + }); + + const status = await c.status(); + assertEquals(status.code, 0); + c.close(); +} + +async function testModuleDownloadNoProxy(): Promise { + const http = Deno.run({ + cmd: [ + Deno.execPath(), + "cache", + "--reload", + "--quiet", + "http://localhost:4545/std/examples/colors.ts", + ], + stdout: "piped", + env: { + HTTP_PROXY: "http://not.exising.proxy.server", + NO_PROXY: "localhost", + }, + }); + + const httpStatus = await http.status(); + assertEquals(httpStatus.code, 0); + http.close(); +} + proxyServer(); await testFetch(); await testModuleDownload(); +await testFetchNoProxy(); +await testModuleDownloadNoProxy(); Deno.exit(0); From 2ee84f4e492e136d444957b22a1fb134108576a1 Mon Sep 17 00:00:00 2001 From: Tomofumi Chiba Date: Fri, 14 Aug 2020 22:14:37 +0000 Subject: [PATCH 2/2] fix NO_PROXY description --- cli/flags.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/flags.rs b/cli/flags.rs index 0721b1ca668b3e..96c50155ff07ed 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -196,7 +196,7 @@ static ENV_VARIABLES_HELP: &str = "ENVIRONMENT VARIABLES: (module downloads, fetch) HTTPS_PROXY Proxy address for HTTPS requests (module downloads, fetch) - NO_PROXY List of hosts which do not use proxy + NO_PROXY Comma-separated list of hosts which do not use a proxy (module downloads, fetch)"; static DENO_HELP: &str = "A secure JavaScript and TypeScript runtime