PlcClient: all DID-path requests break — 'did:plc:…' parses as an absolute URI and bypasses BaseAddress #47

Closed
opened 2026-07-05 17:45:02 +00:00 by Grandiras · 0 comments
Owner

Every PlcClient request that puts the DID in the path fails with:

System.NotSupportedException: The 'did' scheme is not supported.

Cause: _httpClient.GetAsync(did, …) (and $"{did}/log" etc.) passes a string like did:plc:xyz to HttpClient, and did:plc:xyz parses as an absolute URI with scheme did — so the configured BaseAddress (https://plc.directory/) is ignored and SocketsHttpHandler rejects the scheme. Affected call sites: ResolveDidAsync, GetOperationLogAsync, GetAuditLogAsync, GetLastOperationAsync, GetPlcDataAsync (PlcClient.cs lines 68/101/121/141/164). _health is fine.

Fix: prefix the relative reference per RFC 3986 — _httpClient.GetAsync("./" + did, …) — so it combines with BaseAddress to https://plc.directory/did:plc:xyz.

Found in the wild: Mise's backfill resolved 0/59 repos because every did:plc lookup failed. Presumably unit tests never hit this because they stub the handler with absolute expectations or use the two-arg HttpClient ctor differently; an integration test against plc.directory would have caught it.

Every `PlcClient` request that puts the DID in the path fails with: ``` System.NotSupportedException: The 'did' scheme is not supported. ``` Cause: `_httpClient.GetAsync(did, …)` (and `$"{did}/log"` etc.) passes a string like `did:plc:xyz` to HttpClient, and `did:plc:xyz` parses as an **absolute** URI with scheme `did` — so the configured `BaseAddress` (`https://plc.directory/`) is ignored and SocketsHttpHandler rejects the scheme. Affected call sites: `ResolveDidAsync`, `GetOperationLogAsync`, `GetAuditLogAsync`, `GetLastOperationAsync`, `GetPlcDataAsync` (PlcClient.cs lines 68/101/121/141/164). `_health` is fine. Fix: prefix the relative reference per RFC 3986 — `_httpClient.GetAsync("./" + did, …)` — so it combines with BaseAddress to `https://plc.directory/did:plc:xyz`. Found in the wild: Mise's backfill resolved 0/59 repos because every `did:plc` lookup failed. Presumably unit tests never hit this because they stub the handler with absolute expectations or use the two-arg HttpClient ctor differently; an integration test against plc.directory would have caught it.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Grandiras/ATProto.NET#47
No description provided.