summaryrefslogtreecommitdiff
path: root/test/simple
Commit message (Collapse)AuthorAgeFilesLines
* streams: make setDefaultEncoding() throwBrian White2014-10-091-9/+5
| | | | | | | PR-URL: https://github.com/joyent/node/pull/8529 Fixes: f04f3a0 "streams: set default encoding for writable streams" [trev.norris@gmail.com: update tests to check if throws] Signed-off-by: Trevor Norris <trev.norris@gmail.com>
* test: fix test-child-process-spawn-typeerrorAlexis Campailla2014-10-091-2/+2
| | | | | | | | You cannot spawn 'dir' on Windows because it's not an executable. Also, some people might have 'ls' on their path on Windows, so I changed invalidCmd to something that's highly unlikely to exist. Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* crypto: createDiffieHellman throw for bad argsTrevor Norris2014-10-081-0/+16
| | | | | | | | Previously crypto.createDiffieHellman() would fail silently when a bad argument was passed for prime/prime_length. Now throws TypeError. Fixes: https://github.com/joyent/node/issues/8480 Signed-off-by: Trevor Norris <trev.norris@gmail.com>
* test: fix debug-signal-cluster after da updateFedor Indutny2014-10-081-4/+22
| | | | | | | | | | The cluster children are hitting breakpoint at `cluster.onread` and hanging on a Semaphore wait now. This prevents them from disconnecting gracefully. Considering that the test is checking different thing, the cluster children needs to be force killed from the grand parent process. Reviewed-By: Trevor Norris <trevnorris@gmail.com> PR-URL: https://github.com/joyent/node/pull/8476
* src, test: fixup after v8 updateFedor Indutny2014-10-082-3/+1
| | | | | | | | | | | | | Because of behavior change of some V8 APIs (they mostly became more strict), following modules needed to be fixed: * crypto: duplicate prototype methods are not allowed anymore * contextify: some TryCatch trickery, the binding was using it incorrectly * util: maximum call stack error is now crashing in a different place Reviewed-By: Trevor Norris <trevnorris@gmail.com> PR-URL: https://github.com/joyent/node/pull/8476
* deps: re-implement debugger-agentFedor Indutny2014-10-081-35/+0
| | | | | Reviewed-By: Trevor Norris <trevnorris@gmail.com> PR-URL: https://github.com/joyent/node/pull/8476
* streams: set default encoding for writable streamsJohnny Ray2014-10-071-0/+76
| | | | | | | | Add API Writable#setDefaultEncoding(). PR-URL: https://github.com/joyent/node/pull/8483 Fixes: https://github.com/joyent/node/issues/7159 Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* url: fixed encoding for slash switching emulation.Evan Rutledge Borden2014-10-061-0/+24
| | | | | | Fixes: https://github.com/joyent/node/issues/8458 Reviewed-by: Trevor Norris <trev.norris@gmail.com> Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>
* util: add es6 Symbol support for `util.inspect`gyson2014-10-031-0/+9
| | | | | | | | | * `util.inspect` cannot accept es6 symbol primitive * It will throw exception if do `util.inspect(Symbol())` * This also affects repl, console.log, etc. Reviewed-by: Trevor Norris <trev.norris@gmail.com> Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>
* buffer: add generic functions for (u)int opsYazhong Liu2014-10-031-2/+85
| | | | | | | | | | | | | | | Add generic functions for (U)Int read/write operations on Buffers. These support up to and including 48 bit reads and writes. Include documentation and tests. Additional work done by Trevor Norris to include 40 and 48 bit write support. Because bitwise operations cannot be used on values greater than 32 bits, the operations have been replaced with mathematical calculations. Regardless, they are still faster than floating point operations. Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* readline: should not require an output stream.Julien Gilli2014-10-011-0/+31
| | | | | | | | | Passing null as the output stream to readline.Interface()'s constructor is now supported. Any output written by readline is just discarded. It makes it easier to use readline just as a line parser. Fixes: https://github.com/joyent/node/issues/4408 Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* node: avoid automatic microtask runsVladimir Kurchatkin2014-10-014-0/+234
| | | | | | | | | | | | | | | | | | | Since we are taking control of the microtask queue it makes sense to disable autorun and only run microtasks when necessary. Just setting isolate->SetAutorunMicrotasks(false) would cause _tickCallback() not to be called. Automatically running the microtask queue will cause it to run: * After callback invocation * Inside _tickCallback() * After _tickCallback() invocation The third one is unnecessary as the microtask queue is guaranteed to be empty at this point. The first only needs to be run manually when _tickCallback() isn't going to be called by MakeCallback(). Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* url: make query() consistentGabriel Wicke2014-10-011-0/+14
| | | | | | | | | | | Match the behavior of the slow path by setting url.query to an empty object when the url contains no query, but query parsing is requested. Also add a test for this case, and update the documents to clearly reflect this behavior. Fixes: https://github.com/joyent/node/issues/8332 Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* buffer: fix and cleanup fill()Trevor Norris2014-09-291-22/+50
| | | | | | | | | | | | | | | | | | | Running fill() with an empty string would cause Node to hang indefinitely. Now it will return without having operated on the buffer. User facing function has been pulled into JS to perform all initial value checks and coercions. The C++ method has been placed on the "internal" object. Coerced non-string values to numbers to match v0.10 support. Simplified logic and changed a couple variable names. Added tests for fill() and moved them all to the beginning of buffer-test.js since many other tests depend on fill() working properly. Fixes: https://github.com/joyent/node/issues/8469 Signed-off-by: Trevor Norris <trev.norris@gmail.com>
* http: cleanup setHeader()Trevor Norris2014-09-291-0/+11
| | | | | | | | | | | | | | | | Several fields on OutgoingMessage were set after instantiation. These have been included in the constructor to prevent mutation of the object map after instantiation. "name" is now explicitly checked to be a string. Where before if a non-string was passed the following cryptic error was thrown: _http_outgoing.js:334 var key = name.toLowerCase(); ^ TypeError: undefined is not a function Signed-off-by: Trevor Norris <trev.norris@gmail.com>
* child_process: improve spawn() argument handlingcjihrig2014-09-251-2/+43
| | | | | | | | | | | | Add stricter argument type checking to normalizeSpawnArguments(). Removes a number of extraneous checks in spawn(). Fix regression in handling of the optional args argument. Add more thorough testing of spawn() arguments. Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* net: Make server.connections un-enumerablePatrick Mooney2014-09-241-0/+32
| | | | | | | | | The property server.connections should no longer be enumerable because it has been deprecated. This will prevent deprecation warnings when server objects are accessed by functions such as JSON.stringify. Fixes: https://github.com/joyent/node/issues/8373 Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* test: disable dgram-bind-shared-ports on win32Timothy J Fontaine2014-09-241-0/+5
| | | | | Windows currently doesn't support clustered dgram sockets, when it does re-enable this test
* tests: add test for buffer.slice.Julien Gilli2014-09-241-0/+32
| | | | | | 4c9b30d introduced a regression in buffer.slice that 7c3c51b fixed, but no test had been added to make sure that a similar regression is caught by the tests suite in the future.
* http: write() after end() emits an error.Julien Gilli2014-09-231-0/+49
| | | | | | | | | | When calling write() after end() has been called on an OutgoingMessage, an error is emitted and the write's callback is called with an instance of Error. Fix #7477. Reviewed-By: Fedor Indutny <fedor@indutny.com>
* node: support v8 microtask queueVladimir Kurchatkin2014-09-182-0/+139
| | | | | | | | | | | When V8 started supporting Promises natively it also introduced a microtack queue. This feature operates similar to process.nextTick(), and created an issue where neither knew when the other had run. This patch has nextTick() call the microtask queue runner at the end of processing callbacks in the nextTickQueue. Fixes: https://github.com/joyent/node/issues/7714 Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* test: add test for cluster.worker.destroy()Julien Gilli2014-09-181-0/+79
| | | | | | | | | | Add a simple test to cover workers' implementation of Worker.prototype.destroy(). Before adding this test, this code wouldn't be covered by the tests suite, and any regression introduced in workers' implementation of Worker.prototype.destroy wouldn't be caught. Fixes: https://github.com/joyent/node/issues/8223 Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* Merge remote-tracking branch 'upstream/v0.10' into v0.12Timothy J Fontaine2014-09-164-23/+137
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: ChangeLog deps/v8/src/hydrogen.cc lib/http.js lib/querystring.js src/node_crypto.cc src/node_version.h test/simple/test-querystring.js
| * http: do not send `0\r\n\r\n` in TE HEAD responsesFedor Indutny2014-09-161-23/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When replying to a HEAD request, do not attempt to send the trailers and EOF sequence (`0\r\n\r\n`). The HEAD request MUST not have body. Quote from RFC: The presence of a message body in a response depends on both the request method to which it is responding and the response status code (Section 3.1.2). Responses to the HEAD request method (Section 4.3.2 of [RFC7231]) never include a message body because the associated response header fields (e.g., Transfer-Encoding, Content-Length, etc.), if present, indicate only what their values would have been if the request method had been GET (Section 4.3.1 of [RFC7231]). fix #8361 Reviewed-By: Timothy J Fontaine <tjfontaine@gmail.com>
| * crypto: use domains for any callback-taking methodChris Dickinson2014-09-161-0/+44
| | | | | | | | | | | | | | | | | | This adds domains coverage for pdbkdf2, pseudoRandomBytes, and randomBytes. All others should be covered by event emitters. Fixes #5801. Reviewed-By: Timothy J Fontaine <tjfontaine@gmail.com>
| * tests: add test for non-integer delay timers.Julien Gilli2014-09-021-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR #8034 came with a test to make sure that timers expiry is based on monotonic time and not on wall-clock time. However, a bug in the implementation broke timers with non-integer delays. A fix for this issue was provided with PR #8073, but it didn't come with a test. Because #8073 fixed a subtle issue that could reappear in the future, and because the impact of such an issue would be significant, I suggest adding this test. The test would timeout after 1 minute if the issue was reproduced. Otherwise it will run very quickly. Reviewed-By: Fedor Indutny <fedor@indutny.com>
| * querystring: fix unescape overrideTristan Berger2014-08-271-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Documentation states that `querystring.unescape` may be overridden to replace unescaper during parsing. However, the function was only being used as a fallback for when the native decoder throws (on a malformed URL). This patch moves the call to the native function and the try/catch around it into querystring.unescape then has the parser always invoke it, so that an override will always be used. Fixes #4055 Reviewed-By: Fedor Indutny <fedor@indutny.com>
* | lib, src: add vm.runInDebugContext()Ben Noordhuis2014-09-161-0/+48
| | | | | | | | | | | | | | | | | | | | | | Compiles and executes source code in V8's debugger context. Provides a programmatic way to get access to the debug object by executing: var Debug = vm.runInDebugContext('Debug'); Fixes #7886. Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* | tls: fix encoding in certificate-related functionsAdam Lippai2014-09-151-0/+62
| | | | | | | | | | | | | | | | | | Strings are treated as UTF8 instead of one-byte strings when names are processed and when OpenSSL's ..._print functions are used. This commit fixes simple/test-tls-peer-certificate-encoding test. fix #8366
* | tls: `checkServerIdentity` optionTrevor Livingston2014-09-091-0/+85
| | | | | | | | | | | | | | Allow overriding `checkServerIdentity` function, when connecting to a TLS server. Reviewed-By: Fedor Indutny <fedor@indutny.com>
* | test: listen on exclusive port in cluster workerscjihrig2014-09-041-0/+56
| | | | | | | | | | | | | | Test that listening on exclusive ports with the cluster module works correctly. Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* | net,dgram: workers can listen on exclusive portscjihrig2014-09-032-0/+132
| | | | | | | | | | | | | | | | | | Allow cluster workers to listen on exclusive ports for TCP and UDP, instead of forcing all calls to go through the cluster master. Fixes: #3856 Reviewed-by: Trevor Norris <trev.norris@gmail.com> Reviewed-by: Fedor Indutny <fedor@indutny.com>
* | tls: support multiple keys/certsFedor Indutny2014-09-031-0/+74
| | | | | | | | Required to serve website with both ECDSA/RSA certificates.
* | cluster: centralize removal from workers list.Julien Gilli2014-09-022-0/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, cluster workers can be removed from the workers list in three different places: - In the exit event handler for the worker process. - In the disconnect event handler of the worker process. - In the disconnect event handler of the cluster master. However, handles for a given worker are cleaned up only in one of these places: in the cluster master's disconnect event handler. Because these events happen asynchronously, it is possible that the workers list is empty before we even clean up one handle. This makes the assert that makes sure that no handle is left when the workers list is empty fail. This commit removes the worker from the cluster.workers list only when the worker is dead _and_ disconnected, at which point we're sure that its associated handles are cleaned up. Fixes #8191 and #8192. Reviewed-By: Fedor Indutny <fedor@indutny.com>
* | tls, crypto: add DHE supportShigeki Ohtsu2014-08-291-0/+107
| | | | | | | | | | | | | | | | In case of an invalid DH parameter file, it is sliently discarded. To use auto DH parameter in a server and DHE key length check in a client, we need to wait for the next release of OpenSSL-1.0.2. Reviewed-By: Fedor Indutny <fedor@indutny.com>
* | crypto: introduce ECDHFedor Indutny2014-08-291-0/+35
| |
* | crypto: allow padding in RSA methodsFedor Indutny2014-08-271-0/+24
| | | | | | | | Reviewed-By: Trevor Norris <trevnorris@gmail.com>
* | net,stream: add isPaused, don't read() when pausedChris Dickinson2014-08-202-0/+79
| | | | | | | | | | | | | | | | | | | | net Sockets were calling read(0) to start reading, without checking to see if they were paused first. This would result in paused Socket objects keeping the event loop alive. Fixes #8200 Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* | dns: throw if hostname is not string or falseycjihrig2014-08-201-0/+41
| | | | | | | | | | | | | | | | Fix assertion failure from poor argument parsing logic introduced in 6ea5d16. Add tests to make sure arguments are properly parsed. Fixes: 6ea5d16 "dns: always set variable family in lookup()" Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* | tests: don't assume IPv4 only in remote addr testsJulien Gilli2014-08-131-6/+12
| | | | | | | | | | | | | | | | | | | | | | Tests in test-net-remote-address-port.js assume that client and server sockets always use IPv4. However, depending on the OS and the network interfaces setup, this is not true. This change makes the test consider that both IPv4 or IPv6 sockets are valid Fixes #8096. Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
* | test: check ipv6 support before testing itFedor Indutny2014-08-134-2/+21
| | | | | | | | | | | | | | fix #7983 fix #8049 Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
* | tests: fix invalid hints flags dns test.Julien Gilli2014-08-131-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | 1 is actually a valid flag on SmartOS. More generally, hints flags' values are defined by the underlying native flags, and these can have different values on different systems. Using (ADDRCONFIG | V4MAPPED) + 1 ensure that the flag will be invalid, since it will always be different from ADDRCONFIG, V4MAPPED, ADDRCONFIG | V4MAPPED, 0 and any other combination of even flags. Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
* | querystring: remove prepended ? from query fieldEzequiel Rabinovich2014-08-121-0/+14
| | | | | | | | | | | | | | Fixes an issue that caused the first querystring to be parsed prepending a "?" in the first variable name on relative urls with no #fragment Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* | crypto: add RSA encryptionseishun2014-08-111-0/+34
| | | | | | | | Reviewed-By: Fedor Indutny <fedor@indutny.com>
* | test: fix test-process-kill-pid on WindowsAlexis Campailla2014-08-071-0/+7
| | | | | | | | | | | | | | Disabling the part of the test that relies on dispatching SIGHUP, because sending SIGHUP is not supported on Windows. Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
* | Merge remote-tracking branch 'upstream/v0.10' into v0.12Timothy J Fontaine2014-08-072-24/+41
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: ChangeLog Makefile deps/uv/ChangeLog deps/uv/build.mk deps/uv/src/unix/darwin.c deps/uv/src/unix/getaddrinfo.c deps/uv/src/version.c deps/v8/src/checks.h deps/v8/src/isolate.h lib/cluster.js lib/module.js lib/timers.js lib/tls.js src/node_version.h
| * tests: fix child-process-fork-dgram on SmartOS.Julien Gilli2014-08-071-24/+38
| | | | | | | | | | | | | | | | Send messages until both the parent and the child process have received at least one message. If at least one of them doesn't receive any message, the test runner will make the test timeout. Fixes #8046.
| * timers: fix timers with non-integer delay hanging.Julien Gilli2014-08-041-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When backporting f8193ab into v0.10, a regression was introduced. Timers with non-integer timeout could trigger a infinite recursion with 100% cpu usage. This commit backports 93b0624 which fixes the regression. After backporting f8193ab, instead of using Date.now(), timers would use Timer.now() to determine if they had expired. However, Timer.now() is based on loop->time, which is not updated when a timer's remaining time is > 0 and < 1. Timers would thus never timeout if their remaining time was at some point > 0 and < 1. With this commit, Timer.now() updates loop->time itself, and timers always timeout eventually. Fixes #8065 and #8068.
| * cluster: disconnect should not be synchronousSam Roberts2014-08-021-0/+36
| | | | | | | | | | | | | | Callbacks in node are usually asynchronous, and should never be sometimes synchronous, and sometimes asynchronous. Reviewed-by: Trevor Norris <trev.norris@gmail.com>
| * stream: fix Readable.wrap objectMode falsy valuesJames Halliday2014-08-011-0/+3
| | | | | | | | | | | | | | | | | | | | A streams1 stream will have its falsy values such as 0, false, or "" eaten by the upgrade to streams2, even when objectMode is enabled. Include test for said cases. Reviewed-by: isaacs <i@izs.me> Reviewed-by: Trevor Norris <trev.norris@gmail.com>