Skip to content

feat(client): parse unix:// URLs in parseURL#3271

Open
nkaradzhov wants to merge 2 commits into
redis:masterfrom
nkaradzhov:feat/parse-url-unix-socket
Open

feat(client): parse unix:// URLs in parseURL#3271
nkaradzhov wants to merge 2 commits into
redis:masterfrom
nkaradzhov:feat/parse-url-unix-socket

Conversation

@nkaradzhov
Copy link
Copy Markdown
Collaborator

@nkaradzhov nkaradzhov commented May 15, 2026

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 #2530

Description

Describe your pull request here


Checklist

  • Does npm test pass with this change (including linting)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?

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 url by extending RedisClient.parseURL to parse unix://[user[:password]@]/path/to/socket[?db=N] (including decoding percent-encoded paths, optional credentials, and db query 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 (ProxyClient generics, @ts-expect-error, safer MULTI constructor cast) and a couple of targeted eslint suppressions for any push handlers.

Reviewed by Cursor Bugbot for commit 96b97ba. Bugbot is set up for automated code reviews on this repo. Configure here.

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>
@nkaradzhov nkaradzhov requested a review from PavelPashov May 15, 2026 09:44
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Have parseUrl handle unix domain sockets

1 participant