Skip to content

test: add proxy tests #2977

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Sep 24, 2019
Merged

test: add proxy tests #2977

merged 18 commits into from
Sep 24, 2019

Conversation

bartlomieju
Copy link
Member

@bartlomieju bartlomieju commented Sep 18, 2019

Closes #2873

  • http
    • fetch
    • module fetching
  • update manual.html

EDIT:
I removed todo to test https proxy as we don't support https very well in deno_std server.
Eg, for example proxying request to `https://deno.land/welcome.ts:

deno_dev -A cli/tests/045_proxy_test.ts
Proxy server listening on http://127.0.0.1:4500/
CONNECT deno.land:443 HTTP/1.1
Proxy request to: deno.land:443
url deno.land:443
url_ deno.land:443 deno.land
error: Uncaught HttpOther: deno.land:443: URL scheme is not allowed
► file:///Users/biwanczuk/dev/deno/js/dispatch_json.ts:40:11
    at DenoError (file:///Users/biwanczuk/dev/deno/js/errors.ts:20:5)
    at unwrapResponse (file:///Users/biwanczuk/dev/deno/js/dispatch_json.ts:40:11)
    at sendAsync (file:///Users/biwanczuk/dev/deno/js/dispatch_json.ts:85:10)

We should be proxying to https://deno.land/welcome.ts but we receive deno.land:443 url in ServerRequest. Correct me if I'm wrong and it can be somehow done

@bartlomieju
Copy link
Member Author

For convenience we should also support NO_PROXY env variable, which is sadly not supported by reqwest 😢

@bartlomieju
Copy link
Member Author

🎉

CC @ry

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! It's great to have this nailed down.

At the end of the CLI help text, there are some env vars listed, can you add HTTP_PROXY there:

> deno --help
[ ... ]
ENVIRONMENT VARIABLES:
    DENO_DIR        Set deno's base directory
    NO_COLOR        Set to disable color

@bartlomieju
Copy link
Member Author

Nice work! It's great to have this nailed down.

At the end of the CLI help text, there are some env vars listed, can you add HTTP_PROXY there:

> deno --help
[ ... ]
ENVIRONMENT VARIABLES:
    DENO_DIR        Set deno's base directory
    NO_COLOR        Set to disable color

Oh yes, forgot about that. I'll update the PR shortly

@bartlomieju
Copy link
Member Author

@ry this should be ready now. Unfortunately tests fail on Windows if I use 0.0.0.0 addr

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ry ry merged commit 112ce0d into denoland:master Sep 24, 2019
@bartlomieju bartlomieju deleted the test-proxy_tests branch September 24, 2019 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add documentation and test for HTTP proxy
2 participants