GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — lib: Match proxy support with `request` module by imatlopez · Pull Request #1978 · nodejs/node-gyp

Conversation

@imatlopez

@imatlopez imatlopez commented Nov 28, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
Checklist
  • npm install && npm test passes
  • documentation is changed or added
  • commit message follows commit guidelines
Description of change

Per #1176 (comment), closes #1751

When using the no_proxy environmental variable I noticed that some installations would fail when NODE_CONFIG_PROXY was set (or its equivalent). From inspecting this code plus how its dependency, https://github.com/request/request, I noticed it already has full proxy support. Changing env itself might lead to side effects.

  • Prevents --proxy to blocking no_proxy from https://github.com/request/request/blob/212570b6971a732b8dd9f3c73354bcdda158a737/request.js#L276-L278
  • Adds no_proxy support through CLI --noproxy or equivalent NPM alternatives.
  • Possibly breaking: Passing proxy effectively blocks https_proxy currently, this also unblocks that variable (which would override our proxy variable). However I am mirroring the http_proxy and https_proxy definitions and then letting the dependency to pick either. (Implemention downstream in: https://github.com/request/request/blob/212570b6971a732b8dd9f3c73354bcdda158a737/lib/getProxyFromURI.js#L40)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
imatlopez added 7 commits November 27, 2019 19:40
@imatlopez
Delegate proxy support to request
a6ce20b
@imatlopez
Add CLI support
df628ae
@imatlopez
Add flag documentation
5f038fb
@imatlopez
mirror behavior with https_proxy
481918d
@imatlopez
Fix verbose noproxy log message
4065cfa
@imatlopez
Add tests
f2e8dd7
@imatlopez
Remove side effects, handle no proxy.
38df5d8
@imatlopez imatlopez changed the title lib: Delegate proxy support to request module lib: Match proxy support with request module Nov 28, 2019
@rvagg

rvagg commented Nov 29, 2019

Copy link
Copy Markdown
Member

It's unfortunate we have to include so much additional logic just to get proper no_proxy support, we're basically digging a bigger hole because of the support for non-standard methods of specifying proxies. One option might be to just rip it out and tell the user to just use standard *_PROXY env vars and be done with it but that's probably going to be too painful for enterprise users that have this baked in already.

Regarding the breaking change - would it really be breaking? In this and the current version, gyp.opts.proxy clobbers whatever you have set. If you have HTTPS_PROXY set only then in the current version it'll flow through and request will handle it properly, in this version you're handling it in the same way as request would have handled it previously. When you provide a proxy option to request, it won't even invoke the getProxyFromURI.js logic as far as I can tell, so it's clobbered by what's done here.

I could imagine some weirdness if you had a proxy setting that didn't pass our basic regex: if (/^https?:\/\//i.test(proxyUrl)) {. request does a url.parse() which I think is assumed to throw if it's bad and so there's scope for some permutation of a proxy setting in an env var that's not picked up here but is picked up by request. But, you'd get an informational message here and you're probably not doing something sensible if you're getting that anyway .. I think.

tnguyen14 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@imatlopez

imatlopez commented Nov 29, 2019

Copy link
Copy Markdown
Contributor Author

but that's probably going to be too painful for enterprise users that have this baked in already

This is actually why I am here, the only way I make proxies work is to not specify them outside env var.

When you provide a proxy option to request, it won't even invoke the getProxyFromURI.js logic as far as I can tell, so it's clobbered by what's done here.

Exactly, which is why no_proxy is never handled correctly. My initial concern was with env vars leaking elsewhere if they were changed within the program, so I ripped out all the request code related to it (including the url.parse part--which is deprecated sadly). A benefit is that proxy behavior is now set in stone if request goes away.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@imatlopez

imatlopez commented Dec 3, 2019

Copy link
Copy Markdown
Contributor Author

@rvagg anything pending here?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

rvagg
rvagg approved these changes Dec 15, 2019
View reviewed changes
rvagg pushed a commit that referenced this pull request Dec 15, 2019
@imatlopez @rvagg
lib: noproxy support, match proxy detection to request
3bcba2a
PR-URL: #1978
Reviewed-By: Rod Vagg <[email protected]>
@rvagg rvagg added the semver-minor label Dec 15, 2019
@rvagg

rvagg commented Dec 15, 2019

Copy link
Copy Markdown
Member

landed in 3bcba2a, labelled semver-minor

imatlopez reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rvagg rvagg closed this Dec 15, 2019
@rvagg rvagg mentioned this pull request Dec 16, 2019
Release proposal: [email protected] #1972
Closed
@imatlopez
imatlopez deleted the noproxy branch December 16, 2019 01:57
@rvagg rvagg mentioned this pull request Jan 3, 2020
TypeError: '>=' not supported between instances of 'tuple' and 'str' #1917
Closed
rvagg pushed a commit that referenced this pull request Jan 3, 2020
@imatlopez @rvagg
lib: noproxy support, match proxy detection to request
a3f1143
PR-URL: #1978
Reviewed-By: Rod Vagg <[email protected]>
This was referenced Jan 3, 2020
[email protected] Release Proposal #2012
Closed
[email protected] Release Proposal #2013
Closed
Add support for HTTPS_PROXY #1751
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@rvagg rvagg rvagg approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

semver-minor

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@imatlopez @rvagg
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.