From 2cd51ef5d4e2cb51b708f2f4839acdb6e21f090a Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Mon, 14 Nov 2011 10:58:58 -0800 Subject: [PATCH 1/5] "Trailer" header should mention "Content-MD5" trailer name in this example. Fixes #2107 --- doc/api/http.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/http.markdown b/doc/api/http.markdown index 6836a6b92..c45d5778c 100644 --- a/doc/api/http.markdown +++ b/doc/api/http.markdown @@ -358,7 +358,7 @@ Note that HTTP requires the `Trailer` header to be sent if you intend to emit trailers, with a list of the header fields in its value. E.g., response.writeHead(200, { 'Content-Type': 'text/plain', - 'Trailer': 'TraceInfo' }); + 'Trailer': 'Content-MD5' }); response.write(fileData); response.addTrailers({'Content-MD5': "7895bf4b8828b55ceaf47747b4bca667"}); response.end(); From 4b0241d5892f91dfac0438f9051c71e790be95ea Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Mon, 14 Nov 2011 12:03:23 -0800 Subject: [PATCH 2/5] Remove str.format to support python2.5. Fixes #2077 Fixes #2108 Thanks to David Keegan for debugging and the patch. --- tools/getnodeversion.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/getnodeversion.py b/tools/getnodeversion.py index ddcecec46..766e4f60d 100644 --- a/tools/getnodeversion.py +++ b/tools/getnodeversion.py @@ -1,4 +1,4 @@ -import os,re; +import os,re node_version_h = os.path.join(os.path.dirname(__file__), '..', 'src', 'node_version.h') @@ -13,4 +13,4 @@ for line in f: if re.match('#define NODE_PATCH_VERSION', line): patch = line.split()[2] -print '{0:s}.{1:s}.{2:s}'.format(major, minor, patch) +print '%(major)s.%(minor)s.%(patch)s'% locals() From 17a82e72f490c8c384fec9563f58128ef3234034 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Mon, 14 Nov 2011 17:17:23 -0800 Subject: [PATCH 3/5] Upgrade V8 to 3.6.6.8 --- deps/v8/src/runtime.cc | 7 ++++++- deps/v8/src/version.cc | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/deps/v8/src/runtime.cc b/deps/v8/src/runtime.cc index 6cb8d1a2f..813f98f68 100644 --- a/deps/v8/src/runtime.cc +++ b/deps/v8/src/runtime.cc @@ -6841,7 +6841,12 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SparseJoinWithSeparator) { // Find total length of join result. int string_length = 0; bool is_ascii = separator->IsAsciiRepresentation(); - int max_string_length = SeqAsciiString::kMaxLength; + int max_string_length; + if (is_ascii) { + max_string_length = SeqAsciiString::kMaxLength; + } else { + max_string_length = SeqTwoByteString::kMaxLength; + } bool overflow = false; CONVERT_NUMBER_CHECKED(int, elements_length, Int32, elements_array->length()); diff --git a/deps/v8/src/version.cc b/deps/v8/src/version.cc index 865cfe500..2865502c1 100644 --- a/deps/v8/src/version.cc +++ b/deps/v8/src/version.cc @@ -35,7 +35,7 @@ #define MAJOR_VERSION 3 #define MINOR_VERSION 6 #define BUILD_NUMBER 6 -#define PATCH_LEVEL 7 +#define PATCH_LEVEL 8 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) #define IS_CANDIDATE_VERSION 0 From 3b852d7faba82d5ec2367939ecc98c3ab03cb2e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Walukiewicz?= Date: Wed, 16 Nov 2011 13:38:09 +0100 Subject: [PATCH 4/5] buffer: fix minimum values for writeInt*() functions --- lib/buffer.js | 6 +-- test/simple/test-writeint.js | 75 ++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 3 deletions(-) diff --git a/lib/buffer.js b/lib/buffer.js index 25dfaab04..dbf1b3b3f 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -988,7 +988,7 @@ Buffer.prototype.writeInt8 = function(value, offset, noAssert) { assert.ok(offset < buffer.length, 'Trying to write beyond buffer length'); - verifsint(value, 0x7f, -0xf0); + verifsint(value, 0x7f, -0x80); } if (value >= 0) { @@ -1012,7 +1012,7 @@ function writeInt16(buffer, value, offset, isBigEndian, noAssert) { assert.ok(offset + 1 < buffer.length, 'Trying to write beyond buffer length'); - verifsint(value, 0x7fff, -0xf000); + verifsint(value, 0x7fff, -0x8000); } if (value >= 0) { @@ -1044,7 +1044,7 @@ function writeInt32(buffer, value, offset, isBigEndian, noAssert) { assert.ok(offset + 3 < buffer.length, 'Trying to write beyond buffer length'); - verifsint(value, 0x7fffffff, -0xf0000000); + verifsint(value, 0x7fffffff, -0x80000000); } if (value >= 0) { diff --git a/test/simple/test-writeint.js b/test/simple/test-writeint.js index 6a62e5b1e..77a4fea0b 100644 --- a/test/simple/test-writeint.js +++ b/test/simple/test-writeint.js @@ -19,6 +19,19 @@ function test8() { ASSERT.throws(function() { buffer.writeInt8(0xabc, 0); }); + + /* Make sure we handle min/max correctly */ + buffer.writeInt8(0x7f, 0); + buffer.writeInt8(-0x80, 1); + + ASSERT.equal(0x7f, buffer[0]); + ASSERT.equal(0x80, buffer[1]); + ASSERT.throws(function() { + buffer.writeInt8(0x7f + 1, 0); + }); + ASSERT.throws(function() { + buffer.writeInt8(-0x80 - 1, 0); + }); } @@ -45,6 +58,33 @@ function test16() { ASSERT.equal(0x71, buffer[2]); ASSERT.equal(0x71, buffer[3]); ASSERT.equal(0xf9, buffer[4]); + + /* Make sure we handle min/max correctly */ + buffer.writeInt16BE(0x7fff, 0); + buffer.writeInt16BE(-0x8000, 2); + ASSERT.equal(0x7f, buffer[0]); + ASSERT.equal(0xff, buffer[1]); + ASSERT.equal(0x80, buffer[2]); + ASSERT.equal(0x00, buffer[3]); + ASSERT.throws(function() { + buffer.writeInt16BE(0x7fff + 1, 0); + }); + ASSERT.throws(function() { + buffer.writeInt16BE(-0x8000 - 1, 0); + }); + + buffer.writeInt16LE(0x7fff, 0); + buffer.writeInt16LE(-0x8000, 2); + ASSERT.equal(0xff, buffer[0]); + ASSERT.equal(0x7f, buffer[1]); + ASSERT.equal(0x00, buffer[2]); + ASSERT.equal(0x80, buffer[3]); + ASSERT.throws(function() { + buffer.writeInt16LE(0x7fff + 1, 0); + }); + ASSERT.throws(function() { + buffer.writeInt16LE(-0x8000 - 1, 0); + }); } @@ -83,6 +123,41 @@ function test32() { ASSERT.equal(0xfe, buffer[5]); ASSERT.equal(0xff, buffer[6]); ASSERT.equal(0xcf, buffer[7]); + + /* Make sure we handle min/max correctly */ + buffer.writeInt32BE(0x7fffffff, 0); + buffer.writeInt32BE(-0x80000000, 4); + ASSERT.equal(0x7f, buffer[0]); + ASSERT.equal(0xff, buffer[1]); + ASSERT.equal(0xff, buffer[2]); + ASSERT.equal(0xff, buffer[3]); + ASSERT.equal(0x80, buffer[4]); + ASSERT.equal(0x00, buffer[5]); + ASSERT.equal(0x00, buffer[6]); + ASSERT.equal(0x00, buffer[7]); + ASSERT.throws(function() { + buffer.writeInt32BE(0x7fffffff + 1, 0); + }); + ASSERT.throws(function() { + buffer.writeInt32BE(-0x80000000 - 1, 0); + }); + + buffer.writeInt32LE(0x7fffffff, 0); + buffer.writeInt32LE(-0x80000000, 4); + ASSERT.equal(0xff, buffer[0]); + ASSERT.equal(0xff, buffer[1]); + ASSERT.equal(0xff, buffer[2]); + ASSERT.equal(0x7f, buffer[3]); + ASSERT.equal(0x00, buffer[4]); + ASSERT.equal(0x00, buffer[5]); + ASSERT.equal(0x00, buffer[6]); + ASSERT.equal(0x80, buffer[7]); + ASSERT.throws(function() { + buffer.writeInt32LE(0x7fffffff + 1, 0); + }); + ASSERT.throws(function() { + buffer.writeInt32LE(-0x80000000 - 1, 0); + }); } From 44314ccf48332c91db57a53d5fc0e3de48642681 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Wed, 16 Nov 2011 13:05:35 -0800 Subject: [PATCH 5/5] Upgrade libuv to 2007eb8 --- deps/uv/.mailmap | 1 + deps/uv/AUTHORS | 4 +++- deps/uv/config-unix.mk | 9 +++++++++ deps/uv/include/uv.h | 4 ++-- deps/uv/src/unix/eio/eio.c | 2 +- deps/uv/src/unix/freebsd.c | 8 +++++++- deps/uv/src/unix/netbsd.c | 2 +- deps/uv/src/unix/stream.c | 4 ++-- deps/uv/test/benchmark-pound.c | 2 +- deps/uv/test/runner-unix.c | 22 ---------------------- 10 files changed, 27 insertions(+), 31 deletions(-) diff --git a/deps/uv/.mailmap b/deps/uv/.mailmap index 2d608f95f..accc9621a 100644 --- a/deps/uv/.mailmap +++ b/deps/uv/.mailmap @@ -8,3 +8,4 @@ San-Tai Hsu Isaac Z. Schlueter Saúl Ibarra Corretgé Yuki OKUMURA +Frank Denis diff --git a/deps/uv/AUTHORS b/deps/uv/AUTHORS index 2d43c3661..16f88934f 100644 --- a/deps/uv/AUTHORS +++ b/deps/uv/AUTHORS @@ -30,4 +30,6 @@ Saúl Ibarra Corretgé Felix Geisendörfer Yuki OKUMURA Roman Shtylman -Frank DENIS +Frank Denis +Carter Allen +Tj Holowaychuk diff --git a/deps/uv/config-unix.mk b/deps/uv/config-unix.mk index 9524061b1..8fe7254cf 100644 --- a/deps/uv/config-unix.mk +++ b/deps/uv/config-unix.mk @@ -74,6 +74,15 @@ OBJS += src/unix/freebsd.o OBJS += src/unix/kqueue.o endif +ifeq (DragonFly,$(uname_S)) +EV_CONFIG=config_freebsd.h +EIO_CONFIG=config_freebsd.h +CPPFLAGS += -Isrc/ares/config_freebsd +LINKFLAGS+= +OBJS += src/unix/freebsd.o +OBJS += src/unix/kqueue.o +endif + ifeq (NetBSD,$(uname_S)) EV_CONFIG=config_netbsd.h EIO_CONFIG=config_netbsd.h diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h index 28ef8ee34..a2c4f2aa7 100644 --- a/deps/uv/include/uv.h +++ b/deps/uv/include/uv.h @@ -48,7 +48,7 @@ extern "C" { #define UV_VERSION_MAJOR 0 -#define UV_VERSION_MINOR 1 +#define UV_VERSION_MINOR 6 #include /* int64_t */ @@ -730,7 +730,7 @@ UV_EXTERN int uv_tty_set_mode(uv_tty_t*, int mode); * To be called when the program exits. Resets TTY settings to default * values for the next process to take over. */ -UV_EXTERN void uv_tty_reset_mode(); +UV_EXTERN void uv_tty_reset_mode(void); /* * Gets the current Window size. On success zero is returned. diff --git a/deps/uv/src/unix/eio/eio.c b/deps/uv/src/unix/eio/eio.c index 237400611..75abd9bb6 100644 --- a/deps/uv/src/unix/eio/eio.c +++ b/deps/uv/src/unix/eio/eio.c @@ -316,7 +316,7 @@ static int gettimeofday(struct timeval *tv, struct timezone *tz) #if HAVE_SENDFILE # if __linux # include -# elif __FreeBSD__ || defined __APPLE__ +# elif __FreeBSD__ || __DragonFly__ || defined __APPLE__ # include # include # elif __hpux diff --git a/deps/uv/src/unix/freebsd.c b/deps/uv/src/unix/freebsd.c index 7c5deabb8..a519f86d4 100644 --- a/deps/uv/src/unix/freebsd.c +++ b/deps/uv/src/unix/freebsd.c @@ -50,11 +50,17 @@ int uv_exepath(char* buffer, size_t* size) { return -1; } - +#ifdef __DragonFly__ + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_ARGS; + mib[3] = getpid(); +#else mib[0] = CTL_KERN; mib[1] = KERN_PROC; mib[2] = KERN_PROC_PATHNAME; mib[3] = -1; +#endif cb = *size; if (sysctl(mib, 4, buffer, &cb, NULL, 0) < 0) { diff --git a/deps/uv/src/unix/netbsd.c b/deps/uv/src/unix/netbsd.c index 8b91f65c7..cf83c3448 100644 --- a/deps/uv/src/unix/netbsd.c +++ b/deps/uv/src/unix/netbsd.c @@ -91,7 +91,7 @@ uint64_t uv_get_free_memory(void) { return -1; } - return (uint64_t) info.free * psysconf(_SC_PAGESIZE); + return (uint64_t) info.free * sysconf(_SC_PAGESIZE); } uint64_t uv_get_total_memory(void) { diff --git a/deps/uv/src/unix/stream.c b/deps/uv/src/unix/stream.c index 3cdeaa8cf..25737814e 100644 --- a/deps/uv/src/unix/stream.c +++ b/deps/uv/src/unix/stream.c @@ -145,7 +145,7 @@ void uv__stream_destroy(uv_stream_t* stream) { req = ngx_queue_data(q, uv_write_t, queue); if (req->cb) { - uv__set_artificial_error(stream->loop, req->error); + uv__set_sys_error(stream->loop, req->error); req->cb(req, req->error ? -1 : 0); } } @@ -490,7 +490,7 @@ static void uv__write_callbacks(uv_stream_t* stream) { /* NOTE: call callback AFTER freeing the request data. */ if (req->cb) { - uv__set_artificial_error(stream->loop, req->error); + uv__set_sys_error(stream->loop, req->error); req->cb(req, req->error ? -1 : 0); } diff --git a/deps/uv/test/benchmark-pound.c b/deps/uv/test/benchmark-pound.c index 92a536db7..64f404ca9 100644 --- a/deps/uv/test/benchmark-pound.c +++ b/deps/uv/test/benchmark-pound.c @@ -28,6 +28,7 @@ #undef NANOSEC #define NANOSEC ((uint64_t)10e8) +#undef DEBUG #define DEBUG 0 struct conn_rec_s; @@ -135,7 +136,6 @@ static void connect_cb(uv_connect_t* req, int status) { static void read_cb(uv_stream_t* stream, ssize_t nread, uv_buf_t buf) { - conn_rec* p = (conn_rec*)stream->data; uv_err_t err = uv_last_error(loop); ASSERT(stream != NULL); diff --git a/deps/uv/test/runner-unix.c b/deps/uv/test/runner-unix.c index 6033d6429..3c78bb50a 100644 --- a/deps/uv/test/runner-unix.c +++ b/deps/uv/test/runner-unix.c @@ -37,35 +37,13 @@ #include #include -#ifdef __APPLE__ -#include /* _NSGetExecutablePath */ - -static void get_executable_path() { - uint32_t bufsize = sizeof(executable_path); - _NSGetExecutablePath(executable_path, &bufsize); -} -#endif - -#ifdef __linux__ -static void get_executable_path() { - if (!executable_path[0]) { - readlink("/proc/self/exe", executable_path, PATHMAX - 1); - } -} -#endif - /* Do platform-specific initialization. */ void platform_init(int argc, char **argv) { /* Disable stdio output buffering. */ setvbuf(stdout, NULL, _IONBF, 0); setvbuf(stderr, NULL, _IONBF, 0); -#ifdef get_executable_path - get_executable_path(); -#else strcpy(executable_path, argv[0]); -#endif - signal(SIGPIPE, SIG_IGN); }