0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 21:19:50 +01:00
nodejs/test/parallel/test-pipe-abstract-socket-http.js
Geoff Goodman 553169f19a
src: port Pipe to uv_pipe_bind2, uv_pipe_connect2
The introduction of the uv_pipe_bind2 and uv_pipe_connect2 methods in
libuv v1.46.0 changed the behaviour of uv_pipe_bind and uv_pipe_connect.
This broke the ability to connect to abstract domain sockets on linux.
This change ports PipeWrap to use the new uv_pipe_bind2 and
uv_pipe_connect2 methods to restore abstract domain socket support.

Fixes: https://github.com/nodejs/node/issues/49656
Refs: https://github.com/libuv/libuv/pull/4030
PR-URL: https://github.com/nodejs/node/pull/49667
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2023-09-18 07:11:22 +00:00

28 lines
505 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const http = require('http');
if (!common.isLinux) common.skip();
const server = http.createServer(
common.mustCall((req, res) => {
res.end('ok');
})
);
server.listen(
'\0abstract',
common.mustCall(() => {
http.get(
{
socketPath: server.address(),
},
common.mustCall((res) => {
assert.strictEqual(res.statusCode, 200);
server.close();
})
);
})
);