summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* streams: make setDefaultEncoding() throwBrian White2014-10-091-5/+3
| | | | | | | 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>
* crypto: createDiffieHellman throw for bad argsTrevor Norris2014-10-081-0/+5
| | | | | | | | 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>
* cluster: do not signal children in debug modeFedor Indutny2014-10-081-5/+23
| | | | | | | | | Do not send signal to children if they are already in debug mode. Node.js on Windows does not register signal handler, and thus calling `process._debugProcess()` will throw an error. Reviewed-By: Trevor Norris <trevnorris@gmail.com> PR-URL: https://github.com/joyent/node/pull/8476
* deps: re-implement debugger-agentFedor Indutny2014-10-081-0/+4
| | | | | Reviewed-By: Trevor Norris <trevnorris@gmail.com> PR-URL: https://github.com/joyent/node/pull/8476
* buffer, doc: misc. fix and cleanupTrevor Norris2014-10-081-24/+37
| | | | | | | | | | * Add official documentation that a Buffer instance is a viable argument when instantiating a new Buffer. * Properly set the poolOffset when a buffer needs to be truncated. * Add comments clarifying specific peculiar coding choices. * Remove a level of unnecessary indentation. Signed-off-by: Trevor Norris <trev.norris@gmail.com>
* src: fix jslint warningTrevor Norris2014-10-081-1/+2
| | | | Signed-off-by: Trevor Norris <trev.norris@gmail.com>
* smalloc: update use of ExternalArrayType constantsTrevor Norris2014-10-081-1/+2
| | | | | | | The constants in enum v8::ExternalArrayType have been changed. The old values are there for legacy reasons, but it's best to update anyway. Signed-off-by: Trevor Norris <trev.norris@gmail.com>
* streams: set default encoding for writable streamsJohnny Ray2014-10-071-0/+11
| | | | | | | | 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-4/+8
| | | | | | 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/+4
| | | | | | | | | * `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-0/+151
| | | | | | | | | | | | | | | 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>
* buffer: mv floating point read/write checks to JSTrevor Norris2014-10-011-0/+80
| | | | | | | | | | Performance improvement by moving checks for floating point operations to JS and doing the operation on a protected internal function that assumes all arguments are correct. Still abort if the operation overflows memory. This can only be caused if the Buffer's length property isn't the same as the actual internal length. Signed-off-by: Trevor Norris <trev.norris@gmail.com>
* readline: should not require an output stream.Julien Gilli2014-10-011-14/+40
| | | | | | | | | 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>
* url: make query() consistentGabriel Wicke2014-10-011-0/+3
| | | | | | | | | | | 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>
* http: Improve _addHeaderLines methodJackson Tian2014-09-301-1/+2
| | | | | Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
* buffer: fix and cleanup fill()Trevor Norris2014-09-291-0/+23
| | | | | | | | | | | | | | | | | | | 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-10/+14
| | | | | | | | | | | | | | | | 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-22/+18
| | | | | | | | | | | | 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>
* readline: fix performance issue when large lineJicheng Li2014-09-251-1/+4
| | | | | | | Only run lineEnding.test() on the newly acquired chunk of string instead of on the entire line buffer. Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* net: Make server.connections un-enumerablePatrick Mooney2014-09-241-1/+1
| | | | | | | | | 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>
* buffer: fix map and set parent to undefinedTrevor Norris2014-09-231-2/+4
| | | | | | | | | | | | | In 4c9b30d removal of the prototype attributes meant NativeBuffer() no longer had the same object map as Buffer(). By now setting the same properties in the same order both constructors will produce the same map. The same commit changed "parent" from undefined to null. This caused a failure in Buffer#slice() where it was checked if parent === undefined. Causing the incorrect parent to be set. Signed-off-by: Trevor Norris <trev.norris@gmail.com>
* http: write() after end() emits an error.Julien Gilli2014-09-231-0/+12
| | | | | | | | | | 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>
* buffer: improve Buffer constructorKang-Hao Kenny2014-09-191-5/+1
| | | | | | | Increase the performance of new Buffer construction by initializing all properties before SetIndexedPropertiesToExternalArrayData call. Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* Merge remote-tracking branch 'upstream/v0.10' into v0.12Timothy J Fontaine2014-09-163-15/+12
|\ | | | | | | | | | | | | | | | | | | | | 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-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * url: Add support for RFC 3490 separatorsMathias Bynens2014-08-271-12/+5
| | | | | | | | | | | | | | | | | | | | | | There is no need to split the host by hand in `url.js` – Punycode.js takes care of it anyway. This not only simplifies the code, but also adds support for RFC 3490 separators (i.e. not just U+002E, but U+3002, U+FF0E, and U+FF61 as well). Closes #6055. Reviewed-By: Fedor Indutny <fedor@indutny.com>
| * querystring: fix unescape overrideTristan Berger2014-08-271-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | 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/+4
| | | | | | | | | | | | | | | | | | | | | | 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>
* | dns: include host name in error message if availableMaciej Małecki2014-09-161-1/+1
| | | | | | | | | | | | | | This makes errors more readable and similar to FS errors, which also include file name. Reviewed-By: Fedor Indutny <fedor@indutny.com>
* | tls: `checkServerIdentity` optionTrevor Livingston2014-09-091-2/+6
| | | | | | | | | | | | | | Allow overriding `checkServerIdentity` function, when connecting to a TLS server. Reviewed-By: Fedor Indutny <fedor@indutny.com>
* | lib: unexport http.parsersBen Noordhuis2014-09-051-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unexport the http.parsers freelist. It was originally exported by Ryan in commit 0003c701 but the commit log doesn't mention why and it's never been documented. It's unclear if there are any users. The lifecycle of parser objects changed recently and it seems better to not let people shoot themselves in the foot so easily. If it turns out there are actually users, we can always re-export it again - probably under a slightly different name, to force people to update their code to the new way of things. Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* | lib: http: poison parser references after freeingBen Noordhuis2014-09-053-10/+15
| | | | | | | | | | | | | | Make it a little harder to slip in use-after-free bugs by nulling out references to the parser object after handing it off to freeParser(). Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* | lib, src: don't make http parser handles weakBen Noordhuis2014-09-052-1/+4
| | | | | | | | | | | | | | | | Weak handles put strain on the garbage collector and the parser handle doesn't need to be weak in the first place. This change should improve GC times on busy servers a little. Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* | lib: improved forEach object performanceMajid Arif Siddiqui2014-09-056-30/+52
| | | | | | | | Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* | net,dgram: workers can listen on exclusive portscjihrig2014-09-032-20/+46
| | | | | | | | | | | | | | | | | | 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>
* | src: be more intelligent about use of "arguments"Trevor Norris2014-09-033-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Use 'use strict' when there are named arguments and the arguments object is passed to apply(). Also pass named arguments to call() when the named argument is modified by the function. Suggested in https://github.com/joyent/node/pull/8302#issuecomment-54331801 Confirmed in https://github.com/joyent/node/pull/8302#issuecomment-54364818 Signed-off-by: Trevor Norris <trev.norris@gmail.com>
* | tls: support multiple keys/certsFedor Indutny2014-09-031-4/+22
| | | | | | | | Required to serve website with both ECDSA/RSA certificates.
* | net: Improve Socket.prototype.write()Jackson Tian2014-09-031-1/+1
| | | | | | | | Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* | stream_wrap: Add support to write binary stringsTrevor Norris2014-09-031-0/+3
| | | | | | | | | | | | | | | | node::StringBytes::Write() has appropriate support to write strings with 'binary' encoding. So expose that API through StreamWrap and allow inheriting classes to use it. Signed-off-by: Trevor Norris <trev.norris@gmail.com>
* | cluster: centralize removal from workers list.Julien Gilli2014-09-021-16/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: add DHE-RSA-AES128-SHA256 to the def ciphersShigeki Ohtsu2014-08-291-2/+4
| | | | | | | | | | | | `!EDH` is also removed from the list in the discussion of #8272 Reviewed-By: Fedor Indutny <fedor@indutny.com>
* | tls, crypto: add DHE supportShigeki Ohtsu2014-08-292-0/+4
| | | | | | | | | | | | | | | | 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/+47
| |
* | crypto: allow padding in RSA methodsFedor Indutny2014-08-271-3/+6
| | | | | | | | Reviewed-By: Trevor Norris <trevnorris@gmail.com>
* | http: avoid create difference hidden classJackson Tian2014-08-211-0/+3
| | | | | | | | Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* | net,stream: add isPaused, don't read() when pausedChris Dickinson2014-08-202-1/+5
| | | | | | | | | | | | | | | | | | | | 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-1/+3
| | | | | | | | | | | | | | | | 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>
* | http: fix bailout for writeHeadAlex Kocharin2014-08-181-8/+7
| | | | | | | | | | Reported-by: Jackson Tian <shyvo1987@gmail.com> Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* | dgram: remove new keyword from errnoExceptionJackson Tian2014-08-121-2/+2
| | | | | | | | Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* | querystring: remove prepended ? from query fieldEzequiel Rabinovich2014-08-121-1/+1
| | | | | | | | | | | | | | 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>