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

http.request socketPath doesn't work on Windows #35008

Open
sschultze opened this issue Sep 1, 2020 · 6 comments
Open

http.request socketPath doesn't work on Windows #35008

sschultze opened this issue Sep 1, 2020 · 6 comments
Labels
blocked PRs that are blocked by other issues or PRs. http Issues or PRs related to the http subsystem. windows Issues and PRs related to the Windows platform.

Comments

@sschultze
Copy link

When calling http.request with the socketPath option on Windows in order to try to connect to a Unix domain socket, I get the following error message:

Error: connect ENOTSOCK C:\Users\User\AppData\Local\Temp\test.sock
    at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)

There is native Unix Domain Sockets support in Windows 10 since two years, and the documentation at https://nodejs.org/api/http.html gives no indication that socketPath doesn't work on Windows, so I guess that this can be considered as an error.

  • Version: 12.16.3 (comes with Electron 10.1.0)
  • Platform: Windows 10, 64-bit, Build 18362.19h1_release.190318-1202
  • Subsystem: http

What steps will reproduce the bug?

Call http.request with the socketPath option on Windows. Specify a Unix domain socket path.

@lpinca
Copy link
Member

lpinca commented Sep 1, 2020

You have to use a named pipe on Windows, see https://nodejs.org/api/net.html#net_ipc_support. AFAIK Node.js does not support UDS on Windows.

@lpinca lpinca added the http Issues or PRs related to the http subsystem. label Sep 1, 2020
@lpinca
Copy link
Member

lpinca commented Sep 1, 2020

cc: @nodejs/platform-windows @nodejs/net @nodejs/libuv

@arixmkii
Copy link

AF_UNIX sockets on Windows were marked GA in build 18362 of Windows 10.

According to this list from MS, the only version, still within the window Mainstream support w/o support is Enterprise/IoT LTSC 1809.

It looks like this could be considered supported for all mainstream Windows versions. Would be nice to have this feature supported as many other languages has this implemented in their runtimes.

@bnoordhuis
Copy link
Member

Blocked on libuv/libuv#2537.

@bnoordhuis bnoordhuis added the blocked PRs that are blocked by other issues or PRs. label Jan 23, 2023
@ravicious
Copy link

At Teleport we develop a multi-platform Electron app which talks to a local daemon over gRPC. Since Node.js on Windows doesn't support Unix sockets, we use gRPC over TCP with mTLS to keep it secure. See CVE-2022-41924 for a vulnerability which depended on Tailscale running an unsecured HTTP API over TCP vs running the same API over a socket on unixes.

Unix socket support on Windows would mean that we can completely remove the mTLS setup and all ceremonies related to it with a much simpler socket based solution. TCP + mTLS was preferred over named pipes due to another team reportedly having bad time with them on Windows.

@bnoordhuis
Copy link
Member

bnoordhuis commented Oct 10, 2023

This is basically "pull request welcome" territory although it's intricate and laborious enough that it likely needs (edit: libuv and node) maintainer involvement. Probably a day or two, three of work. Get in touch if you want to sponsor it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked PRs that are blocked by other issues or PRs. http Issues or PRs related to the http subsystem. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

No branches or pull requests

6 participants