Граф коммитов

4081 Коммитов

Автор SHA1 Сообщение Дата
Evan Lucas 804d57db67 process: improve performance of nextTick
This replaces TickObject with an object literal. This offers
performance improvements of up to ~20%.

PR-URL: https://github.com/nodejs/node/pull/8932
Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-10-13 12:16:52 -05:00
Ben Noordhuis 4f62acd9c5 http: reject control characters in http.request()
Unsanitized paths containing line feed characters can be used for
header injection and request splitting so reject them with an exception.

There seems to be no reasonable use case for allowing control characters
(characters <= 31) while there are several scenarios where they can be
used to exploit software bugs so reject control characters altogether.

PR-URL: https://github.com/nodejs/node/pull/8923
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: not-an-aardvark <not-an-aardvark@users.noreply.github.com>
2016-10-13 13:32:45 +02:00
James M Snell 4b312387ea url: adding WHATWG URL support
Implements WHATWG URL support. Example:

```
var u = new url.URL('http://example.org');
```

Currently passing all WHATWG url parsing tests and all but two of the
setter tests. The two setter tests are intentionally skipped for now
but will be revisited.

PR-URL: https://github.com/nodejs/node/pull/7448
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
2016-10-11 12:41:42 -07:00
Brian White c9dade48b4 buffer: make byteLength throw on invalid input
PR-URL: https://github.com/nodejs/node/pull/8946
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-10-10 12:57:27 -07:00
Anna Henningsen a60f6078a1
fs: make `SyncWriteStream` inherit from `Writable`
Make the internal `SyncWriteStream` a proper `stream.Writable`
subclass. This allows for quite a bit of simplification, since
`SyncWriteStream` predates the streams2/streams3 implementations.

Fixes: https://github.com/nodejs/node/issues/8828
PR-URL: https://github.com/nodejs/node/pull/8830
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2016-10-10 18:15:49 +02:00
Anna Henningsen 2a4b068aca
stream: proper `instanceof` for `Writable`s
Use `[Symbol.hasInstance]()` to return `true` when asking for
`new Duplex() instanceof Writable`.

PR-URL: https://github.com/nodejs/node/pull/8834
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Calvin Metcalf <calvin.metcalf@gmail.com>
2016-10-10 18:05:23 +02:00
Mariusz 'koder' Chwalba c7bc9bcfbf tls: TLSSocket emits 'error' on handshake failure
Removes branch that would make TLSSocket emit '_tlsError' event if error
occured on handshake and control was not released, as it was never happening.
Addedd test for tls.Server to ensure it still emits 'tlsClientError' as expected.

Fixes: https://github.com/nodejs/node/issues/8803
PR-URL: https://github.com/nodejs/node/pull/8805
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2016-10-10 09:59:31 +02:00
Sakthipriyan Vairamani (thefourtheye) 7542bdddda
fs: don't alter user provided `options` object
This patch makes a copy of the `options` object before the fs module
functions alter it.

PR-URL: https://github.com/nodejs/node/pull/7831
Fixes: https://github.com/nodejs/node/pull/7655
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Nicu Micleușanu <micnic90@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2016-10-09 19:37:59 +05:30
Adri Van Houdt 4d6297fef0 module: Remove deprecated function requireRepl.
Refs: https://github.com/nodejs/node/issues/4642
PR-URL: https://github.com/nodejs/node/pull/8575
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-10-07 12:51:52 -07:00
Rémy MEJA ae9d146331 lib: minor improvements to bootstrap_node.js
Change '==' to '==='

PR-URL: https://github.com/nodejs/node/pull/8906
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-10-07 10:37:22 -07:00
Michaël Zasso 105e628f84 intl: add deprecation warning for v8BreakIterator
Fixes: https://github.com/nodejs/node/issues/8865
PR-URL: https://github.com/nodejs/node/pull/8908
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-10-07 09:29:50 -07:00
Adri Van Houdt b2534f11c6 lib: changed var to const in linkedlist
PR-URL: https://github.com/nodejs/node/pull/8609
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2016-10-06 16:06:19 -07:00
Ojas Shirekar 2154bc89d8
buffer: fix check for `.buffer` property
isSharedArrayBuffer in fromObject was missing obj.buffer
moved the 'length' in obj check so that it is checked first making
the code slightly more performant and able to handle SharedArrayBuffer
without relying on an explicit check.

