mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
lib,src: add unix socket getsockname/getpeername
The implementation is a minor API change in that socket.address() now returns a `{ address: '/path/to/socket' }` object, like it does for TCP and UDP sockets. Before this commit, it returned `socket._pipeName`, which is a string when present. Change common.PIPE on Windows from '\\\\.\\pipe\\libuv-test' to '\\\\?\\pipe\\libuv-test'. Windows converts the '.' to a '?' when creating a named pipe, meaning that common.PIPE didn't match the result from NtQueryInformationFile(). Fixes: https://github.com/nodejs/node/issues/954 PR-URL: https://github.com/nodejs/node/pull/956 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
This commit is contained in:
parent
a43af39ffc
commit
f337595441
8 changed files with 56 additions and 15 deletions
|
@ -9,6 +9,7 @@ var headers_ok = false;
|
|||
var body_ok = false;
|
||||
|
||||
var server = http.createServer(function(req, res) {
|
||||
assert.equal(req.socket.address().address, common.PIPE);
|
||||
res.writeHead(200, {
|
||||
'Content-Type': 'text/plain',
|
||||
'Connection': 'close'
|
||||
|
@ -19,6 +20,7 @@ var server = http.createServer(function(req, res) {
|
|||
});
|
||||
|
||||
server.listen(common.PIPE, function() {
|
||||
assert.equal(server.address().address, common.PIPE);
|
||||
|
||||
var options = {
|
||||
socketPath: common.PIPE,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue