Repository navigation
Percent-decode the IPC path of ws+unix: URLs - #2346
Closed
nk-batman21 wants to merge 1 commit into
Closed
nk-batman21 wants to merge 1 commit into
nk-batman21 wants to merge 1 commit into
Conversation
The IPC path is taken from the URL pathname, which is percent-encoded, so a UNIX domain socket whose path contains a space or a non-ASCII character, or a named pipe whose name contains a non-ASCII character, could not be reached. For example, `ws+unix:\\.\pipe\ws-café:/chat` failed with `connect ENOENT \\.\pipe\ws-caf%C3%A9`. Decode the IPC path after splitting it from the URL path, and use it as is if it is not valid percent-encoding.
Member
|
I don't think this is needed, what is the reason for using non-ASCII characters? I can't remember open issues for this. |
Contributor
Author
|
@lpinca the more common case is a space rather than non-ASCII. |
Member
|
At the moment, it seems like a solution in search of a problem. We can revisit the matter if someone actually ends up needing it. Thank you anyway. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The IPC path of a
ws+unix:URL is cut out ofURL#pathname, which is percent-encoded, and passed tonet.connect()without decoding. So a UNIX domain socket whose path contains a space or a non-ASCII character, or a named pipe whose name contains a non-ASCII character, cannot be reached. For example, with a server listening on\\.\pipe\ws-café:The same happens with a space in a socket path, which is common on macOS (
~/Library/Application Support/<app>/app.sockis passed asApplication%20Support). There is no workaround short of a customcreateConnection, becausesocketPathis always overridden.This decodes the IPC path after it is split from the URL path, so an encoded
%3Acannot move the separator. If the IPC path is not valid percent-encoding it is used as is:ws+unix:/tmp/100%.sockworks today and keeps working, and decoding cannot throw from the redirect handler.Ran:
npm test(441 passing, 1 pending) andnpm run linton Node.js 24, Windows. The decode test fails without the change.Checked: a client connecting to a named pipe with
éin its name gets ENOENT before the change and opens after it.