Ref: https://github.com/nodejs/node/pull/8510
PR-URL: https://github.com/nodejs/node/pull/8739
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-10-07 00:57:35 +02:00
Сковорода Никита Андреевич 0f944ab3cf dgram: use Buffer.alloc(0) for zero-size buffers
There is no difference between alloc(0) and allocUnsafe(0), so there is
no reason to confuse anyone reading the code with an additional call to
allocUnsafe.

PR-URL: https://github.com/nodejs/node/pull/8751
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-10-06 15:27:52 -07:00
Wyatt Preul 47d1588e75 lib: fix TypeError in v8-polyfill
PR-URL: https://github.com/nodejs/node/pull/8863
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-10-06 10:10:19 -07:00
Miguel Angel Asencio Hurtado 7a94e2d673
readline: fix `concievably` typo in readline.js
Fixes: https://github.com/nodejs/node/issues/8951
PR-URL: https://github.com/nodejs/node/pull/8953
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-10-06 18:22:30 +02:00
Sakthipriyan Vairamani e8e969a5c1 fs: refactor "options" processing as a function
As it is, the "options" processing is repeated in all the functions
which need it. That introduces checks which are inconsistent with
other functions and produces slightly different error messages.

This patch moves the basic "options" validation and processing to a
seperate function.

PR-URL: https://github.com/nodejs/node/pull/7165
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Nicu Micleușanu <micnic90@gmail.com>
Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-10-06 00:16:13 +05:30
Brian White 0ed8839a27
timers: improve setImmediate() performance
This commit avoids re-creating a new immediate queue object every
time the immediate queue is processed. Additionally, a few functions
are tweaked to make them inlineable.

These changes give ~6-7% boost in setImmediate() performance in the
existing setImmediate() benchmarks.

PR-URL: https://github.com/nodejs/node/pull/8655
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2016-10-05 03:09:55 -04:00
Myles Borins 2e568d95bd lib: remove let from for loops
This is a known de-opt. It may not be 100% necessary in all cases but it
seems like a decent enough idea to avoid it.

PR-URL: https://github.com/nodejs/node/pull/8873
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2016-10-04 12:17:32 -04:00
Fedor Indutny d33c4bf97b tls: handle `error` events with `_tlsError`
Previously `TLSSocket#_emitTLSError` was used as an `error` event
handler. However that function can emit `error` event itself, so it is
not suitable for such use. Luckily the event can be emitted only when
the control is released, so this looping-error can't happen.

Replace the error handler for clarity and correctness.

PR-URL: https://github.com/nodejs/node/pull/8889
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-10-04 01:44:53 +02:00
Bryan English 4c619ec421 module: fix comment from "read-only" to "shallow"
The comment here was misleading, implying that the property was being
copied as a read-only, when in fact it's just a shallow copy. This
serves the purpose of providing the array for introspection, but it
isn't read-only.

PR-URL: https://github.com/nodejs/node/pull/8887
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
2016-10-03 12:48:21 +02:00
Brian White 9eb61793bf cluster: remove unused backlog argument
PR-URL: https://github.com/nodejs/node/pull/8877
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
2016-10-03 12:34:46 +02:00
Brian White c8c2544cd9
timers: improve setTimeout/Interval performance
This commit improves timers performance by making functions
inlineable and avoiding the creation of extra closures/functions.

This commit also makes setTimeout/Interval argument handling
consistent with that of setImmediate.

These changes give ~22% improvement in the existing 'breadth' timers
benchmark.

PR-URL: https://github.com/nodejs/node/pull/8661
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2016-10-01 02:58:42 -04:00
Madhav Gharmalkar 4c61f57f1b src: fixes misplaced comment
In e26622b, a comment was incorrectly moved from the code
it was describing.

Fixes: https://github.com/nodejs/node/issues/8856
PR-URL: https://github.com/nodejs/node/pull/8860
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-09-30 09:47:09 -07:00
Anna Henningsen c084287a60
fs,module: add module-loader-only realpath cache
Reintroduce a realpath cache with the same mechanisms which existed
before b488b19eaf
(`fs: optimize realpath using uv_fs_realpath()`), but only for
the synchronous version and with the cache being passed as a
hidden option to make sure it is only used internally.

The cache is hidden from userland applications because it has been
decided that fully reintroducing as part of the public API might stand
in the way of future optimizations.

