feat(client): parse unix:// URLs in parseURL#3271
Open
nkaradzhov wants to merge 2 commits into
Open
Conversation
Accept `unix://[user[:password]@]/path/to/sock[?db=N]` so users can configure UNIX-domain-socket connections via a URL string, matching the scheme supported by redis-py. The underlying socket layer already handles UDS via `socket.path`; this only adds the URL convenience layer. WHATWG URL refuses to parse an authority without a host on non-special schemes, so the unix branch uses a small regex instead of `new URL`. Closes redis#2530 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The lint:changed CI gate lints the full file when any line is touched,
which surfaced 11 pre-existing errors after this branch added the
unix:// URL parser. Type the ProxyClient alias with proper constraint
types, replace the Multi proxy cast with `unknown as { Multi }`,
upgrade `@ts-ignore` to `@ts-expect-error` with a description, and
silence the remaining intentional `any` usages (SingleEntryCache,
push handlers) with targeted disable comments to keep the PR scoped.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Accept
unix://[user[:password]@]/path/to/sock[?db=N]so users can configure UNIX-domain-socket connections via a URL string, matching the scheme supported by redis-py. The underlying socket layer already handles UDS viasocket.path; this only adds the URL convenience layer.WHATWG URL refuses to parse an authority without a host on non-special schemes, so the unix branch uses a small regex instead of
new URL.Closes #2530
Description
Checklist
npm testpass with this change (including linting)?Note
Medium Risk
Changes connection URL parsing to accept
unix://schemes, which can affect how clients derive socket/auth/db options and may reject previously-accepted edge-case URLs. Scope is limited and covered by new unit tests and docs updates.Overview
Adds support for configuring UNIX domain socket connections via
urlby extendingRedisClient.parseURLto parseunix://[user[:password]@]/path/to/socket[?db=N](including decoding percent-encoded paths, optional credentials, anddbquery param validation).Updates docs to advertise the new
unix://URL format, and adds a focused test suite for valid/invalid UNIX-socket URL cases. Includes small TypeScript typing cleanups (ProxyClientgenerics,@ts-expect-error, saferMULTIconstructor cast) and a couple of targetedeslintsuppressions foranypush handlers.Reviewed by Cursor Bugbot for commit 96b97ba. Bugbot is set up for automated code reviews on this repo. Configure here.