net: fix SocketAddress.parse default port handling#62912
Open
araujogui wants to merge 3 commits intonodejs:mainfrom
Open
net: fix SocketAddress.parse default port handling#62912araujogui wants to merge 3 commits intonodejs:mainfrom
araujogui wants to merge 3 commits intonodejs:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes net.SocketAddress.parse() so it correctly preserves explicit default ports (notably :80) that are otherwise dropped by URL.parse() when using an http:// base, aligning behavior with expectations and documentation.
Changes:
- Update
SocketAddress.parse()to derive the port from the raw input string rather thanurl.port. - Simplify the parse return path to a single
SocketAddressconstruction for both IPv4 and IPv6. - Add regression tests covering IPv4/IPv6 with explicit ports
80and443.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
lib/internal/socketaddress.js |
Fixes default-port handling by parsing the port from the raw input instead of URLParse(...).port. |
test/parallel/test-socketaddress.js |
Adds regression coverage ensuring explicit :80/:443 are preserved for both IPv4 and IPv6. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #62912 +/- ##
==========================================
+ Coverage 89.62% 89.63% +0.01%
==========================================
Files 706 706
Lines 219203 219208 +5
Branches 41996 42003 +7
==========================================
+ Hits 196454 196486 +32
+ Misses 14658 14615 -43
- Partials 8091 8107 +16
🚀 New features to boost your workflow:
|
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.
Fixes #62906