Streaming: Fix BIND IPv6 handling (#31624)
Some checks failed
Check i18n / check-i18n (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (ruby) (push) Has been cancelled
Check formatting / lint (push) Has been cancelled
JavaScript Linting / lint (push) Has been cancelled
Ruby Linting / lint (push) Has been cancelled
JavaScript Testing / test (push) Has been cancelled
Historical data migration test / test (14-alpine) (push) Has been cancelled
Historical data migration test / test (15-alpine) (push) Has been cancelled
Ruby Testing / build (production) (push) Has been cancelled
Ruby Testing / build (test) (push) Has been cancelled
Ruby Testing / test (.ruby-version) (push) Has been cancelled
Ruby Testing / test (3.1) (push) Has been cancelled
Ruby Testing / test (3.2) (push) Has been cancelled
Ruby Testing / Libvips tests (.ruby-version) (push) Has been cancelled
Ruby Testing / Libvips tests (3.1) (push) Has been cancelled
Ruby Testing / Libvips tests (3.2) (push) Has been cancelled
Ruby Testing / End to End testing (.ruby-version) (push) Has been cancelled
Ruby Testing / End to End testing (3.1) (push) Has been cancelled
Ruby Testing / End to End testing (3.2) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.10.2) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (3.1, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (3.2, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Has been cancelled

This commit is contained in:
Emelia Smith 2024-08-28 12:40:37 +02:00 committed by GitHub
parent 3c412578c9
commit f6fb9b75db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1351,15 +1351,23 @@ const startServer = async () => {
* @param {function(string): void} [onSuccess] * @param {function(string): void} [onSuccess]
*/ */
const attachServerWithConfig = (server, onSuccess) => { const attachServerWithConfig = (server, onSuccess) => {
if (process.env.SOCKET || process.env.PORT && isNaN(+process.env.PORT)) { if (process.env.SOCKET) {
server.listen(process.env.SOCKET || process.env.PORT, () => { server.listen(process.env.SOCKET, () => {
if (onSuccess) { if (onSuccess) {
fs.chmodSync(server.address(), 0o666); fs.chmodSync(server.address(), 0o666);
onSuccess(server.address()); onSuccess(server.address());
} }
}); });
} else { } else {
server.listen(+(process.env.PORT || 4000), process.env.BIND || '127.0.0.1', () => { const port = +(process.env.PORT || 4000);
let bind = process.env.BIND ?? '127.0.0.1';
// Web uses the URI syntax for BIND, which means IPv6 addresses may
// be wrapped in square brackets:
if (bind.startsWith('[') && bind.endsWith(']')) {
bind = bind.slice(1, -1);
}
server.listen(port, bind, () => {
if (onSuccess) { if (onSuccess) {
onSuccess(`${server.address().address}:${server.address().port}`); onSuccess(`${server.address().address}:${server.address().port}`);
} }