summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'ry/v0.10'isaacs2013-03-285-5/+228
|\ | | | | | | | | | | Conflicts: src/node.cc src/node_version.h
| * stream: Emit readable on ended streams via read(0)isaacs2013-03-281-0/+24
| | | | | | | | cc: @mjijackson
| * stream: Handle late 'readable' event listenersisaacs2013-03-281-0/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In cases where a stream may have data added to the read queue before the user adds a 'readable' event, there is never any indication that it's time to start reading. True, there's already data there, which the user would get if they checked However, as we use 'readable' event listening as the signal to start the flow of data with a read(0) call internally, we ought to trigger the same effect (ie, emitting a 'readable' event) even if the 'readable' listener is added after the first emission. To avoid confusing weirdness, only the *first* 'readable' event listener is granted this privileged status. After we've started the flow (or, alerted the consumer that the flow has started) we don't need to start it again. At that point, it's the consumer's responsibility to consume the stream. Closes #5141
| * test: Accept either kind of NaNisaacs2013-03-272-5/+15
| | | | | | | | | | | | | | A llvm/clang bug on Darwin ia32 makes these tests fail 100% of the time. Since no one really seems to mind overly much, and we can't reasonably fix this in node anyway, just accept both types of NaN for now.
| * tls: handle errors before calling C++ methodsFedor Indutny2013-03-271-0/+68
| | | | | | | | | | | | | | | | | | | | | | Calling `this.pair.encrypted._internallyPendingBytes()` before handling/resetting error will result in assertion failure: ../src/node_crypto.cc:962: void node::crypto::Connection::ClearError(): Assertion `handle_->Get(String::New("error"))->BooleanValue() == false' failed. see #5058
| * domain: fix domain callback from MakeCallbackTrevor Norris2013-03-261-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | Since _tickCallback and _tickDomainCallback were both called from MakeCallback, it was possible for a callback to be called that required a domain directly to _tickCallback. The fix was to implement process.usingDomains(). This will set all applicable functions to their domain counterparts, and set a flag in cc to let MakeCallback know domain callbacks always need to be checked. Added test in own file. It's important that the test remains isolated.
* | util: fix util.inspect() line width calculationMarcin Kostrzewa2013-03-281-0/+28
| | | | | | | | | | | | | | | | Have the formatter filter out vt100 color codes when calculating the line width. Stops it from unnecessarily splitting strings over multiple lines. Fixes #5039.
* | test: Use 'close' event in simple/test-repl-timeout-throwisaacs2013-03-261-1/+1
| |
* | buffer: remove _charsWrittenTrevor Norris2013-03-261-20/+0
| | | | | | | | | | | | | | _charsWritten is an internal property that was constantly written to, but never read from. So it has been removed. Removed documentation reference as well.
* | tls: expose SSL_CTX_set_timeout via tls.createServerManav Rathi2013-03-262-0/+156
| | | | | | | | | | | | | | | | | | | | | | Add the `sessionTimeout` integral value to the list of options recognized by `tls.createServer`. This option will be useful for applications which need frequently establish short-lived TLS connections to the same endpoint. The TLS tickets RFC is an ideal option to reduce the socket setup overhead for such scenarios, but the default ticket timeout value (5 minutes) is too low to be useful.
* | Merge remote-tracking branch 'origin/v0.10'Ben Noordhuis2013-03-269-9/+270
|\ \ | |/ | | | | | | | | | | Conflicts: deps/v8/src/objects-inl.h deps/v8/src/objects.h src/node_crypto.cc
| * child_process: don't emit same handle twiceBen Noordhuis2013-03-251-0/+1
| | | | | | | | | | | | It's possible to read multiple messages off the parent/child channel. When that happens, make sure that recvHandle is cleared after emitting the first message so it doesn't get emitted twice.
| * crypto: make getCiphers() return non-SSL ciphersBen Noordhuis2013-03-251-9/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit f53441a added crypto.getCiphers() as a function that returns the names of SSL ciphers. Commit 14a6c4e then added crypto.getHashes(), which returns the names of digest algorithms, but that creates a subtle inconsistency: the return values of crypto.getHashes() are valid arguments to crypto.createHash() but that is not true for crypto.getCiphers() - the returned values are only valid for SSL/TLS functions. Rectify that by adding tls.getCiphers() and making crypto.getCiphers() return proper cipher names.
| * child_process: fix sending utf-8 to child processBen Noordhuis2013-03-251-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | In process#send() and child_process.ChildProcess#send(), use 'utf8' as the encoding instead of 'ascii' because 'ascii' mutilates non-ASCII input. Correctly handle partial character sequences by introducing a StringDecoder. Sending over UTF-8 no longer works in v0.10 because the high bit of each byte is now cleared when converting a Buffer to ASCII. See commit 96a314b for details. Fixes #4999 and #5011.
| * stream: Fix early end in Writables on zero-length writesisaacs2013-03-242-0/+68
| | | | | | | | | | | | | | | | | | | | Doing this causes problems: z.write(Buffer(0)); z.end(); Fix by not ending Writable streams while they're still in the process of writing something.
| * timer: fix off-by-one ms errorAlexey Kupershtokh2013-03-231-0/+48
| | | | | | | | Fix #5103
| * crypto: check randomBytes() size argumentBen Noordhuis2013-03-231-0/+6
| | | | | | | | | | | | | | | | | | | | Throw a TypeError if size > 0x3fffffff. Avoids the following V8 fatal error: FATAL ERROR: v8::Object::SetIndexedPropertiesToExternalArrayData() length exceeds max acceptable value Fixes #5126.
| * stream: Fix stall in Transform under very specific conditionsGil Pedersen2013-03-211-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The stall is exposed in the test, though the test itself asserts before it stalls. The test is constructed to replicate the stalling state of a complex Passthrough usecase since I was not able to reliable trigger the stall. Some of the preconditions for triggering the stall are: * rs.length >= rs.highWaterMark * !rs.needReadable * _transform() handler that can return empty transforms * multiple sync write() calls Combined this can trigger a case where rs.reading is not cleared when further progress requires this. The fix is to always clear rs.reading.
| * timers: handle signed int32 overflow in enroll()Fedor Indutny2013-03-211-0/+64
| | | | | | | | | | | | | | | | | | | | Before this patch calling `socket.setTimeout(0xffffffff)` will result in signed int32 overflow in C++ which resulted in assertion error: Assertion failed: (timeout >= -1), function uv__io_poll, file ../deps/uv/src/unix/kqueue.c, line 121. see #5101
* | Merge remote-tracking branch 'ry/v0.10' into masterisaacs2013-03-213-16/+257
|\ \ | |/ | | | | | | | | Conflicts: src/node.cc src/node_version.h
| * fs: make write/appendFileSync correctly set file modeRaymond Feng2013-03-201-0/+98
| |
| * tls: write pending data of opposite sideFedor Indutny2013-03-171-0/+74
| | | | | | | | | | | | | | Fix stucked CryptoStream behaviour, happening when one of the sides locks-up in queued state. fix #5023
| * stream: Return self from readable.wrapisaacs2013-03-141-0/+94
| | | | | | | | | | | | Also, set paused=false *before* calling resume(). Otherwise, there's an edge case where an immediately-emitted chunk might make it call pause() again incorrectly.
| * test: No need for kicking in streams2 testisaacs2013-03-141-24/+0
| | | | | | | | | | This was necessary when we weren't auto-starting when a 'readable' listener is added.
| * stream: Never call decoder.end() multiple timesGil Pedersen2013-03-141-0/+73
| | | | | | | | Updated version that does what it says without assigning state.decoder.
* | test: fix up weakref.cc after v8 api changeBen Noordhuis2013-03-201-6/+6
| |
* | bindings: update apiTrevor Norris2013-03-203-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All compile time warnings about using deprecated APIs have been suppressed by updating node's API. Though there are still many function calls that can accept Isolate, and still need to be updated. node_isolate had to be added as an extern variable in node.h and node_object_wrap.h Also a couple small fixes for Error handling. Before v8 3.16.6 the error stack message was lazily written when it was needed, which allowed you to change the message after instantiation. Then the stack would be written with the new message the first time it was accessed. Though that has changed. Now it creates the stack message on instantiation. So setting a different message afterwards won't be displayed. This is not a complete fix for the problem. Getting error without any message isn't very useful.
* | test: Misc Windows unit test fixesScott Blomquist2013-03-193-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #5071, #5073. * Normalize capitalization of drive letter * Fix `exit()` typo in failure path * Ignore symlink tests (Windows) if not elevated The `test_relative_input_cwd()` test was failing on Windows when `skipSymlinks` was `true`. So we won't run it if `skipSymlinks` is `true`. When it failed, the unhandled error caused Node to die before having a chance to clean up, which resulted in two files missing in subsequent unit tests: * `test/fixtures/nested-index/one/hello.js` * `test/fixtures/nested-index/one/index.js` We should probably find a way to isolate this test from the other test (`simple/test-module-loading`) that was failing when this test poluted the disk state.
* | tls: write pending data of opposite sideFedor Indutny2013-03-171-0/+74
| | | | | | | | | | | | | | Fix stucked CryptoStream behaviour, happening when one of the sides locks-up in queued state. fix #5023
* | readline: handle wide characters properlyNao Iizuka2013-03-151-0/+19
| | | | | | | | | | | | | | | | Handle wide characters (such as あ, 谢, 고) as two column wide to make cursor move properly. Closes #555. Closes #4994.
* | repl: Use a domain to catch async errors safelyisaacs2013-03-143-1/+80
| | | | | | | | Fix #2031
* | repl: emit 'reset' event when context is resetSami Samhuri2013-03-141-0/+73
| | | | | | | | Closes #1183.
* | Revert "fs: Missing cb errors are deprecated, not a throw"isaacs2013-03-131-10/+1
| | | | | | | | | | This reverts commits 6bd8b7e5405e1cdc9f56214f5f6b741806c32e5f and fa05e8a2706e20a191942fe2b2273481605a1f14.
* | Merge remote-tracking branch 'ry/v0.10'isaacs2013-03-1320-8/+414
|\ \ | |/ | | | | | | Conflicts: src/node_version.h
| * Revert "stream: Never call decoder.end() multiple times"isaacs2013-03-131-4/+0
| | | | | | | | This reverts commit 615d809ac684a7d2cc7ee5e1aa58f0a921b529a0.
| * fs: Missing cb errors are deprecated, not a throwisaacs2013-03-131-1/+10
| | | | | | | | | | | | | | | | | | | | | | Commit a804347 makes fs function rethrow errors when the callback is omitted. While the right thing to do, it's a change from the old v0.8 behavior where such errors were silently ignored. To give users time to upgrade, temporarily disable that and replace it with a function that warns once about the deprecated behavior. Close #5005
| * stream: Never call decoder.end() multiple timesGil Pedersen2013-03-131-0/+4
| | | | | | | | | | Fixes decoder.end() being called on every push(null). As the tls module does this, corrupt stream data could potentially be added to the end.
| * net: handle 'finish' event only after 'connect'Fedor Indutny2013-03-131-0/+41
| |
| * stream: Don't emit 'end' unless read() calledisaacs2013-03-1013-0/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This solves the problem of calling `readable.pipe(writable)` after the readable stream has already emitted 'end', as often is the case when writing simple HTTP proxies. The spirit of streams2 is that things will work properly, even if you don't set them up right away on the first tick. This approach breaks down, however, because pipe()ing from an ended readable will just do nothing. No more data will ever arrive, and the writable will hang open forever never being ended. However, that does not solve the case of adding a `on('end')` listener after the stream has received the EOF chunk, if it was the first chunk received (and thus, length was 0, and 'end' got emitted). So, with this, we defer the 'end' event emission until the read() function is called. Also, in pipe(), if the source has emitted 'end' already, we call the cleanup/onend function on nextTick. Piping from an already-ended stream is thus the same as piping from a stream that is in the process of ending. Updates many tests that were relying on 'end' coming immediately, even though they never read() from the req. Fix #4942
| * stream: Avoid nextTick warning filling read bufferisaacs2013-03-101-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the function that pre-emptively fills the Readable queue, it relies on a recursion through: stream.push(chunk) -> maybeReadMore(stream, state) -> if (not reading more and < hwm) stream.read(0) -> stream._read() -> stream.push(chunk) -> repeat. Since this was only calling read() a single time, and then relying on a future nextTick to collect more data, it ends up causing a nextTick recursion error (and potentially a RangeError, even) if you have a very high highWaterMark, and are getting very small chunks pushed synchronously in _read (as happens with TLS, or many simple test streams). This change implements a new approach, so that read(0) is called repeatedly as long as it is effective (that is, the length keeps increasing), and thus quickly fills up the buffer for streams such as these, without any stacks overflowing.
| * events: Handle missing error obj when domains in useJulian Gruber2013-03-101-0/+42
| | | | | | | | | | | | | | | | so `ee.emit('error')` doesn't throw when domains are active create an empty error only when handled by a domain test for when no error is provided to an error event
| * http: ServerRequest does not timeout after 'end'koichik2013-03-102-49/+85
| | | | | | | | Fixes #4967
| * http: Do not setTimeout a not-yet-existent socketisaacs2013-03-101-0/+48
| | | | | | | | Fixes #4967
| * http: check if incoming parser has already been freedhc2013-03-091-0/+62
| | | | | | | | | | | | | | | | | | | | | | Fix #4948 This adds a check before setting the incoming parser to null. Under certain circumstances it'll already be set to null by freeParser(). Otherwise this will cause node to crash as it tries to set null on something that is already null.
| * timers: consistent this keyword in setImmediateAndreas Madsen2013-03-091-0/+64
| | | | | | | | | | | | | | | | | | | | When calling setImmediate with extra arguments the this keyword in the callback would refer to the global object, but when not calling setImmediate with extra arguments this would refer to the returned handle object. This commit fixes that inconsistency so its always set handle object. The handle object was chosen for performance reasons.
| * domain: Fix double-exit on nested domainsisaacs2013-03-091-4/+38
| | | | | | | | Minor oversight in fix for #4953.
* | net: handle 'finish' event only after 'connect'Fedor Indutny2013-03-131-0/+41
| |
* | util: custom `inspect()` method may return an ObjectNathan Rajlich2013-03-121-0/+5
| | | | | | | | | | This is more like how `JSON.stringify()` works. Closes #2711.
* | console: `console.dir()` bypasses inspect() methodsNathan Rajlich2013-03-121-1/+12
|/ | | | | | | Use the `customInspect: false` option of `util.inspect()` to bypass any custom inspect() function on the object being logged. Closes #2717.
* test: Fail faster in simple/test-cluster-bind-twice-v2isaacs2013-03-081-0/+11
| | | | Crashing on windows, but at least now it's a crash rathert han a timeout.