Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 22, 2026

The HttpServer was hardcoding 127.0.0.1 for the endpoint URL instead of reading the actual bound address, and lacked IPv6 support.

Changes

  • Read actual bound address: Extract IP and port from server.address() instead of assuming hardcoded values
  • IPv6 bracket notation: Format IPv6 addresses as [address]:port, IPv4 as address:port
  • Bind to 'localhost': Changed from '127.0.0.1' to allow system DNS resolution to choose IPv4 (127.0.0.1) or IPv6 (::1) loopback
  • Type safety: Import AddressInfo from node:net, add guards for null and string pipe paths
  • Extract formatAddress() helper: Centralize formatting logic with proper IPv6 detection
// Before
const endpoint = `ws://${LOCALHOST_IP}:${this._listeningPort}`;

// After
const addressInfo = this._server.address();
const formattedAddress = formatAddress(addressInfo); // Handles IPv4/IPv6
const endpoint = `ws://${formattedAddress}`;

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 7 commits January 22, 2026 00:04
Co-authored-by: TheLarkInn <3408176+TheLarkInn@users.noreply.github.com>
…Pv4 or IPv6

Co-authored-by: TheLarkInn <3408176+TheLarkInn@users.noreply.github.com>
Co-authored-by: TheLarkInn <3408176+TheLarkInn@users.noreply.github.com>
Co-authored-by: TheLarkInn <3408176+TheLarkInn@users.noreply.github.com>
Co-authored-by: TheLarkInn <3408176+TheLarkInn@users.noreply.github.com>
Co-authored-by: TheLarkInn <3408176+TheLarkInn@users.noreply.github.com>
Co-authored-by: TheLarkInn <3408176+TheLarkInn@users.noreply.github.com>
Copilot AI changed the title [WIP] Update implementation based on feedback for Playwright browser server Read bound address from server.address() and handle IPv6 formatting Jan 22, 2026
Copilot AI requested a review from TheLarkInn January 22, 2026 00:13
@TheLarkInn TheLarkInn marked this pull request as ready for review January 22, 2026 00:31
@TheLarkInn TheLarkInn merged commit e6f1984 into bmiddha/playwright-browser-server Jan 22, 2026
1 check passed
@TheLarkInn TheLarkInn deleted the copilot/sub-pr-5424-another-one branch January 22, 2026 00:31
@github-project-automation github-project-automation bot moved this from Needs triage to Closed in Bug Triage Jan 22, 2026
TheLarkInn added a commit that referenced this pull request Jan 22, 2026
…5557)

* Initial plan

* Read IP address from server.address() and handle IPv6 formatting

Co-authored-by: TheLarkInn <3408176+TheLarkInn@users.noreply.github.com>

* Use 'localhost' instead of hardcoded IPv4 to allow system to choose IPv4 or IPv6

Co-authored-by: TheLarkInn <3408176+TheLarkInn@users.noreply.github.com>

* Rename address variable to formattedAddress for clarity

Co-authored-by: TheLarkInn <3408176+TheLarkInn@users.noreply.github.com>

* Add null check and handle both string and number IPv6 family values

Co-authored-by: TheLarkInn <3408176+TheLarkInn@users.noreply.github.com>

* Import AddressInfo from node:net and fix IPv6 family check

Co-authored-by: TheLarkInn <3408176+TheLarkInn@users.noreply.github.com>

* Improve type safety for server.address() return value

Co-authored-by: TheLarkInn <3408176+TheLarkInn@users.noreply.github.com>

* Extract formatAddress helper and improve error messages

Co-authored-by: TheLarkInn <3408176+TheLarkInn@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: TheLarkInn <3408176+TheLarkInn@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

2 participants