Skip to content
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

[6.x] http: make socketPath work with no agent #19425

Closed

Conversation

lpinca
Copy link
Member

@lpinca lpinca commented Mar 18, 2018

Currently Agent.prototype.createConnection() is called uncoditionally
if the socketPath option is used. This throws an error if no agent is
used, preventing, for example, the socketPath and createConnection
options to be used together.

This commit fixes the issue by falling back to the createConnection
option or net.createConnection().

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added http Issues or PRs related to the http subsystem. v6.x labels Mar 18, 2018
@lpinca
Copy link
Member Author

lpinca commented Mar 18, 2018

Not sure if it's ok to apply bug fixes directly on v6.x but master and v8.x are not affected by this bug.

CI: https://ci.nodejs.org/job/node-test-pull-request/13725/

@lpinca lpinca force-pushed the fix/socket-path-with-no-agent branch from da5c658 to 26e2a50 Compare March 18, 2018 10:16
? self.agent.createConnection(optionsPath, oncreate)
: typeof options.createConnection === 'function'
? options.createConnection(optionsPath, oncreate)
: net.createConnection(optionsPath, oncreate);
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need to pass oncreate to net.createConnection(), it always immediately returns a socket.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, fixed.

@MylesBorins
Copy link
Member

bug fixes against a direct release branch are fine if other branches are unaffects /cc @nodejs/lts for review

@MylesBorins MylesBorins changed the title http: make socketPath work with no agent [6.x] http: make socketPath work with no agent Mar 20, 2018
@MylesBorins MylesBorins self-assigned this Mar 20, 2018
@lpinca lpinca force-pushed the fix/socket-path-with-no-agent branch from f6a2de7 to e507d01 Compare March 20, 2018 17:18
@MylesBorins
Copy link
Member

/cc @nodejs/http

@MylesBorins MylesBorins force-pushed the v6.x-staging branch 2 times, most recently from 0a4c79b to 988cca8 Compare March 30, 2018 03:28
Currently `Agent.prototype.createConnection()` is called uncoditionally
if the `socketPath` option is used. This throws an error if no agent is
used, preventing, for example, the `socketPath` and `createConnection`
options to be used together.

This commit fixes the issue by falling back to the `createConnection`
option or `net.createConnection()`.
@lpinca lpinca force-pushed the fix/socket-path-with-no-agent branch from e507d01 to 6cc1820 Compare March 31, 2018 20:29
@lpinca
Copy link
Member Author

lpinca commented Apr 6, 2018

Ping @nodejs/collaborators

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

LGTM

@MylesBorins
Copy link
Member

MylesBorins pushed a commit that referenced this pull request Apr 13, 2018
Currently `Agent.prototype.createConnection()` is called uncoditionally
if the `socketPath` option is used. This throws an error if no agent is
used, preventing, for example, the `socketPath` and `createConnection`
options to be used together.

This commit fixes the issue by falling back to the `createConnection`
option or `net.createConnection()`.

PR-URL: #19425
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Reviewed-By: Chen Gang <gangc.cxy@foxmail.com>
@MylesBorins
Copy link
Member

landed in 18acad3

@MylesBorins MylesBorins mentioned this pull request Apr 13, 2018
@lpinca lpinca deleted the fix/socket-path-with-no-agent branch April 13, 2018 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
http Issues or PRs related to the http subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants