mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 20:30:41 +00:00

By resolving localhost to an actual IP for the httpd.js server allows us to supply unique URLs for the CDP and WebDriver BiDi WebSocket connection details and CDP's JSON handler end-points. Hereby the first resolved IP will be used which should always be the local IPv4 address (127.0.0.1). If IPv4 is disabled `[::1]` will be used. It will prevent issues especially on dualstack systems where DNS resolution might prefer IPv6 over IPv4 (like with node.js > 16). Differential Revision: https://phabricator.services.mozilla.com/D154151
These files provide functionality for serving and responding to HTTP
requests, and handling WebSocket connections. For this we rely on
httpd.js and the chrome-only WebSocket.createServerWebSocket function.
Generally speaking, this is all held together with a piece of string.
It is a known problem that we do not have a high-quality HTTPD
implementation in central, and we’d like to move away from using
any of this code.