You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tolerate repeated and trailing slashes when routing request paths #118
The request router exact-matches the path after stripping the /vss prefix, so any request carrying a redundant slash falls through to 400 Invalid request path. This is easy to hit by accident, because clients build the endpoint URL by appending to a user-supplied base URL.
Reproduction
A base URL of https://host/vss/ (trailing slash) produces https://host/vss//getObject. The server then sees:
path = "/vss//getObject"
strip_prefix("/vss") -> "//getObject"
match -> falls through to `_` -> 400 "Invalid request path."
Why this is worth fixing
The failure is silent in a specific way. ldk-node surfaces it as "can't read from store", which is the identical error returned when the VSS database is empty or the server is otherwise misconfigured. That ambiguity is why lightningdevkit/ldk-node#672 took as long to diagnose as it
did.
Proposed change
Normalize the path once, before the prefix strip and the match: collapse runs of / into one and drop a trailing /.
That normalization cannot change meaning in this API: four fixed endpoints, no path parameters, no resource hierarchy, so /vss//getObject cannot denote anything other than /vss/getObject.
This is the tolerance half. The client emits the bad path in the first place and will be fixed separately, that half makes requests correct against any VSS implementation, this half makes clients already deployed against an older vss-client-ng work again. Both are wanted, and per the note in vss-client-ng's 0.6.0 changelog a server release should land ahead of the matching client release.
Activity