Commit 3cfa9db4 authored by Jérémy Lal's avatar Jérémy Lal

Imported Upstream version 0.10.8~dfsg1

parent 328cd30c
......@@ -449,3 +449,4 @@ Robert Kowalski <rok@kowalski.gd>
Benoit Vallée <github@benoitvallee.net>
Ryuichi Okumura <okuryu@okuryu.com>
Brandon Frohs <bfrohs@gmail.com>
Nathan Zadoks <nathan@nathan7.eu>
2013.05.17, Version 0.10.7 (Stable)
2013.05.24, Version 0.10.8 (Stable)
* v8: update to 3.14.5.9
* uv: upgrade to 0.10.8
* npm: Upgrade to 1.2.23
* http: remove bodyHead from 'upgrade' events (Nathan Zadoks)
* http: Return true on empty writes, not false (isaacs)
* http: save roundtrips, convert buffers to strings (Ben Noordhuis)
* configure: respect the --dest-os flag consistently (Nathan Rajlich)
* buffer: throw when writing beyond buffer (Trevor Norris)
* crypto: Clear error after DiffieHellman key errors (isaacs)
* string_bytes: strip padding from base64 strings (Trevor Norris)
2013.05.17, Version 0.10.7 (Stable), d2fdae197ac542f686ee06835d1153dd43b862e5
* uv: upgrade to v0.10.7
......
......@@ -5,6 +5,7 @@ Evented I/O for V8 javascript. [![Build Status](https://secure.travis-ci.org/joy
Prerequisites (Unix only):
* GCC 4.2 or newer
* Python 2.6 or 2.7
* GNU Make 3.81 or newer
* libexecinfo (FreeBSD and OpenBSD only)
......
// Measure the time it takes for the HTTP client to send a request body.
var common = require('../common.js');
var http = require('http');
var bench = common.createBenchmark(main, {
dur: [5],
type: ['asc', 'utf', 'buf'],
bytes: [32, 256, 1024],
method: ['write', 'end '] // two spaces added to line up each row
});
function main(conf) {
var dur = +conf.dur;
var len = +conf.bytes;
var encoding;
var chunk;
switch (conf.type) {
case 'buf':
chunk = new Buffer(len);
chunk.fill('x');
break;
case 'utf':
encoding = 'utf8';
chunk = new Array(len / 2 + 1).join('ü');
break;
case 'asc':
chunk = new Array(len + 1).join('a');
break;
}
var nreqs = 0;
var options = {
headers: { 'Connection': 'keep-alive', 'Transfer-Encoding': 'chunked' },
agent: new http.Agent({ maxSockets: 1 }),
host: '127.0.0.1',
port: common.PORT,
path: '/',
method: 'POST'
};
var server = http.createServer(function(req, res) {
res.end();
});
server.listen(options.port, options.host, function() {
setTimeout(done, dur * 1000);
bench.start();
pummel();
});
function pummel() {
var req = http.request(options, function(res) {
nreqs++;
pummel(); // Line up next request.
res.resume();
});
if (conf.method === 'write') {
req.write(chunk, encoding);
req.end();
} else {
req.end(chunk, encoding);
}
}
function done() {
bench.end(nreqs);
}
}
......@@ -10,7 +10,8 @@ import sys
CC = os.environ.get('CC', 'cc')
root_dir = os.path.dirname(__file__)
sys.path.insert(0, os.path.join(root_dir, 'deps', 'v8', 'tools'))
sys.path.insert(0, os.path.join(root_dir, 'tools', 'gyp', 'pylib'))
from gyp.common import GetFlavor
# parse our options
parser = optparse.OptionParser()
......@@ -236,7 +237,7 @@ parser.add_option("--dest-os",
action="store",
dest="dest_os",
help="Operating system to build for. Valid values are: "
"win, mac, solaris, freebsd, linux")
"win, mac, solaris, freebsd, openbsd, linux")
parser.add_option("--no-ifaddrs",
action="store_true",
......@@ -468,16 +469,16 @@ def configure_node(o):
# By default, enable DTrace on SunOS systems. Don't allow it on other
# systems, since it won't work. (The MacOS build process is different than
# SunOS, and we haven't implemented it.)
if sys.platform.startswith('sunos') or sys.platform.startswith('darwin'):
if flavor in ('solaris', 'mac'):
o['variables']['node_use_dtrace'] = b(not options.without_dtrace)
elif sys.platform.startswith('linux'):
elif flavor == 'linux':
o['variables']['node_use_dtrace'] = 'false'
o['variables']['node_use_systemtap'] = b(options.with_dtrace)
if options.systemtap_includes:
o['include_dirs'] += [options.systemtap_includes]
elif options.with_dtrace:
raise Exception(
'DTrace is currently only supported on SunOS or Linux systems.')
'DTrace is currently only supported on SunOS, MacOS or Linux systems.')
else:
o['variables']['node_use_dtrace'] = 'false'
o['variables']['node_use_systemtap'] = 'false'
......@@ -486,7 +487,7 @@ def configure_node(o):
o['defines'] += ['SUNOS_NO_IFADDRS']
# By default, enable ETW on Windows.
if sys.platform.startswith('win32'):
if flavor == 'win':
o['variables']['node_use_etw'] = b(not options.without_etw);
elif options.with_etw:
raise Exception('ETW is only supported on Windows.')
......@@ -494,7 +495,7 @@ def configure_node(o):
o['variables']['node_use_etw'] = 'false'
# By default, enable Performance counters on Windows.
if sys.platform.startswith('win32'):
if flavor == 'win':
o['variables']['node_use_perfctr'] = b(not options.without_perfctr);
elif options.with_perfctr:
raise Exception('Performance counter is only supported on Windows.')
......@@ -607,7 +608,7 @@ def configure_openssl(o):
def configure_winsdk(o):
if not sys.platform.startswith('win32'):
if flavor != 'win':
return
winsdk_dir = os.environ.get("WindowsSdkDir")
......@@ -620,6 +621,13 @@ def configure_winsdk(o):
print "ctrpp not found in WinSDK path--using pre-gen files from tools/msvs/genfiles."
# determine the "flavor" (operating system) we're building for,
# leveraging gyp's GetFlavor function
flavor_params = {};
if (options.dest_os):
flavor_params['flavor'] = options.dest_os;
flavor = GetFlavor(flavor_params);
output = {
'variables': { 'python': sys.executable },
'include_dirs': [],
......@@ -668,14 +676,12 @@ write('config.mk',
'# Do not edit. Generated by the configure script.\n' + config)
if options.use_ninja:
gyp_args = ['-f', 'ninja']
gyp_args = ['-f', 'ninja-' + flavor]
elif options.use_xcode:
gyp_args = ['-f', 'xcode']
elif os.name == 'nt':
elif flavor == 'win':
gyp_args = ['-f', 'msvs', '-G', 'msvs_version=auto']
elif options.dest_os:
gyp_args = ['-f', 'make-' + options.dest_os]
else:
gyp_args = ['-f', 'make']
gyp_args = ['-f', 'make-' + flavor]
subprocess.call([sys.executable, 'tools/gyp_node'] + gyp_args)
2013.05.15, Version 0.10.7 (Stable)
2013.05.25, Version 0.10.8 (Stable)
Changes since version 0.10.7:
* windows: make uv_spawn not fail under job control (Bert Belder)
* darwin: assume CFRunLoopStop() isn't thread-safe (Fedor Indutny)
* win: fix UV_EALREADY incorrectly set (Bert Belder)
* darwin: make two uv__cf_*() functions static (Ben Noordhuis)
* darwin: task_info() cannot fail (Ben Noordhuis)
* unix: add mapping for ENETDOWN (Ben Noordhuis)
* unix: implicitly signal write errors to libuv user (Ben Noordhuis)
* unix: fix assert on signal pipe overflow (Bert Belder)
* unix: turn off POLLOUT after stream connect (Ben Noordhuis)
2013.05.15, Version 0.10.7 (Stable), 028baaf0846b686a81e992cb2f2f5a9b8e841fcf
Changes since version 0.10.6:
......
......@@ -38,8 +38,8 @@
#include <unistd.h> /* sysconf */
/* Forward declarations */
void uv__cf_loop_runner(void* arg);
void uv__cf_loop_cb(void* arg);
static void uv__cf_loop_runner(void* arg);
static void uv__cf_loop_cb(void* arg);
typedef struct uv__cf_loop_signal_s uv__cf_loop_signal_t;
struct uv__cf_loop_signal_s {
......@@ -84,9 +84,8 @@ void uv__platform_loop_delete(uv_loop_t* loop) {
uv__cf_loop_signal_t* s;
assert(loop->cf_loop != NULL);
CFRunLoopStop(loop->cf_loop);
uv__cf_loop_signal(loop, NULL, NULL);
uv_thread_join(&loop->cf_thread);
loop->cf_loop = NULL;
uv_sem_destroy(&loop->cf_sem);
uv_mutex_destroy(&loop->cf_mutex);
......@@ -103,7 +102,7 @@ void uv__platform_loop_delete(uv_loop_t* loop) {
}
void uv__cf_loop_runner(void* arg) {
static void uv__cf_loop_runner(void* arg) {
uv_loop_t* loop;
loop = arg;
......@@ -125,7 +124,7 @@ void uv__cf_loop_runner(void* arg) {
}
void uv__cf_loop_cb(void* arg) {
static void uv__cf_loop_cb(void* arg) {
uv_loop_t* loop;
ngx_queue_t* item;
ngx_queue_t split_head;
......@@ -145,7 +144,12 @@ void uv__cf_loop_cb(void* arg) {
item = ngx_queue_head(&split_head);
s = ngx_queue_data(item, uv__cf_loop_signal_t, member);
s->cb(s->arg);
/* This was a termination signal */
if (s->cb == NULL)
CFRunLoopStop(loop->cf_loop);
else
s->cb(s->arg);
ngx_queue_remove(item);
free(s);
......@@ -253,19 +257,21 @@ void uv_loadavg(double avg[3]) {
uv_err_t uv_resident_set_memory(size_t* rss) {
struct task_basic_info t_info;
mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT;
int r = task_info(mach_task_self(),
TASK_BASIC_INFO,
(task_info_t)&t_info,
&t_info_count);
if (r != KERN_SUCCESS) {
return uv__new_sys_error(errno);
}
*rss = t_info.resident_size;
mach_msg_type_number_t count;
task_basic_info_data_t info;
kern_return_t err;
count = TASK_BASIC_INFO_COUNT;
err = task_info(mach_task_self(),
TASK_BASIC_INFO,
(task_info_t) &info,
&count);
(void) &err;
/* task_info(TASK_BASIC_INFO) cannot really fail. Anything other than
* KERN_SUCCESS implies a libuv bug.
*/
assert(err == KERN_SUCCESS);
*rss = info.resident_size;
return uv_ok_;
}
......
......@@ -79,6 +79,7 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case EMSGSIZE: return UV_EMSGSIZE;
case ENAMETOOLONG: return UV_ENAMETOOLONG;
case EINVAL: return UV_EINVAL;
case ENETDOWN: return UV_ENETDOWN;
case ENETUNREACH: return UV_ENETUNREACH;
case ECONNABORTED: return UV_ECONNABORTED;
case ELOOP: return UV_ELOOP;
......
......@@ -160,7 +160,7 @@ static void uv__signal_handler(int signum) {
} while (r == -1 && errno == EINTR);
assert(r == sizeof msg ||
(r == -1 && errno != EAGAIN && errno != EWOULDBLOCK));
(r == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)));
if (r != -1)
handle->caught_signals++;
......
......@@ -60,6 +60,7 @@ static void uv__stream_connect(uv_stream_t*);
static void uv__write(uv_stream_t* stream);
static void uv__read(uv_stream_t* stream);
static void uv__stream_io(uv_loop_t* loop, uv__io_t* w, unsigned int events);
static size_t uv__write_req_size(uv_write_t* req);
/* Used by the accept() EMFILE party trick. */
......@@ -399,6 +400,7 @@ void uv__stream_destroy(uv_stream_t* stream) {
if (req->bufs != req->bufsml)
free(req->bufs);
req->bufs = NULL;
if (req->cb) {
uv__set_artificial_error(req->handle->loop, UV_ECANCELED);
......@@ -413,6 +415,13 @@ void uv__stream_destroy(uv_stream_t* stream) {
req = ngx_queue_data(q, uv_write_t, queue);
uv__req_unregister(stream->loop, req);
if (req->bufs != NULL) {
stream->write_queue_size -= uv__write_req_size(req);
if (req->bufs != req->bufsml)
free(req->bufs);
req->bufs = NULL;
}
if (req->cb) {
uv__set_sys_error(stream->loop, req->error);
req->cb(req, req->error ? -1 : 0);
......@@ -652,6 +661,7 @@ static void uv__drain(uv_stream_t* stream) {
static size_t uv__write_req_size(uv_write_t* req) {
size_t size;
assert(req->bufs != NULL);
size = uv__buf_count(req->bufs + req->write_index,
req->bufcnt - req->write_index);
assert(req->handle->write_queue_size >= size);
......@@ -665,10 +675,18 @@ static void uv__write_req_finish(uv_write_t* req) {
/* Pop the req off tcp->write_queue. */
ngx_queue_remove(&req->queue);
if (req->bufs != req->bufsml) {
free(req->bufs);
/* Only free when there was no error. On error, we touch up write_queue_size
* right before making the callback. The reason we don't do that right away
* is that a write_queue_size > 0 is our only way to signal to the user that
* he should stop writing - which he should if we got an error. Something to
* revisit in future revisions of the libuv API.
*/
if (req->error == 0) {
if (req->bufs != req->bufsml)
free(req->bufs);
req->bufs = NULL;
}
req->bufs = NULL;
/* Add it to the write_completed_queue where it will have its
* callback called in the near future.
......@@ -778,7 +796,6 @@ start:
if (errno != EAGAIN && errno != EWOULDBLOCK) {
/* Error */
req->error = errno;
stream->write_queue_size -= uv__write_req_size(req);
uv__write_req_finish(req);
return;
} else if (stream->flags & UV_STREAM_BLOCKING) {
......@@ -855,6 +872,13 @@ static void uv__write_callbacks(uv_stream_t* stream) {
ngx_queue_remove(q);
uv__req_unregister(stream->loop, req);
if (req->bufs != NULL) {
stream->write_queue_size -= uv__write_req_size(req);
if (req->bufs != req->bufsml)
free(req->bufs);
req->bufs = NULL;
}
/* NOTE: call callback AFTER freeing the request data. */
if (req->cb) {
uv__set_sys_error(stream->loop, req->error);
......@@ -1136,6 +1160,7 @@ static void uv__stream_connect(uv_stream_t* stream) {
stream->connect_req = NULL;
uv__req_unregister(stream->loop, req);
uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLOUT);
if (req->cb) {
uv__set_sys_error(stream->loop, error);
......@@ -1283,6 +1308,16 @@ int uv_read2_start(uv_stream_t* stream, uv_alloc_cb alloc_cb,
int uv_read_stop(uv_stream_t* stream) {
/* Sanity check. We're going to stop the handle unless it's primed for
* writing but that means there should be some kind of write action in
* progress.
*/
assert(!uv__io_active(&stream->io_watcher, UV__POLLOUT) ||
!ngx_queue_empty(&stream->write_completed_queue) ||
!ngx_queue_empty(&stream->write_queue) ||
stream->shutdown_req != NULL ||
stream->connect_req != NULL);
uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLIN);
uv__handle_stop(stream);
stream->flags &= ~UV_STREAM_READING;
......
......@@ -34,7 +34,7 @@
#define UV_VERSION_MAJOR 0
#define UV_VERSION_MINOR 10
#define UV_VERSION_PATCH 7
#define UV_VERSION_PATCH 8
#define UV_VERSION_IS_RELEASE 1
......
......@@ -49,7 +49,22 @@ static HANDLE uv_global_job_handle_;
static uv_once_t uv_global_job_handle_init_guard_ = UV_ONCE_INIT;
static void uv__init_global_job_handle() {
static void uv__init_global_job_handle(void) {
/* Create a job object and set it up to kill all contained processes when
* it's closed. Since this handle is made non-inheritable and we're not
* giving it to anyone, we're the only process holding a reference to it.
* That means that if this process exits it is closed and all the processes
* it contains are killed. All processes created with uv_spawn that are not
* spawned with the UV_PROCESS_DETACHED flag are assigned to this job.
*
* We're setting the JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK flag so only the
* processes that we explicitly add are affected, and *their* subprocesses
* are not. This ensures that our child processes are not limited in their
* ability to use job control on Windows versions that don't deal with
* nested jobs (prior to Windows 8 / Server 2012). It also lets our child
* processes created detached processes without explicitly breaking away
* from job control (which uv_spawn doesn't, either).
*/
SECURITY_ATTRIBUTES attr;
JOBOBJECT_EXTENDED_LIMIT_INFORMATION info;
......@@ -920,7 +935,18 @@ int uv_spawn(uv_loop_t* loop, uv_process_t* process,
}
process_flags = CREATE_UNICODE_ENVIRONMENT;
if (options.flags & UV_PROCESS_DETACHED) {
/* Note that we're not setting the CREATE_BREAKAWAY_FROM_JOB flag. That
* means that libuv might not let you create a fully deamonized process
* when run under job control. However the type of job control that libuv
* itself creates doesn't trickle down to subprocesses so they can still
* daemonize.
*
* A reason to not do this is that CREATE_BREAKAWAY_FROM_JOB makes the
* CreateProcess call fail if we're under job control that doesn't allow
* breakaway.
*/
process_flags |= DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP;
}
......@@ -943,8 +969,21 @@ int uv_spawn(uv_loop_t* loop, uv_process_t* process,
if (!(options.flags & UV_PROCESS_DETACHED)) {
uv_once(&uv_global_job_handle_init_guard_, uv__init_global_job_handle);
if (!AssignProcessToJobObject(uv_global_job_handle_, info.hProcess))
uv_fatal_error(GetLastError(), "AssignProcessToJobObject");
if (!AssignProcessToJobObject(uv_global_job_handle_, info.hProcess)) {
/* AssignProcessToJobObject might fail if this process is under job
* control and the job doesn't have the
* JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK flag set, on a Windows version
* that doesn't support nested jobs.
*
* When that happens we just swallow the error and continue without
* establishing a kill-child-on-parent-exit relationship, otherwise
* there would be no way for libuv applications run under job control
* to spawn processes at all.
*/
DWORD err = GetLastError();
if (err != ERROR_ACCESS_DENIED)
uv_fatal_error(err, "AssignProcessToJobObject");
}
}
/* Set IPC pid to all IPC pipes. */
......
......@@ -56,7 +56,7 @@ int uv_accept(uv_stream_t* server, uv_stream_t* client) {
int uv_read_start(uv_stream_t* handle, uv_alloc_cb alloc_cb,
uv_read_cb read_cb) {
if (handle->flags & UV_HANDLE_READING) {
uv__set_sys_error(handle->loop, UV_EALREADY);
uv__set_artificial_error(handle->loop, UV_EALREADY);
return -1;
}
......@@ -82,7 +82,7 @@ int uv_read_start(uv_stream_t* handle, uv_alloc_cb alloc_cb,
int uv_read2_start(uv_stream_t* handle, uv_alloc_cb alloc_cb,
uv_read2_cb read_cb) {
if (handle->flags & UV_HANDLE_READING) {
uv__set_sys_error(handle->loop, UV_EALREADY);
uv__set_artificial_error(handle->loop, UV_EALREADY);
return -1;
}
......
......@@ -449,6 +449,8 @@ DEFINE_int(sim_stack_alignment, 8,
"Stack alingment in bytes in simulator (4 or 8, 8 is default)")
// isolate.cc
DEFINE_bool(abort_on_uncaught_exception, false,
"abort program (dump core) when an uncaught exception is thrown")
DEFINE_bool(trace_exception, false,
"print stack trace when throwing exceptions")
DEFINE_bool(preallocate_message_memory, false,
......
......@@ -1080,6 +1080,7 @@ bool Isolate::IsErrorObject(Handle<Object> obj) {
return false;
}
static int fatal_exception_depth = 0;
void Isolate::DoThrow(Object* exception, MessageLocation* location) {
ASSERT(!has_pending_exception());
......@@ -1150,6 +1151,20 @@ void Isolate::DoThrow(Object* exception, MessageLocation* location) {
thread_local_top()->pending_message_start_pos_ = location->start_pos();
thread_local_top()->pending_message_end_pos_ = location->end_pos();
}
// If the abort-on-uncaught-exception flag is specified, abort on any
// exception not caught by JavaScript, even when an external handler is
// present. This flag is intended for use by JavaScript developers, so
// print a user-friendly stack trace (not an internal one).
if (fatal_exception_depth == 0 &&
FLAG_abort_on_uncaught_exception &&
(report_exception || can_be_caught_externally)) {
fatal_exception_depth++;
fprintf(stderr, "%s\n\nFROM\n",
*MessageHandler::GetLocalizedMessage(message_obj));
PrintCurrentStackTrace(stderr);
OS::Abort();
}
} else if (location != NULL && !location->script().is_null()) {
// We are bootstrapping and caught an error where the location is set
// and we have a script for the location.
......
......@@ -35,7 +35,7 @@
#define MAJOR_VERSION 3
#define MINOR_VERSION 14
#define BUILD_NUMBER 5
#define PATCH_LEVEL 8
#define PATCH_LEVEL 9
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
#define IS_CANDIDATE_VERSION 0
......
......@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title> Node.js v0.10.7 Manual &amp; Documentation</title>
<title> Node.js v0.10.8 Manual &amp; Documentation</title>
<link rel="stylesheet" href="assets/style.css">
<link rel="stylesheet" href="assets/sh.css">
<link rel="canonical" href="http://nodejs.org/api/_toc.html">
......@@ -31,7 +31,7 @@
<div id="column1" class="interior">
<header>
<h1>Node.js v0.10.7 Manual &amp; Documentation</h1>
<h1>Node.js v0.10.8 Manual &amp; Documentation</h1>
<div id="gtoc">
<p>
<a href="index.html" name="toc">Index</a> |
......@@ -105,7 +105,7 @@
<li><a href="http://twitter.com/nodejs" class="twitter">@nodejs</a></li>
</ul>
<p>Copyright <a href="http://joyent.com/">Joyent, Inc</a>, Node.js is a <a href="/trademark-policy.pdf">trademark</a> of Joyent, Inc. View <a href="https://raw.github.com/joyent/node/v0.10.7/LICENSE">license</a>.</p>
<p>Copyright <a href="http://joyent.com/">Joyent, Inc</a>, Node.js is a <a href="/trademark-policy.pdf">trademark</a> of Joyent, Inc. View <a href="https://raw.github.com/joyent/node/v0.10.8/LICENSE">license</a>.</p>
</div>
<script src="../sh_main.js"></script>
......
......@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>Addons Node.js v0.10.7 Manual &amp; Documentation</title>
<title>Addons Node.js v0.10.8 Manual &amp; Documentation</title>
<link rel="stylesheet" href="assets/style.css">
<link rel="stylesheet" href="assets/sh.css">
<link rel="canonical" href="http://nodejs.org/api/addons.html">
......@@ -31,7 +31,7 @@
<div id="column1" class="interior">
<header>
<h1>Node.js v0.10.7 Manual &amp; Documentation</h1>
<h1>Node.js v0.10.8 Manual &amp; Documentation</h1>
<div id="gtoc">
<p>
<a href="index.html" name="toc">Index</a> |
......@@ -715,7 +715,7 @@ console.log(result); // 30</code></pre>
<li><a href="http://twitter.com/nodejs" class="twitter">@nodejs</a></li>
</ul>
<p>Copyright <a href="http://joyent.com/">Joyent, Inc</a>, Node.js is a <a href="/trademark-policy.pdf">trademark</a> of Joyent, Inc. View <a href="https://raw.github.com/joyent/node/v0.10.7/LICENSE">license</a>.</p>
<p>Copyright <a href="http://joyent.com/">Joyent, Inc</a>, Node.js is a <a href="/trademark-policy.pdf">trademark</a> of Joyent, Inc. View <a href="https://raw.github.com/joyent/node/v0.10.8/LICENSE">license</a>.</p>
</div>
<script src="../sh_main.js"></script>
......
......@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>About this Documentation Node.js v0.10.7 Manual &amp; Documentation</title>
<title>About this Documentation Node.js v0.10.8 Manual &amp; Documentation</title>
<link rel="stylesheet" href="assets/style.css">
<link rel="stylesheet" href="assets/sh.css">
<link rel="canonical" href="http://nodejs.org/api/all.html">
......@@ -31,7 +31,7 @@
<div id="column1" class="interior">
<header>
<h1>Node.js v0.10.7 Manual &amp; Documentation</h1>
<h1>Node.js v0.10.8 Manual &amp; Documentation</h1>
<div id="gtoc">
<p>
<a href="index.html" name="toc">Index</a> |
......@@ -8666,7 +8666,7 @@ not be emitted.
</p>
<h3>Event: &#39;connect&#39;<span><a class="mark" href="#all_event_connect_1" id="all_event_connect_1">#</a></span></h3>
<p><code>function (request, socket, head) { }</code>
<p><code>function (request, socket) { }</code>
</p>
<p>Emitted each time a client requests a http CONNECT method. If this event isn&#39;t
......@@ -8678,8 +8678,6 @@ connections closed.
<li><code>request</code> is the arguments for the http request, as it is in the request
event.</li>
<li><code>socket</code> is the network socket between the server and client.</li>
<li><code>head</code> is an instance of Buffer, the first packet of the tunneling stream,
this may be empty.</li>
</ul>
<p>After this event is emitted, the request&#39;s socket will not have a <code>data</code>
event listener, meaning you will need to bind to it in order to handle data
......@@ -8687,7 +8685,7 @@ sent to the server on that socket.
</p>
<h3>Event: &#39;upgrade&#39;<span><a class="mark" href="#all_event_upgrade" id="all_event_upgrade">#</a></span></h3>
<p><code>function (request, socket, head) { }</code>
<p><code>function (request, socket) { }</code>
</p>
<p>Emitted each time a client requests a http upgrade. If this event isn&#39;t
......@@ -8699,8 +8697,6 @@ closed.
<li><code>request</code> is the arguments for the http request, as it is in the request
event.</li>
<li><code>socket</code> is the network socket between the server and client.</li>
<li><code>head</code> is an instance of Buffer, the first packet of the upgraded stream,
this may be empty.</li>
</ul>
<p>After this event is emitted, the request&#39;s socket will not have a <code>data</code>
event listener, meaning you will need to bind to it in order to handle data
......@@ -9225,7 +9221,7 @@ once. The <code>response</code> argument will be an instance of <code>http.Incom
</p>
<h3>Event: &#39;connect&#39;<span><a class="mark" href="#all_event_connect_2" id="all_event_connect_2">#</a></span></h3>
<p><code>function (response, socket, head) { }</code>
<p><code>function (response, socket) { }</code>
</p>
<p>Emitted each time a server responds to a request with a CONNECT method. If this
......@@ -9245,14 +9241,13 @@ var proxy = http.createServer(function (req, res) {
res.writeHead(200, {&#39;Content-Type&#39;: &#39;text/plain&#39;});
res.end(&#39;okay&#39;);
});
proxy.on(&#39;connect&#39;, function(req, cltSocket, head) {
proxy.on(&#39;connect&#39;, function(req, cltSocket) {
// connect to an origin server
var srvUrl = url.parse(&#39;http://&#39; + req.url);
var srvSocket = net.connect(srvUrl.port, srvUrl.hostname, function() {
cltSocket.write(&#39;HTTP/1.1 200 Connection Established\r\n&#39; +
&#39;Proxy-agent: Node-Proxy\r\n&#39; +
&#39;\r\n&#39;);
srvSocket.write(head);
srvSocket.pipe(cltSocket);