Commit 68f84003 authored by Jérémy Lal's avatar Jérémy Lal

Imported Upstream version 5.6.0~dfsg

parent fe5461ca
......@@ -6,3 +6,4 @@ test/fixtures
......@@ -17,6 +17,8 @@ ecmaFeatures:
# Possible Errors
# list:
## disallow control characters in regular expressions
no-control-regex: 2
## check debugger sentence
no-debugger: 2
## check duplicate arguments
......@@ -25,10 +27,20 @@ rules:
no-dupe-keys: 2
## check duplicate switch-case
no-duplicate-case: 2
## disallow superfluous semicolons
no-extra-semi: 2
## disallow the use of empty character classes in regular expressions
no-empty-character-class: 2
## disallow assignment of exceptional params
no-ex-assign: 2
## disallow extra boolean casts
no-extra-boolean-cast : 2
## disallow superfluous semicolons
no-extra-semi: 2
## validate regular expressions
no-invalid-regexp: 2
## forbid weird whitespace characters
no-irregular-whitespace: 2
## avoid unexpected multiline expressions
no-unexpected-multiline: 2
## disallow unreachable code
no-unreachable: 2
## require valid typeof compared string like typeof foo === 'strnig'
......@@ -71,6 +83,8 @@ rules:
space-after-keywords: 2
## no leading/trailing spaces in parens
space-in-parens: [2, "never"]
## no spaces with non-word unary operators, require for word unary operators
space-unary-ops: 2
# ECMAScript 6
# list:
This diff is collapsed.
## Code of Conduct
This Code of Conduct is adapted from [Rust's wonderful
### Conduct
* We are committed to providing a friendly, safe and welcoming
environment for all, regardless of gender, sexual orientation,
disability, ethnicity, religion, or similar personal characteristic.
environment for all, regardless of level of experience, gender
identity and expression, sexual orientation, disability,
personal appearance, body size, race, ethnicity, age, religion,
nationality, or other similar characteristic.
* Please avoid using overtly sexual nicknames or other nicknames that
might detract from a friendly, safe and welcoming environment for
......@@ -36,3 +37,19 @@ CoC](
* Avoid the use of personal pronouns in code comments or
documentation. There is no need to address persons when explaining
code (e.g. "When the developer").
### Contact
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by:
* Emailing []( (this will email all TSC members)
* Contacting [individual TSC members](
### Moderation
See the TSC's [moderation policy]( for details about moderation.
### Attribution
This Code of Conduct is adapted from [Rust's wonderful
CoC]( as well as the
[Contributor Covenant v1.3.0](
......@@ -672,14 +672,32 @@ The externally maintained libraries used by Node.js are:
- npm, located at deps/npm, is licensed as follows:
The npm application
Copyright (c) npm, Inc. and Contributors
All rights reserved.
Licensed on the terms of The Artistic License 2.0
Node package dependencies of the npm application
Copyright (c) their respective copyright owners
Licensed on their respective license terms
The npm public registry at
and the npm website at
Operated by npm, Inc.
Use governed by terms published on
Trademark Joyent, Inc.,
Neither npm nor npm, Inc. are affiliated with Joyent, Inc.
npm is released under the Artistic License 2.0, subject to additional terms
that are listed below.
The Node.js application
Project of Node Foundation,
The text of the npm License follows and the text of the additional terms
follows the Artistic License 2.0 terms:
The npm Logo
Copyright (c) Mathias Pettersson and Brian Hammond
"Gubblebum Blocky" typeface
Copyright (c) Tjarda Koster,
Used with permission
......@@ -879,51 +897,6 @@ The externally maintained libraries used by Node.js are:
The following additional terms shall apply to use of the npm software, the npm
website, the npm repository and any other services or products offered by npm,
"Node.js" trademark Joyent, Inc. npm is not officially part of the Node.js
project, and is neither owned by nor affiliated with Joyent, Inc.
"npm" and "The npm Registry" are owned by npm, Inc. All rights reserved.
Modules published on the npm registry are not officially endorsed by npm, Inc.
or the Node.js project.
Data published to the npm registry is not part of npm itself, and is the sole
property of the publisher. While every effort is made to ensure accountability,
there is absolutely no guarantee, warrantee, or assertion expressed or implied
as to the quality, fitness for a specific purpose, or lack of malice in any
given npm package. Packages downloaded through the npm registry are
independently licensed and are not covered by this license.
Additional policies relating to, and restrictions on use of, npm products and
services are available on the npm website. All such policies and restrictions,
as updated from time to time, are hereby incorporated into this license
agreement. By using npm, you acknowledge your agreement to all such policies
and restrictions.
If you have a complaint about a package in the public npm registry, and cannot
resolve it with the package owner, please email and explain
the situation. See the [npm Dispute Resolution
policy]( for more
Any data published to The npm Registry (including user account information) may
be removed or modified at the sole discretion of the npm server administrators.
"npm Logo" contributed by Mathias Pettersson and Brian Hammond,
use is subject to
"Gubblebum Blocky" font
Copyright (c) by Tjarda Koster,
included for use in the npm website and documentation,
used with permission.
This program uses several Node modules contained in the node_modules/
subdirectory, according to the terms of their respective licenses.
- GYP, located at tools/gyp, is licensed as follows:
......@@ -294,7 +294,12 @@ endif
# Custom user-specified variation, use it directly
# OSX doesn't have xz installed by default,
XZ=$(shell which xz > /dev/null 2>&1; echo $$?)
......@@ -509,7 +514,7 @@ bench-idle:
$(NODE) benchmark/idle_clients.js &
$(NODE) tools/eslint/bin/eslint.js src lib test tools/eslint-rules \
$(NODE) tools/eslint/bin/eslint.js lib src test tools/doc tools/eslint-rules \
--rulesdir tools/eslint-rules --quiet
......@@ -36,7 +36,7 @@ The Node.js project maintains multiple types of releases:
and security. Every second Stable release line (major version) will become an
LTS line and receive 18 months of _Active LTS_ support and a further 12
months of _Maintenance_. LTS release lines are given alphabetically
ordered codenames, begining with v4 Argon. LTS releases are less frequent
ordered codenames, beginning with v4 Argon. LTS releases are less frequent
and will attempt to maintain consistent major and minor version numbers,
only incrementing patch version numbers. There are no breaking changes or
feature additions, except in some special circumstances. More information
......@@ -440,12 +440,12 @@ Releases of Node.js and io.js will be signed with one of the following GPG keys:
* **Chris Dickinson** <> `9554F04D7259F04124DE6B476D5A82AC7E37093B`
* **Colin Ihrig** <> `94AE36675C464D64BAFA68DD7434390BDBE9B9C5`
* **Sam Roberts** <> `0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93`
* **Jeremiah Senkpiel** <> `FD3A5288F042B6850C66B31F09FE44734EB7990E`
* **Evan Lucas** <> `B9AE9905FFD7803F25714661B63B535A4C206CA9`
* **James M Snell** <> `71DCFD284A79C3B38668286BC97EC7A07EDE3FC1`
* **Rod Vagg** <> `DD8F2338BAE7501E3DD5AC78C273792F7D83545D`
* **Jeremiah Senkpiel** <> `FD3A5288F042B6850C66B31F09FE44734EB7990E`
* **Myles Borins** <> `C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8`
* **Evan Lucas** <> `B9AE9905FFD7803F25714661B63B535A4C206CA9`
* **Rod Vagg** <> `DD8F2338BAE7501E3DD5AC78C273792F7D83545D`
* **Sam Roberts** <> `0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93`
The full set of trusted release keys can be imported by running:
......@@ -466,6 +466,6 @@ details on what to do with these keys to verify that a downloaded file is offici
Previous releases of Node.js have been signed with one of the following GPG
* Julien Gilli <> `114F43EE0176B71C7BC219DD50A3051F888C628D`
* Timothy J Fontaine <> `7937DFD2AB06298B2293C3187D33FF9D0246406D`
* Isaac Z. Schlueter <> `93C7E9E91B49E432C2F75674B0A78B0A6C481CF6`
* **Isaac Z. Schlueter** <> `93C7E9E91B49E432C2F75674B0A78B0A6C481CF6`
* **Julien Gilli** <> `114F43EE0176B71C7BC219DD50A3051F888C628D`
* **Timothy J Fontaine** <> `7937DFD2AB06298B2293C3187D33FF9D0246406D`
......@@ -31,6 +31,7 @@ back in to the TSC.
* [Post-mortem](#post-mortem)
* [Intl](#intl)
* [HTTP](#http)
* [Documentation](#documentation)
#### Process:
......@@ -270,6 +271,22 @@ Its responsibilities are:
+ Defining and adding common structures to the dumps generated
in order to support tools that want to introspect those dumps
### [Documentation](
The Documentation working group exists to support the improvement of Node.js
documentation, both in the core API documentation, and elsewhere, such as the
Node.js website. Its intent is to work closely with Evangelism, Website, and
Intl working groups to make excellent documentation available and accessible
to all.
Its responsibilities are:
* Defining and maintaining documentation style and content standards.
* Producing documentation in a format acceptable for the Website WG to consume.
* Ensuring that Node's documentation addresses a wide variety of audiences.
* Creating and operating a process for documentation review that produces
quality documentation and avoids impeding the progress of Core work.
## Starting a WG
A Working Group is established by first defining a charter that can be
net = require('net');
connections = 0;
'use strict';
const net = require('net');
var connections = 0;
var errors = 0;
server = net.Server(function (socket) {
var server = net.Server(function (socket) {
socket.on('error', function () {
......@@ -28,4 +29,3 @@ setInterval(function () {
console.log("SERVER %d errors: %d",, errors);
}, 1000);
......@@ -19,6 +19,8 @@
#define ARES__H
#include "ares_version.h" /* c-ares version defines */
#include "ares_build.h" /* c-ares build definitions */
#include "ares_rules.h" /* c-ares rules enforcement */
* Define WIN32 when build target is Win32 API
......@@ -29,9 +31,6 @@
# define WIN32
/* Data type definition of ares_socklen_t. */
typedef unsigned ares_socklen_t;
#include <sys/types.h>
/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
......@@ -297,6 +296,13 @@ typedef int (*ares_sock_create_callback)(ares_socket_t socket_fd,
CARES_EXTERN int ares_library_init(int flags);
CARES_EXTERN int ares_library_init_mem(int flags,
void *(*amalloc)(size_t size),
void (*afree)(void *ptr),
void *(*arealloc)(void *ptr, size_t size));
CARES_EXTERN int ares_library_initialized(void);
CARES_EXTERN void ares_library_cleanup(void);
CARES_EXTERN const char *ares_version(int *version);
......@@ -338,6 +344,9 @@ CARES_EXTERN void ares_set_socket_callback(ares_channel channel,
ares_sock_create_callback callback,
void *user_data);
CARES_EXTERN int ares_set_sortlist(ares_channel channel,
const char *sortstr);
CARES_EXTERN void ares_send(ares_channel channel,
const unsigned char *qbuf,
int qlen,
......@@ -473,8 +482,17 @@ struct ares_txt_reply {
struct ares_txt_reply *next;
unsigned char *txt;
size_t length; /* length excludes null termination */
unsigned char record_start; /* 1 - if start of new record
* 0 - if a chunk in the same record */
/* NOTE: This structure is a superset of ares_txt_reply
struct ares_txt_ext {
struct ares_txt_ext *next;
unsigned char *txt;
size_t length;
/* 1 - if start of new record
* 0 - if a chunk in the same record */
unsigned char record_start;
struct ares_naptr_reply {
......@@ -540,6 +558,10 @@ CARES_EXTERN int ares_parse_txt_reply(const unsigned char* abuf,
int alen,
struct ares_txt_reply** txt_out);
CARES_EXTERN int ares_parse_txt_reply_ext(const unsigned char* abuf,
int alen,
struct ares_txt_ext** txt_out);
CARES_EXTERN int ares_parse_naptr_reply(const unsigned char* abuf,
int alen,
struct ares_naptr_reply** naptr_out);
......@@ -556,7 +578,6 @@ CARES_EXTERN void ares_free_data(void *dataptr);
CARES_EXTERN const char *ares_strerror(int code);
/* TODO: Hold port here as well. */
struct ares_addr_node {
struct ares_addr_node *next;
int family;
......@@ -566,15 +587,32 @@ struct ares_addr_node {
} addr;
struct ares_addr_port_node {
struct ares_addr_port_node *next;
int family;
union {
struct in_addr addr4;
struct ares_in6_addr addr6;
} addr;
int udp_port;
int tcp_port;
CARES_EXTERN int ares_set_servers(ares_channel channel,
struct ares_addr_node *servers);
CARES_EXTERN int ares_set_servers_ports(ares_channel channel,
struct ares_addr_port_node *servers);
/* Incomming string format: host[:port][,host[:port]]... */
CARES_EXTERN int ares_set_servers_csv(ares_channel channel,
const char* servers);
CARES_EXTERN int ares_set_servers_ports_csv(ares_channel channel,
const char* servers);
CARES_EXTERN int ares_get_servers(ares_channel channel,
struct ares_addr_node **servers);
CARES_EXTERN int ares_get_servers_ports(ares_channel channel,
struct ares_addr_port_node **servers);
CARES_EXTERN const char *ares_inet_ntop(int af, const void *src, char *dst,
ares_socklen_t size);
/* ares_build.h. Generated from by configure. */
#ifndef __CARES_BUILD_H
#define __CARES_BUILD_H
/* Copyright (C) 2009 by Daniel Stenberg et al
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. M.I.T. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
/* ================================================================ */
/* ================================================================ */
* NOTE 1:
* -------
* Nothing in this file is intended to be modified or adjusted by the
* c-ares library user nor by the c-ares library builder.
* If you think that something actually needs to be changed, adjusted
* or fixed in this file, then, report it on the c-ares development
* mailing list:
* This header file shall only export symbols which are 'cares' or 'CARES'
* prefixed, otherwise public name space would be polluted.
* NOTE 2:
* -------
* Right now you might be staring at file or ares_build.h,
* this is due to the following reason:
* On systems capable of running the configure script, the configure process
* will overwrite the distributed ares_build.h file with one that is suitable
* and specific to the library being configured and built, which is generated
* from the template file.
/* ================================================================ */
/* ================================================================ */
# error "CARES_SIZEOF_LONG shall not be defined except in ares_build.h"
Error Compilation_aborted_CARES_SIZEOF_LONG_already_defined
# error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined
# error "CARES_SIZEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_already_defined
/* ================================================================ */
/* ================================================================ */
/* Configure process defines this to 1 when it finds out that system */
/* header file ws2tcpip.h must be included by the external interface. */
#ifdef WIN32
/* #undef CARES_PULL_WS2TCPIP_H */
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
# include <windows.h>
# include <winsock2.h>
# include <ws2tcpip.h>
/* Configure process defines this to 1 when it finds out that system */
/* header file sys/types.h must be included by the external interface. */
# include <sys/types.h>
/* Configure process defines this to 1 when it finds out that system */
/* header file sys/socket.h must be included by the external interface. */
# include <sys/socket.h>
/* The size of `long', as computed by sizeof. */
/* #undef CARES_SIZEOF_LONG */
/* Integral data type used for ares_socklen_t. */
/* The size of `ares_socklen_t', as computed by sizeof. */
/* Data type definition of ares_socklen_t. */
typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;
#endif /* __CARES_BUILD_H */
......@@ -30,14 +30,14 @@ void ares__close_sockets(ares_channel channel, struct server_state *server)
sendreq = server->qhead;
server->qhead = sendreq->next;
if (sendreq->data_storage != NULL)
server->qtail = NULL;
/* Reset any existing input buffer. */
if (server->tcp_buffer)
server->tcp_buffer = NULL;
server->tcp_lenbuf_pos = 0;
......@@ -94,7 +94,7 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host)
if (!*p)
/* Ignore line if reached end of line. */
continue; /* LCOV_EXCL_LINE: trailing whitespace already stripped */
/* Pointer to start of host name. */
txthost = p;
......@@ -164,7 +164,7 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host)
/* Allocate memory for the hostent structure. */
hostent = malloc(sizeof(struct hostent));
hostent = ares_malloc(sizeof(struct hostent));
if (!hostent)
......@@ -173,16 +173,16 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host)
hostent->h_addr_list = NULL;
/* Copy official host name. */
hostent->h_name = strdup(txthost);
hostent->h_name = ares_strdup(txthost);
if (!hostent->h_name)
/* Copy network address. */
hostent->h_addr_list = malloc(2 * sizeof(char *));
hostent->h_addr_list = ares_malloc(2 * sizeof(char *));
if (!hostent->h_addr_list)
hostent->h_addr_list[1] = NULL;
hostent->h_addr_list[0] = malloc(addrlen);
hostent->h_addr_list[0] = ares_malloc(addrlen);
if (!hostent->h_addr_list[0])
if ( == AF_INET)
......@@ -191,7 +191,7 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host)
memcpy(hostent->h_addr_list[0], &addr.addrV6, sizeof(addr.addrV6));
/* Copy aliases. */
hostent->h_aliases = malloc((naliases + 1) * sizeof(char *));
hostent->h_aliases = ares_malloc((naliases + 1) * sizeof(char *));
if (!hostent->h_aliases)
alias = hostent->h_aliases;
......@@ -207,7 +207,7 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host)
while (*q && ISSPACE(*q))
*p = '\0';
if ((*alias = strdup(txtalias)) == NULL)
if ((*alias = ares_strdup(txtalias)) == NULL)
txtalias = *q ? q : NULL;
......@@ -221,7 +221,7 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host)
hostent->h_length = aresx_uztoss(addrlen);
/* Free line buffer. */
/* Return hostent successfully */
*host = hostent;
......@@ -231,7 +231,7 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host)
/* If allocated, free line buffer. */
if (line)
if (status == ARES_SUCCESS)
......@@ -239,20 +239,20 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host)
if (hostent)
if (hostent->h_name)
free((char *) hostent->h_name);
ares_free((char *) hostent->h_name);
if (hostent->h_aliases)
for (alias = hostent->h_aliases; *alias; alias++)