PR-URL: https://github.com/nodejs/node/pull/8100
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-09-30 16:01:59 +02:00
yorkie 7bc6aeac86 dns: remove internal variable from makeAsync
PR-URL: https://github.com/nodejs/node/pull/8800
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-09-30 10:02:39 +08:00
Italo A. Casas 560a589e75 stream: improve stream error messages
Improve message when tranform._transform() method is not implemented
Improve error message when Readable._read() is not implemented
Remove extra word in err msg when Writable._write() when not implemented
Remove extra word in err msg when Transform._transform() when not implemented

PR-URL: https://github.com/nodejs/node/pull/8801
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
2016-09-29 23:06:51 +03:00
Сковорода Никита Андреевич 495d688e06 buffer: zero-fill uninitialized bytes in .concat()
This makes sure that no uninitialized bytes are leaked when the specified
`totalLength` input value is greater than the actual total length of the
specified buffers array, e.g. in Buffer.concat([Buffer.alloc(0)], 100).

PR-URL: https://github.com/nodejs/node-private/pull/64
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-09-28 11:19:18 +10:00
Ben Noordhuis c34e58e684 lib: make tls.checkServerIdentity() more strict
PR-URL: https://github.com/nodejs/node-private/pull/75
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-09-28 11:19:18 +10:00
Evan Lucas ca5f8f80e3 http: check reason chars in writeHead
Previously, the reason argument passed to ServerResponse#writeHead was
not being properly validated.  One could pass CRLFs which could lead to
http response splitting. This commit changes the behavior to throw an
error in the event any invalid characters are included in the reason.

CVE-2016-5325

PR-URL: https://github.com/nodejs/node-private/pull/60
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
2016-09-28 11:19:18 +10:00
yorkie f4d7abf3bc tls: improve createSecureContext in _tls_common
- this shares the iterator variable `i` expictly.
- this converts some var to const.

PR-URL: https://github.com/nodejs/node/pull/8781
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-09-28 09:15:27 +08:00
Michaël Zasso 558a884d41 buffer: fix performance regression
V8 5.4 changed the way that the default constructor of derived classes
is called. It introduced a significant performance regression in the
buffer module for the creation of pooled buffers. This commit forces the
definition back to how it was implicitly before.

Ref: https://bugs.chromium.org/p/v8/issues/detail?id=4890

PR-URL: https://github.com/nodejs/node/pull/8754
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
2016-09-26 20:14:32 +02:00
Yosuke Furukawa ce7d3077dc util: Add format for SharedArrayBuffer
PR-URL: https://github.com/nodejs/node/pull/8587
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-09-26 08:07:04 -07:00
Rene Weber c9b59e8387 http: socket connection timeout for http request
This allows passing the socket connection timeout to http#request
such that it will be set before the socket is connecting

PR-URL: https://github.com/nodejs/node/pull/8101
Fixes: https://github.com/nodejs/node/issues/7580
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
2016-09-26 13:33:52 +03:00
Claudio Rodriguez 1b97774c44 fs: do not emit 'stop' watch event synchronously
Emits 'stop' event for fs.watchFile on process.nextTick
to fix 'maximum call stack size exceeded' error when
`stop` is called synchronously after listener is attached.

PR-URL: https://github.com/nodejs/node/pull/8524
Fixes: https://github.com/nodejs/node/issues/8421
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com>
2016-09-24 01:24:04 +03:00
Jason Ginchereau 0f2f8efdde path: fallback to process cwd when resolving drive cwd
The `path.resolve()` function when given just a drive letter such as
"C:" tries to get a drive-specific CWD, but that isn't available in
cases when the process is not launched via cmd.exe and the process
CWD has not been explicitly set on that drive.

This change adds a fallback to the process CWD, if the process CWD
happens to be on the resolved drive letter. If the process CWD is on
another drive, then a drive-specific CWD cannot be resolved and
defaults to the drive's root as before.

Based on experimentation, the fixed behavior matches that of other
similar path resolution implementations on Windows I checked: .NET's
`System.IO.Path.GetFullPath()` and Python's `os.path.abspath()`.

In the automated path test cases the issue doesn't occur when the
tests are run normally from cmd.exe. But it did cause an assertion
when running the tests from PowerShell, that is fixed by this change.

