docs: a Host carrying a slash is not refused - #164
Merged
Merged
Conversation
The path check compares the raw path in request.url with URL.pathname. When Host carries "/", Deno.serve builds a URL such as http://localhost/docs/identity whose raw and parsed paths agree, so the request is not refused and both routers route the same path. Only a Host carrying "?" or "\" shifts the path and is refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🎉 This PR is included in version 0.17.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Summary
This corrects the claim that #163 added to the
createServerJSDoc, theisUnresolvedPathJSDoc anddocs/middleware.md. AHostheader carrying/is not refused.Deno.servebuilds a URL such ashttp://localhost/docs/identity, whose raw path andURL.pathnameagree, so both routers route the same path. Only aHostcarrying?or\shifts the parsed path and is refused.This was measured from udibo over a raw socket.
Host: localhost/docswithGET /identityreturned 200 from/docs/identity, whileHost: localhost?xandHost: localhost\xreturned 400 (pinned in udibo'sroutes/path-normalization.test.ts, udibo/udibo#1540).Changes
src/server.tsx: both JSDoc blocks now say "?or\" and state that aHostcarrying/is not refused.docs/middleware.md: the same correction.Testing
Documentation only.
deno task checkpasses (doc-lint clean), anddeno task test --parallel --reporter=dotgives 60 passed, 0 failed.Closes
Nothing.
🤖 Generated with Claude Code