Commit 8457e7da authored by Jérémy Lal's avatar Jérémy Lal

Imported Upstream version 0.8.18~dfsg1

parent 797b710f
......@@ -364,3 +364,16 @@ Pooya Karimian <pkarimian@sencha.com>
Frédéric Germain <frederic.germain@gmail.com>
Robin Lee <cheeselee@fedoraproject.org>
Adam Blackburn <regality@gmail.com>
Willi Eggeling <email@wje-online.de>
Andrew Paprocki <andrew@ishiboo.com>
Max Ogden <max@maxogden.com>
Olivier Lalonde <olalonde@gmail.com>
Francois Marier <francois@mozilla.com>
Trevor Norris <trev.norris@gmail.com>
Joshua Erickson <josh@snoj.us>
Kai Sasaki Lewuathe <sasaki_kai@lewuathe.sakura.ne.jp>
Nicolas Chambrier <naholyr@gmail.com>
Tim Bradshaw <tfb@cley.com>
Johannes Ewald <mail@johannesewald.de>
Chris Dent <chris.dent@gmail.com>
Dan Milon <danmilon@gmail.com>
# CONTRIBUTING
The node.js project welcomes new contributors. This document will guide you
through the process.
### FORK
Fork the project [on GitHub](https://github.com/joyent/node) and check out
your copy.
```
$ git clone git@github.com:username/node.git
$ cd node
$ git remote add upstream git://github.com/joyent/node.git
```
Now decide if you want your feature or bug fix to go into the master branch
or the stable branch. As a rule of thumb, bug fixes go into the stable branch
while new features go into the master branch.
The stable branch is effectively frozen; patches that change the node.js
API/ABI or affect the run-time behavior of applications get rejected.
The rules for the master branch are less strict; consult the
[stability index page][] for details.
In a nutshell, modules are at varying levels of API stability. Bug fixes are
always welcome but API or behavioral changes to modules at stability level 3
and up are off-limits.
Node.js has several bundled dependencies in the deps/ directory that are not
part of the project proper. Any changes to files in that directory or its
subdirectories should be sent to their respective projects. Do not send
that patch to us, we cannot accept it.
In case of doubt, open an issue in the [issue tracker][], post your question
to the [node.js mailing list][] or contact one of the [project maintainers][]
on [IRC][].
Especially do so if you plan to work on something big. Nothing is more
frustrating than seeing your hard work go to waste because your vision
does not align with that of a project maintainer.
### BRANCH
Okay, so you have decided on the proper branch. Create a feature branch
and start hacking:
```
$ git checkout -b my-feature-branch -t origin/v0.8
```
(Where v0.8 is the latest stable branch as of this writing.)
### COMMIT
Make sure git knows your name and email address:
```
$ git config --global user.name "J. Random User"
$ git config --global user.email "j.random.user@example.com"
```
Writing good commit logs is important. A commit log should describe what
changed and why. Follow these guidelines when writing one:
1. The first line should be 50 characters or less and contain a short
description of the change.
2. Keep the second line blank.
3. Wrap all other lines at 72 columns.
A good commit log looks like this:
```
Header line: explaining the commit in one line
Body of commit message is a few lines of text, explaining things
in more detail, possibly giving some background about the issue
being fixed, etc etc.
The body of the commit message can be several paragraphs, and
please do proper word-wrap and keep columns shorter than about
72 characters or so. That way `git log` will show things
nicely even when it is indented.
```
The header line should be meaningful; it is what other people see when they
run `git shortlog` or `git log --oneline`.
Have a look at `git log` for inspiration.
### REBASE
Use `git rebase` (not `git merge`) to sync your work from time to time.
```
$ git fetch upstream
$ git rebase upstream/v0.8 # or upstream/master
```
### TEST
Bug fixes and features should come with tests. Add your tests in the
test/simple/ directory. Look at other tests to see how they should be
structured (license boilerplate, common includes, etc.).
```
$ make jslint test
```
Make sure the linter is happy and that all tests pass. Please, do not submit
patches that fail either check.
### PUSH
```
$ git push origin my-feature-branch
```
Go to https://github.com/username/node and select your feature branch. Click
the 'Pull Request' button and fill out the form.
Pull requests are usually reviewed within a few days. If there are comments
to address, apply your changes in a separate commit and push that to your
feature branch. Post a comment in the pull request afterwards; GitHub does
not send out notifications when you add commits.
### CONTRIBUTOR LICENSE AGREEMENT
Please visit http://nodejs.org/cla.html and sign the Contributor License
Agreement. You only need to do that once.
[stability index page]: https://github.com/joyent/node/blob/master/doc/api/documentation.markdown
[issue tracker]: https://github.com/joyent/node/issues
[node.js mailing list]: http://groups.google.com/group/nodejs
[IRC]: http://webchat.freenode.net/?channels=node.js
[project maintainers]: https://github.com/joyent/node/wiki/Project-Organization
2012.09.27, Version 0.8.11 (Stable)
2013.01.18, Version 0.8.18 (Stable)
* npm: Upgrade to v1.2.2
* dns: make error message match errno (Dan Milon)
* tls: follow RFC6125 more stricly (Fedor Indutny)
* buffer: reject negative SlowBuffer offsets (Ben Noordhuis)
* install: add simplejson fallback (Chris Dent)
* http: fix "Cannot call method 'emit' of null" (Ben Noordhuis)
2013.01.09, Version 0.8.17 (Stable), c50c33e9397d7a0a8717e8ce7530572907c054ad
* npm: Upgrade to v1.2.0
- peerDependencies (Domenic Denicola)
- node-gyp v0.8.2 (Nathan Rajlich)
- Faster installs from github user/project shorthands (Nathan Zadoks)
* typed arrays: fix 32 bit size/index overflow (Ben Noordhuis)
* http: Improve performance of single-packet responses (Ben Noordhuis)
* install: fix openbsd man page location (Ben Noordhuis)
* http: bubble up parser errors to ClientRequest (Brian White)
2012.12.13, Version 0.8.16 (Stable), 1c9c6277d5cfcaaac8569c0c8f7daa64292048a9
* npm: Upgrade to 1.1.69
* fs: fix WriteStream/ReadStream fd leaks (Ben Noordhuis)
* crypto: fix leak in GetPeerCertificate (Fedor Indutny)
* buffer: Don't double-negate numeric buffer arg (Trevor Norris)
* net: More accurate IP address validation and IPv6 dotted notation. (Joshua Erickson)
2012.11.26, Version 0.8.15 (Stable), fdf91afb494a7a2fff2913d817f589c191a2c88f
* npm: Upgrade to 1.1.66 (isaacs)
* linux: use /proc/cpuinfo for CPU frequency (Ben Noordhuis)
* windows: map WSAESHUTDOWN to UV_EPIPE (Ben Noordhuis)
* windows: map ERROR_GEN_FAILURE to UV_EIO (Bert Belder)
* unix: do not set environ unless one is provided (Charlie McConnell)
* domains: don't crash if domain is set to null (Bert Belder)
* windows: fix the x64 debug build (Bert Belder)
* net, tls: fix connect() resource leak (Ben Noordhuis)
2012.10.25, Version 0.8.14 (Stable), b00527fcf05c3d9f/b5d5d790f9472906a59fe218
* events: Don't clobber pre-existing _events obj in EE ctor (isaacs)
2012.10.25, Version 0.8.13 (Stable), ff4c974873f9a7cc6a5b042eb9b6389bb8dde6d6
* V8: Upgrade to 3.11.10.25
* npm: Upgrade to 1.1.65
* url: parse hostnames that start with - or _ (Ben Noordhuis)
* repl: Fix Windows 8 terminal issue (Bert Belder)
* typed arrays: use signed char for signed int8s (Aaron Jacobs)
* crypto: fix bugs in DiffieHellman (Ben Noordhuis)
* configure: turn on VFPv3 on ARMv7 (Ben Noordhuis)
* Re-enable OpenSSL UI for entering passphrases via tty (Ben Noordhuis)
* repl: ensure each REPL instance gets its own "context" (Nathan Rajlich)
2012.10.12, Version 0.8.12 (Stable), 38c72d4e29574dec5205bcf23c2a85efe65331a4
* npm: Upgrade to 1.1.63
* crypto: Reduce stability index to 2-Unstable (isaacs)
* windows: fix handle leak in uv_fs_utime (Bert Belder)
* windows: fix application crashed popup in debug version (Bert Belder)
* buffer: report proper retained size in profiler (Ben Noordhuis)
* buffer: fix byteLength with UTF-16LE (koichik)
* repl: make "end of input" JSON.parse() errors throw in the REPL (Nathan Rajlich)
* repl: make invalid RegExp modifiers throw in the REPL (Nathan Rajlich)
* http: handle multiple Proxy-Authenticate values (Willi Eggeling)
2012.09.27, Version 0.8.11 (Stable), e1f39468fa580c1e4cb15fac621f87944ee625dc
* fs: Fix stat() size reporting for large files (Ben Noordhuis)
2012.09.25, Version 0.8.10 (Stable)
2012.09.25, Version 0.8.10 (Stable), 0bc273da4fcaa79b209ed755ad249a3e7be626a6
* npm: Upgrade to 1.1.62
......@@ -765,7 +875,7 @@
* Bug fixes
2012.07.10 Version 0.6.20 (maintenance)
2012.07.10 Version 0.6.20 (maintenance), 952e513379169ec1b40909d1db056e9bf4294899
* npm: Upgrade to 1.1.37 (isaacs)
......@@ -1128,7 +1238,7 @@
* crypto: don't ignore DH init errors (Ben Noordhuis)
2011.12.14, Version 0.6.6
2011.12.14, Version 0.6.6 (stable), 9a059ea69e1f6ebd8899246682d8ca257610b8ab
* npm update to 1.1.0-beta-4 (Isaac Z. Schlueter)
......@@ -1365,7 +1475,7 @@ koichik, Maciej Małecki, Guglielmo Ferri, isaacs)
* Upgrade GYP to r1081
2011.10.10, Version 0.5.9 (unstable)
2011.10.10, Version 0.5.9 (unstable), 3bd9b08fb125b606f97a4079b147accfdeebb07d
* fs.watch interface backed by kqueue, inotify, and ReadDirectoryChangesW
(Igor Zinkovsky, Ben Noordhuis)
......@@ -1449,7 +1559,7 @@ koichik, Maciej Małecki, Guglielmo Ferri, isaacs)
* #1719 Drain OpenSSL error queue
2011.09.08, Version 0.5.6 (unstable)
2011.09.08, Version 0.5.6 (unstable), b49bec55806574a47403771bce1ee379c2b09ca2
* #345, #1635, #1648 Documentation improvements (Thomas Shinnick,
Abimanyu Raja, AJ ONeal, Koichi Kobayashi, Michael Jackson, Logan Smyth,
......@@ -1737,7 +1847,7 @@ koichik, Maciej Małecki, Guglielmo Ferri, isaacs)
* DTrace probes: support X-Forwarded-For (Dave Pacheco)
2011.09.15, Version 0.4.12 (stable)
2011.09.15, Version 0.4.12 (stable), 771ba34ca7b839add2ef96879e1ffc684813cf7c
* Improve docs
......@@ -1786,7 +1896,7 @@ koichik, Maciej Małecki, Guglielmo Ferri, isaacs)
* Doc improvments (koichik, Logan Smyth, Ben Noordhuis, Arnout Kazemier)
2011.07.19, Version 0.4.10 (stable)
2011.07.19, Version 0.4.10 (stable), 1b8dd65d6e3b82b6863ef38835cc436c5d30c1d5
* #394 Fix Buffer drops last null character in UTF-8
......@@ -1813,7 +1923,7 @@ koichik, Maciej Małecki, Guglielmo Ferri, isaacs)
* Doc improvements
2011.06.29, Version 0.4.9 (stable)
2011.06.29, Version 0.4.9 (stable), de44eafd7854d06cd85006f509b7051e8540589b
* Improve documentation
......@@ -1887,7 +1997,7 @@ koichik, Maciej Małecki, Guglielmo Ferri, isaacs)
* Upgrade V8 to 3.1.8.16.
2011.04.22, Version 0.4.7 (stable)
2011.04.22, Version 0.4.7 (stable), c85455a954411b38232e79752d4abb61bb75031b
* Don't emit error on ECONNRESET from read() #670
......@@ -1905,7 +2015,7 @@ koichik, Maciej Małecki, Guglielmo Ferri, isaacs)
* Improve docs.
2011.04.13, Version 0.4.6 (stable)
2011.04.13, Version 0.4.6 (stable), 58002d56bc79410c5ff397fc0e1ffec0665db38a
* Don't error on ENOTCONN from shutdown() #670
......@@ -1935,7 +2045,7 @@ koichik, Maciej Małecki, Guglielmo Ferri, isaacs)
* Upgrade v8 to 3.1.8.10
2011.04.01, Version 0.4.5 (stable)
2011.04.01, Version 0.4.5 (stable), 787a343b588de26784fef97f953420b53a6e1d73
* Fix listener leak in stream.pipe() (Mikeal Rogers)
......@@ -2068,7 +2178,7 @@ koichik, Maciej Małecki, Guglielmo Ferri, isaacs)
* Upgrade V8 to 3.1.5, libev to 4.4.
2011.02.10, Version 0.4.0 (stable)
2011.02.10, Version 0.4.0 (stable), eb155ea6f6a6aa341aa8c731dca8da545c6a4008
* require() improvements (isaacs)
- understand package.json (isaacs)
......@@ -2101,7 +2211,7 @@ koichik, Maciej Małecki, Guglielmo Ferri, isaacs)
* Upgrade V8 to 3.1.2
2011.02.04, Version 0.3.8 (unstable)
2011.02.04, Version 0.3.8 (unstable), 9493b7563bff31525b4080df5aeef09747782d5e
* Add req.abort() for client side requests.
......@@ -2123,7 +2233,7 @@ koichik, Maciej Małecki, Guglielmo Ferri, isaacs)
* Upgrade V8 to 3.1.1
2011.01.27, Version 0.3.7 (unstable)
2011.01.27, Version 0.3.7 (unstable), d8579c6afdbe868de6dffa8db78bbe4ba2d03e0e
* Expose agent in http and https client. (Mikeal Rogers)
......@@ -2185,7 +2295,7 @@ koichik, Maciej Małecki, Guglielmo Ferri, isaacs)
* Don't stat() on cached modules. (Felix Geisendörfer)
2011.01.08, Version 0.3.4 (unstable)
2011.01.08, Version 0.3.4 (unstable), 73f53e12e4a5b9ef7dbb4792bd5f8ad403094441
* Primordial mingw build (Bert Belder)
......@@ -2403,7 +2513,7 @@ koichik, Maciej Małecki, Guglielmo Ferri, isaacs)
* Upgrade V8 to 2.3.8
2010.08.13, Version 0.1.104
2010.08.13, Version 0.1.104, b14dd49222687c12f3e8eac597cff4f2674f84e8
* Various bug fixes (console, querystring, require)
......
......@@ -278,7 +278,7 @@ tar: $(TARBALL)
$(BINARYTAR): release-only
rm -rf $(BINARYNAME)
rm -rf out/deps out/Release
./configure --prefix=/ --without-snapshot --dest-cpu=$(DESTCPU)
./configure --prefix=/ --without-snapshot --dest-cpu=$(DESTCPU) $(CONFIG_FLAGS)
$(MAKE) install DESTDIR=$(BINARYNAME) V=$(V) PORTABLE=1
cp README.md $(BINARYNAME)
cp LICENSE $(BINARYNAME)
......
......@@ -96,13 +96,12 @@ var server = http.createServer(function (req, res) {
'Transfer-Encoding': 'chunked' });
// send body in chunks
var len = body.length;
var step = ~~(len / n_chunks) || len;
var step = Math.floor(len / n_chunks) || 1;
for (var i = 0; i < len; i += step) {
res.write(body.slice(i, i + step));
for (var i = 0, n = (n_chunks - 1); i < n; ++i) {
res.write(body.slice(i * step, i * step + step));
}
res.end();
res.end(body.slice((n_chunks - 1) * step));
} else {
var content_length = body.length.toString();
......
......@@ -77,13 +77,12 @@ var server = http.createServer(function (req, res) {
"Transfer-Encoding": "chunked" });
// send body in chunks
var len = body.length;
var step = ~~(len / n_chunks) || len;
var step = Math.floor(len / n_chunks) || 1;
for (var i = 0; i < len; i += step) {
res.write(body.slice(i, i + step));
for (var i = 0, n = (n_chunks - 1); i < n; ++i) {
res.write(body.slice(i * step, i * step + step));
}
res.end();
res.end(body.slice((n_chunks - 1) * step));
} else {
var content_length = body.length.toString();
......
......@@ -176,6 +176,17 @@ parser.add_option("--with-arm-float-abi",
help="Specifies which floating-point ABI to use. Valid values are: "
"soft, softfp, hard")
# Using --unsafe-optimizations voids your warranty.
parser.add_option("--unsafe-optimizations",
action="store_true",
dest="unsafe_optimizations",
help=optparse.SUPPRESS_HELP)
parser.add_option("--tag",
action="store",
dest="tag",
help="Custom build tag")
(options, args) = parser.parse_args()
......@@ -322,12 +333,31 @@ def compiler_version():
return (version, is_clang)
def configure_arm(o):
# V8 on ARM requires that armv7 is set. CPU Model detected by
# the presence of __ARM_ARCH_7__ and the like defines in compiler
if options.arm_float_abi:
hard_float = options.arm_float_abi == 'hard'
else:
hard_float = arm_hard_float_abi()
o['variables']['v8_use_arm_eabi_hardfloat'] = b(hard_float)
armv7 = is_arch_armv7()
if armv7:
# CHECKME VFPv3 implies ARMv7+ but is the reverse true as well?
o['variables']['arm_fpu'] = 'vfpv3'
o['variables']['arm_neon'] = 0
o['variables']['armv7'] = int(armv7)
def configure_node(o):
# TODO add gdb
o['variables']['v8_no_strict_aliasing'] = 1 # work around compiler bugs
o['variables']['node_prefix'] = os.path.expanduser(options.prefix or '')
o['variables']['node_install_npm'] = b(not options.without_npm)
o['variables']['node_install_waf'] = b(not options.without_waf)
o['variables']['node_unsafe_optimizations'] = (
1 if options.unsafe_optimizations else 0)
o['default_configuration'] = 'Debug' if options.debug else 'Release'
host_arch = host_arch_win() if os.name == 'nt' else host_arch_cc()
......@@ -335,15 +365,8 @@ def configure_node(o):
o['variables']['host_arch'] = host_arch
o['variables']['target_arch'] = target_arch
# V8 on ARM requires that armv7 is set. CPU Model detected by
# the presence of __ARM_ARCH_7__ and the like defines in compiler
if target_arch == 'arm':
if options.arm_float_abi:
hard_float = options.arm_float_abi == 'hard'
else:
hard_float = arm_hard_float_abi()
o['variables']['v8_use_arm_eabi_hardfloat'] = b(hard_float)
o['variables']['armv7'] = 1 if is_arch_armv7() else 0
configure_arm(o)
cc_version, is_clang = compiler_version()
o['variables']['clang'] = 1 if is_clang else 0
......@@ -376,6 +399,11 @@ def configure_node(o):
else:
o['variables']['node_use_etw'] = 'false'
if options.tag:
o['variables']['node_tag'] = '-' + options.tag
else:
o['variables']['node_tag'] = ''
def configure_libz(o):
o['variables']['node_shared_zlib'] = b(options.shared_zlib)
......
......@@ -101,7 +101,7 @@ struct ngx_queue_s {
#define ngx_queue_foreach(q, h) \
for ((q) = ngx_queue_head(h); \
(q) != ngx_queue_sentinel(h); \
(q) != ngx_queue_sentinel(h) && !ngx_queue_empty(h); \
(q) = ngx_queue_next(q))
......
......@@ -291,7 +291,12 @@ static int uv_getaddrinfo_done(eio_req* req_) {
uv_getaddrinfo_t* req = req_->data;
struct addrinfo *res = req->res;
#if __sun
size_t hostlen = strlen(req->hostname);
size_t hostlen;
if (req->hostname)
hostlen = strlen(req->hostname);
else
hostlen = 0;
#endif
req->res = NULL;
......
......@@ -30,6 +30,7 @@
#include <net/if.h>
#include <sys/param.h>
#include <sys/prctl.h>
#include <sys/sysinfo.h>
#include <unistd.h>
#include <fcntl.h>
......@@ -167,6 +168,10 @@ uv_err_t uv_set_process_title(const char* title) {
if (process_title.len)
strncpy(process_title.str, title, process_title.len - 1);
#if defined(PR_SET_NAME)
prctl(PR_SET_NAME, title);
#endif
return uv_ok_;
}
......@@ -320,10 +325,13 @@ uv_err_t uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
if (ci == NULL)
return uv__new_sys_error(ENOMEM);
read_speeds(numcpus, ci);
read_models(numcpus, ci);
read_times(numcpus, ci);
/* read_models() on x86 also reads the CPU speed from /proc/cpuinfo */
if (ci[0].speed == 0)
read_speeds(numcpus, ci);
*cpu_infos = ci;
*count = numcpus;
......@@ -339,18 +347,26 @@ static void read_speeds(unsigned int numcpus, uv_cpu_info_t* ci) {
}
/* Also reads the CPU frequency on x86. The other architectures only have
* a BogoMIPS field, which may not be very accurate.
*/
static void read_models(unsigned int numcpus, uv_cpu_info_t* ci) {
#if defined(__i386__) || defined(__x86_64__)
static const char marker[] = "model name\t: ";
static const char model_marker[] = "model name\t: ";
static const char speed_marker[] = "cpu MHz\t\t: ";
#elif defined(__arm__)
static const char marker[] = "Processor\t: ";
static const char model_marker[] = "Processor\t: ";
static const char speed_marker[] = "";
#elif defined(__mips__)
static const char marker[] = "cpu model\t\t: ";
static const char model_marker[] = "cpu model\t\t: ";
static const char speed_marker[] = "";
#else
# warning uv_cpu_info() is not supported on this architecture.
static const char marker[] = "(dummy)";
static const char model_marker[] = "";
static const char speed_marker[] = "";
#endif
unsigned int num;
unsigned int model_idx;
unsigned int speed_idx;
char buf[1024];
char* model;
FILE* fp;
......@@ -359,18 +375,27 @@ static void read_models(unsigned int numcpus, uv_cpu_info_t* ci) {
if (fp == NULL)
return;
num = 0;
model_idx = 0;
speed_idx = 0;
while (fgets(buf, sizeof(buf), fp)) {
if (num >= numcpus)
break;
if (strncmp(buf, marker, sizeof(marker) - 1))
if (model_marker[0] != '\0' &&
model_idx < numcpus &&
strncmp(buf, model_marker, sizeof(model_marker) - 1) == 0)
{
model = buf + sizeof(model_marker) - 1;
model = strndup(model, strlen(model) - 1); /* strip newline */
ci[model_idx++].model = model;
continue;
}
model = buf + sizeof(marker) - 1;
model = strndup(model, strlen(model) - 1); /* strip newline */
ci[num++].model = model;
if (speed_marker[0] != '\0' &&
speed_idx < numcpus &&
strncmp(buf, speed_marker, sizeof(speed_marker) - 1) == 0)
{
ci[speed_idx++].speed = atoi(buf + sizeof(speed_marker) - 1);
continue;
}
}
fclose(fp);
}
......
......@@ -260,7 +260,9 @@ static void uv__process_child_init(uv_process_options_t options,
_exit(127);
}
environ = options.env;
if (options.env) {
environ = options.env;
}
execvp(options.file, options.args);
perror("execvp()");
......
......@@ -218,7 +218,7 @@ int uv_fs_event_init(uv_loop_t* loop,
void uv__fs_event_close(uv_fs_event_t* handle) {
if (handle->fd == PORT_FIRED) {
if (handle->fd == PORT_FIRED || handle->fd == PORT_LOADED) {
port_dissociate(handle->loop->fs_fd, PORT_SOURCE_FILE, (uintptr_t)&handle->fo);
}
handle->fd = PORT_DELETED;
......
......@@ -55,7 +55,9 @@ static void uv_init(void) {
/* Tell the CRT to not exit the application when an invalid parameter is */
/* passed. The main issue is that invalid FDs will trigger this behavior. */
#ifdef _WRITE_ABORT_MSG
_set_invalid_parameter_handler(uv__crt_invalid_parameter_handler);
#endif
/* Fetch winapi function pointers. This must be done first because other */
/* intialization code might need these function pointers to be loaded. */
......
......@@ -74,6 +74,7 @@ uv_err_code uv_translate_sys_error(int sys_errno) {