PR-URL: https://github.com/nodejs/node/pull/8541
Fixes: https://github.com/nodejs/node/issues/7215
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-09-24 01:14:56 +03:00
Ben Noordhuis a8d2c9d775 fs: move stringToFlags() to lib/internal
PR-URL: https://github.com/nodejs/node/pull/7162
Refs: https://github.com/nodejs/node/pull/6413
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
2016-09-23 18:24:53 +02:00
Adri Van Houdt ba763e7bff process: changed var to const in internal/process.js
PR-URL: https://github.com/nodejs/node/pull/8614
Refs: https://github.com/nodejs/code-and-learn/issues/56
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
2016-09-23 02:56:38 +03:00
Luigi Pinca 575077ae12 dns: tweak regex for IPv6 addresses
The regex used in `dns.setServers()` to match IPv6 addresses in square
brackets uses a capturing group for the port but this info is not
needed.

This commit replaces the capturing group with a non capturing one.

PR-URL: https://github.com/nodejs/node/pull/8665
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2016-09-23 01:03:09 +03:00
Adri Van Houdt 99f64f778b lib: changed var to const in internal/v8_polyfill
PR-URL: https://github.com/nodejs/node/pull/8615
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-09-22 09:52:56 -07:00
Adri Van Houdt 3ddc9dba7e process: changed var to const in internal/v8_prof_processor
PR-URL: https://github.com/nodejs/node/pull/8619
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-09-22 09:48:47 -07:00
Teddy Katz b1b1978ec5
tools: add additional ESLint rules
PR-URL: https://github.com/nodejs/node/pull/8643
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@keybase.io>
2016-09-20 23:21:10 -04:00
Ilkka Myller db5a8791fa https: fix memory leak with https.request()
If calling `https.request()` with `options.headers.host` defined
and `options.servername` undefined, `https.Agent.createSocket` mutates
connection `options` after `https.Agent.addRequest` has created empty
socket pool array with mismatching connection name. This results in two
socket pool arrays being created and only the last one gets eventually
deleted by `removeSocket` - causing a memory leak.

This commit fixes the leak by making sure that `addRequest` does the
same modifications to `options` object as the `createSocket`.

`createSocket` is intentionally left unmodified to prevent userland
regressions.

Test case included.

PR-URL: https://github.com/nodejs/node/pull/8647
Fixes: https://github.com/nodejs/node/issues/6687
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jackson Tian <shvyo1987@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-09-21 03:22:15 +03:00
cjihrig b176d30a69 dns: handle array holes in setServers()
This commit adds better handling of exceptional array formats
passed to dns.setServers(). Prior to this commit, the input
array was validated using map(), which preserves holes, allowing
them to be passed to c-ares, crashing Node. This commit replaces
map() with forEach(), which skips holes.

Fixes: https://github.com/nodejs/node/issues/8538
PR-URL: https://github.com/nodejs/node/pull/8567
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-09-20 19:56:13 -04:00
Adri Van Houdt d4bf5cac43 process: changed var to const in internal/process/promises
PR-URL: https://github.com/nodejs/node/pull/8620
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jackson Tian <shvyo1987@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-09-20 16:55:28 -07:00
Adri Van Houdt 41a66bc73a lib: changed var to const in bootstrap_node.js
PR-URL: https://github.com/nodejs/node/pull/8588
Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2016-09-20 11:01:52 -07:00
Rich Trott 4316f4df31 test,lib: align arguments in multiline calls
An upcoming custom lint rule will provide slightly more strict
enforcement of argument alignment for multiline function calls. Adjust
existing code to conform.

PR-URL: https://github.com/nodejs/node/pull/8642
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
2016-09-20 10:22:23 -07:00
Bryan English be07458b11 util: don't init Debug if it's not needed yet
Because any call to util.inspect() with an object results in
inspectPromise() being called, Debug was being initialized even when
it's not needed. Instead, the initialization is placed after the
isPromise check.

PR-URL: https://github.com/nodejs/node/pull/8452
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2016-09-20 10:04:26 -07:00
Jason Ginchereau c1e47ed8c8 path: fix path.relative UNC path result
When the result of a path.relative() is an absolute UNC path, it should
include the leading backslashes.

Fixes: https://github.com/nodejs/node/issues/8444
PR-URL: https://github.com/nodejs/node/pull/8523
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
2016-09-20 09:56:50 -07:00
Dany Shaanan 5f29947230
util: simplify SIMD setup
PR-URL: https://github.com/nodejs/node/pull/8579
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
2016-09-20 14:11:31 +02:00