| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6cd0e26 commit de88255
8 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -255,9 +255,6 @@ Example: | |||
| 255 | 255 | ||
| 256 | 256 | Don't call `server.address()` until the `'listening'` event has been emitted. | |
| 257 | 257 | ||
| 258 | - This method used to return the file path as a string for UNIX sockets and | ||
| 259 | - Windows pipes. As of Node.js v4.0.0, it returns the expected object. | ||
| 260 | - | ||
| 261 | 258 | ### server.unref() | |
| 262 | 259 | ||
| 263 | 260 | Calling `unref` on a server will allow the program to exit if this is the only | |
@@ -511,37 +508,25 @@ Returns `socket`. | |||
| 511 | 508 | The string representation of the remote IP address. For example, | |
| 512 | 509 | `'74.125.127.100'` or `'2001:4860:a005::68'`. | |
| 513 | 510 | ||
| 514 | - For UNIX sockets and Windows pipes, the file path the socket is connected | ||
| 515 | - to. The remote address for server sockets is always `''`, the empty string. | ||
| 516 | - | ||
| 517 | 511 | ### socket.remoteFamily | |
| 518 | 512 | ||
| 519 | - The string representation of the remote IP family. `'IPv4'` or `'IPv6'` | ||
| 520 | - for TCP sockets, `'pipe'` for UNIX sockets and Windows pipes. | ||
| 513 | + The string representation of the remote IP family. `'IPv4'` or `'IPv6'`. | ||
| 521 | 514 | ||
| 522 | 515 | ### socket.remotePort | |
| 523 | 516 | ||
| 524 | - The numeric representation of the remote port. For example, `80` or `21`. | ||
| 525 | - `undefined` for UNIX sockets and Windows pipes. | ||
| 517 | + The numeric representation of the remote port. For example, | ||
| 518 | + `80` or `21`. | ||
| 526 | 519 | ||
| 527 | 520 | ### socket.localAddress | |
| 528 | 521 | ||
| 529 | 522 | The string representation of the local IP address the remote client is | |
| 530 | 523 | connecting on. For example, if you are listening on `'0.0.0.0'` and the | |
| 531 | 524 | client connects on `'192.168.1.1'`, the value would be `'192.168.1.1'`. | |
| 532 | 525 | ||
| 533 | - For UNIX sockets and Windows pipes, the file path the socket is listening | ||
| 534 | - on. The local address for client sockets is always `''`, the empty string. | ||
| 535 | - | ||
| 536 | - ### socket.localFamily | ||
| 537 | - | ||
| 538 | - The string representation of the local IP family. `'IPv4'` or `'IPv6'` | ||
| 539 | - for TCP sockets, `'pipe'` for UNIX sockets and Windows pipes. | ||
| 540 | - | ||
| 541 | 526 | ### socket.localPort | |
| 542 | 527 | ||
| 543 | - The numeric representation of the local port. For example, `80` or `21`. | ||
| 544 | - `undefined` for UNIX sockets and Windows pipes. | ||
| 528 | + The numeric representation of the local port. For example, | ||
| 529 | + `80` or `21`. | ||
| 545 | 530 | ||
| 546 | 531 | ### socket.bytesRead | |
| 547 | 532 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -606,9 +606,6 @@ Socket.prototype.__defineGetter__('localAddress', function() { | |||
| 606 | 606 | return this._getsockname().address; | |
| 607 | 607 | }); | |
| 608 | 608 | ||
| 609 | - Socket.prototype.__defineGetter__('localFamily', function() { | ||
| 610 | - return this._getsockname().family; | ||
| 611 | - }); | ||
| 612 | 609 | ||
| 613 | 610 | Socket.prototype.__defineGetter__('localPort', function() { | |
| 614 | 611 | return this._getsockname().port; | |
@@ -1342,14 +1339,16 @@ Server.prototype.listen = function() { | |||
| 1342 | 1339 | else | |
| 1343 | 1340 | listen(self, null, h.port | 0, 4, backlog, undefined, h.exclusive); | |
| 1344 | 1341 | } else if (h.path && isPipeName(h.path)) { | |
| 1345 | - listen(self, h.path, -1, -1, backlog, undefined, h.exclusive); | ||
| 1342 | + var pipeName = self._pipeName = h.path; | ||
| 1343 | + listen(self, pipeName, -1, -1, backlog, undefined, h.exclusive); | ||
| 1346 | 1344 | } else { | |
| 1347 | 1345 | throw new Error('Invalid listen argument: ' + h); | |
| 1348 | 1346 | } | |
| 1349 | 1347 | } | |
| 1350 | 1348 | } else if (isPipeName(arguments[0])) { | |
| 1351 | 1349 | // UNIX socket or Windows pipe. | |
| 1352 | - listen(self, arguments[0], -1, -1, backlog); | ||
| 1350 | + var pipeName = self._pipeName = arguments[0]; | ||
| 1351 | + listen(self, pipeName, -1, -1, backlog); | ||
| 1353 | 1352 | ||
| 1354 | 1353 | } else if (arguments[1] === undefined || | |
| 1355 | 1354 | typeof arguments[1] === 'function' || | |
@@ -1382,6 +1381,8 @@ Server.prototype.address = function() { | |||
| 1382 | 1381 | this._handle.getsockname(out); | |
| 1383 | 1382 | // TODO(bnoordhuis) Check err and throw? | |
| 1384 | 1383 | return out; | |
| 1384 | + } else if (this._pipeName) { | ||
| 1385 | + return this._pipeName; | ||
| 1385 | 1386 | } else { | |
| 1386 | 1387 | return null; | |
| 1387 | 1388 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -89,10 +89,6 @@ void PipeWrap::Initialize(Handle<Object> target, | |||
| 89 | 89 | env->SetProtoMethod(t, "listen", Listen); | |
| 90 | 90 | env->SetProtoMethod(t, "connect", Connect); | |
| 91 | 91 | env->SetProtoMethod(t, "open", Open); | |
| 92 | - env->SetProtoMethod(t, "getpeername", | ||
| 93 | - GetSockOrPeerName<uv_pipe_getpeername>); | ||
| 94 | - env->SetProtoMethod(t, "getsockname", | ||
| 95 | - GetSockOrPeerName<uv_pipe_getsockname>); | ||
| 96 | 92 | ||
| 97 | 93 | #ifdef _WIN32 | |
| 98 | 94 | env->SetProtoMethod(t, "setPendingInstances", SetPendingInstances); | |
@@ -280,28 +276,6 @@ void PipeWrap::Connect(const FunctionCallbackInfo<Value>& args) { | |||
| 280 | 276 | } | |
| 281 | 277 | ||
| 282 | 278 | ||
| 283 | - template <int (*F)(const uv_pipe_t*, char*, size_t*)> | ||
| 284 | - void PipeWrap::GetSockOrPeerName( | ||
| 285 | - const v8::FunctionCallbackInfo<v8::Value>& args) { | ||
| 286 | - CHECK(args[0]->IsObject()); | ||
| 287 | - char buffer[1024]; | ||
| 288 | - size_t size = sizeof(buffer); | ||
| 289 | - const PipeWrap* wrap = Unwrap<PipeWrap>(args.Holder()); | ||
| 290 | - const int err = F(&wrap->handle_, buffer, &size); | ||
| 291 | - if (err == 0) { | ||
| 292 | - const uint8_t* data = reinterpret_cast<const uint8_t*>(buffer); | ||
| 293 | - const String::NewStringType type = String::kNormalString; | ||
| 294 | - Local<String> path = | ||
| 295 | - String::NewFromOneByte(args.GetIsolate(), data, type, size); | ||
| 296 | - Environment* env = Environment::GetCurrent(args); | ||
| 297 | - Local<Object> out = args[0].As<Object>(); | ||
| 298 | - out->Set(env->address_string(), path); | ||
| 299 | - out->Set(env->family_string(), env->pipe_string()); | ||
| 300 | - } | ||
| 301 | - args.GetReturnValue().Set(err); | ||
| 302 | - } | ||
| 303 | - | ||
| 304 | - | ||
| 305 | 279 | } // namespace node | |
| 306 | 280 | ||
| 307 | 281 | NODE_MODULE_CONTEXT_AWARE_BUILTIN(pipe_wrap, node::PipeWrap::Initialize) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,9 +30,6 @@ class PipeWrap : public StreamWrap { | |||
| 30 | 30 | static void Connect(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 31 | 31 | static void Open(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 32 | 32 | ||
| 33 | - template <int (*F)(const uv_pipe_t*, char*, size_t*)> | ||
| 34 | - static void GetSockOrPeerName(const v8::FunctionCallbackInfo<v8::Value>&); | ||
| 35 | - | ||
| 36 | 33 | #ifdef _WIN32 | |
| 37 | 34 | static void SetPendingInstances( | |
| 38 | 35 | const v8::FunctionCallbackInfo<v8::Value>& args); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -134,7 +134,7 @@ Object.defineProperty(exports, 'hasCrypto', {get: function() { | |||
| 134 | 134 | }}); | |
| 135 | 135 | ||
| 136 | 136 | if (exports.isWindows) { | |
| 137 | - exports.PIPE = '\\\\?\\pipe\\libuv-test'; | ||
| 137 | + exports.PIPE = '\\\\.\\pipe\\libuv-test'; | ||
| 138 | 138 | } else { | |
| 139 | 139 | exports.PIPE = exports.tmpDir + '/test.sock'; | |
| 140 | 140 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,12 +29,8 @@ if (cluster.isMaster) { | |||
| 29 | 29 | } | |
| 30 | 30 | ||
| 31 | 31 | http.createServer(function(req, res) { | |
| 32 | - assert.equal(req.connection.remoteAddress, ''); | ||
| 33 | - assert.equal(req.connection.remoteFamily, 'pipe'); | ||
| 34 | - assert.equal(req.connection.remotePort, undefined); | ||
| 35 | - assert.equal(req.connection.localAddress, common.PIPE); | ||
| 36 | - assert.equal(req.connection.localFamily, 'pipe'); | ||
| 37 | - assert.equal(req.connection.localPort, undefined); | ||
| 32 | + assert.equal(req.connection.remoteAddress, undefined); | ||
| 33 | + assert.equal(req.connection.localAddress, undefined); // TODO common.PIPE? | ||
| 38 | 34 | res.writeHead(200); | |
| 39 | 35 | res.end('OK'); | |
| 40 | 36 | }).listen(common.PIPE, function() { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,7 +9,6 @@ var headers_ok = false; | |||
| 9 | 9 | var body_ok = false; | |
| 10 | 10 | ||
| 11 | 11 | var server = http.createServer(function(req, res) { | |
| 12 | - assert.equal(req.socket.address().address, common.PIPE); | ||
| 13 | 12 | res.writeHead(200, { | |
| 14 | 13 | 'Content-Type': 'text/plain', | |
| 15 | 14 | 'Connection': 'close' | |
@@ -20,7 +19,6 @@ var server = http.createServer(function(req, res) { | |||
| 20 | 19 | }); | |
| 21 | 20 | ||
| 22 | 21 | server.listen(common.PIPE, function() { | |
| 23 | - assert.equal(server.address().address, common.PIPE); | ||
| 24 | 22 | ||
| 25 | 23 | var options = { | |
| 26 | 24 | socketPath: common.PIPE, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,6 +15,5 @@ server.listen(common.PIPE, function() { | |||
| 15 | 15 | }); | |
| 16 | 16 | ||
| 17 | 17 | process.on('exit', function() { | |
| 18 | - assert.equal(address.address, common.PIPE); | ||
| 19 | - assert.equal(address.family, 'pipe'); | ||
| 18 | + assert.equal(address, common.PIPE); | ||
| 20 | 19 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments