Skip to content

Conversation

@whut
Copy link

@whutwhut commented Jul 17, 2023

Under ECMAScript modules when you do "import * as https from 'https'" you get a new object with properties copied from https module exports. So if this is a regular data property, you will just override a copy, but if this would be a accessor property, we can still access the actual https.globalAgent.

Refs: #25170, #9386

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/crypto
  • @nodejs/http
  • @nodejs/net

@nodejs-github-botnodejs-github-bot added https Issues or PRs related to the https subsystem. needs-ci PRs that need a full CI run. labels Jul 17, 2023
Copy link
Member

@mcollinamcollina left a comment

Choose a reason for hiding this comment

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

Thanks for opening a PR! Can you please add a unit test?

@whutwhutforce-pushed the pr-https-globalAgent branch from 4b4dba5 to 54579fbCompareJuly 17, 2023 08:58
@whut
Copy link
Author

whut commented Jul 17, 2023

@mcollina test added, based on test-https-client-override-global-agent.js

@whutwhut requested a review from mcollinaJuly 17, 2023 09:01
Copy link
Member

@mcollinamcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollinamcollina added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 17, 2023
@github-actionsgithub-actionsbot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 17, 2023
@nodejs-github-bot
Copy link
Collaborator

@targos
Copy link
Member

Does it already work correctly with http.globalAgent ?

@whutwhutforce-pushed the pr-https-globalAgent branch from 54579fb to a0dfaa5CompareJuly 17, 2023 09:20
@whut
Copy link
Author

whut commented Jul 17, 2023

Does it already work correctly with http.globalAgent ?

Yes, because it already use accessor property

@whutwhutforce-pushed the pr-https-globalAgent branch from a0dfaa5 to 161b003CompareJuly 17, 2023 09:26
@whut
Copy link
Author

whut commented Jul 18, 2023

@mcollina I fixed the build failure, I sadly missed to add one "import" of primordial

@mcollinamcollina added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 18, 2023
@mcollina
Copy link
Member

The linter is failing.

@github-actionsgithub-actionsbot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 18, 2023
@nodejs-github-bot
Copy link
Collaborator

Copy link
Contributor

@ShogunPandaShogunPanda left a comment

Choose a reason for hiding this comment

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

LGTM!

Under ECMAScript modules when you do "import * as https from 'https'" you get a new object with properties copied from https module exports. So if this is a regular data property, you will just override a copy, but if this would be a accessor property, we can still access the actual https.globalAgent. Refs: nodejs#25170, nodejs#9386
@whutwhutforce-pushed the pr-https-globalAgent branch from c8c19cd to c1381e0CompareJuly 20, 2023 10:13
@whut
Copy link
Author

whut commented Jul 20, 2023

@mcollina I only now run the test locally, and fixed imports in it to work under ECMAScript modules (e.g. ... from '../common/' to ... from '../common/index.mjs'. Test now pass, and linter is also happy:)

@mcollinamcollina added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 20, 2023
@github-actionsgithub-actionsbot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 20, 2023
@nodejs-github-bot
Copy link
Collaborator

@mcollina
Copy link
Member

@github-actions
Copy link
Contributor

This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open.

@ShogunPanda
Copy link
Contributor

@whut Any interest on delivering this? Can you please rebase this PR after the last main branch so we can run CI again?

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

httpsIssues or PRs related to the https subsystem.needs-ciPRs that need a full CI run.stalledIssues and PRs that are stalled.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@whut@nodejs-github-bot@targos@mcollina@ShogunPanda@marco-ippolito@aduh95@avivkeller