Repository navigation
fix: validate --listen port numbers instead of crashing with RangeError - #866
Closed
charan-rathore wants to merge 1 commit into
Closed
charan-rathore wants to merge 1 commit into
charan-rathore wants to merge 1 commit into
Conversation
|
@charan-rathore is attempting to deploy a commit to the Internal Playground Team on Vercel. A member of the Team first needs to authorize it. |
Author
|
This one has been quiet, so I am closing it for now. Happy to reopen if it becomes useful. |
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.
Related Issues
No tracking issue; found while testing the CLI.
Description
Changed
parseEndpointnow checks that a numeric endpoint is an integer from 0 to 65535 and throwsInvalid port number: <value>otherwise, for both bare ports andtcp://endpoints. Before,serve --listen 99999(also negative, fractional, non-finite, ortcp://host:99999) went straight to the socket layer and crashed with a rawRangeError [ERR_SOCKET_BAD_PORT]stack trace.invalidEndpointstable intests/cli.test.ts, and a patch changeset.Caveats/Problems/Issues
Exactly the 5 new cases fail on the unpatched base;
tests/cli.test.tspasses 16/16 with the change. Compiled CLI:--listen 99999and--listen 3000.5print "Invalid port number: ..." and--listen 4117serves HTTP 200. Tests ran throughpnpm test(the repo config); barevitestshows a help-text snapshot mismatch that is also present on the base.Checklist
pnpm test) pass.pnpm lint) does not throw an errors.methods/classes/constants/types have been annotated with TSDoc comments.