diff --git a/deps/v8/tools/gyp/v8-node.gyp b/deps/v8/tools/gyp/v8-node.gyp index 3b067a5f560..f2b3a337bd8 100644 --- a/deps/v8/tools/gyp/v8-node.gyp +++ b/deps/v8/tools/gyp/v8-node.gyp @@ -3,4 +3,11 @@ '../../build/common.gypi', 'v8.gyp' ], + 'target_defaults': { + 'conditions': [ + [ 'OS=="solaris"', { + 'defines': [ '__C99FEATURES__=1' ], + }], + ], + }, } diff --git a/deps/v8/tools/gyp/v8.gyp b/deps/v8/tools/gyp/v8.gyp index 50144172a04..92d1e5c96a6 100644 --- a/deps/v8/tools/gyp/v8.gyp +++ b/deps/v8/tools/gyp/v8.gyp @@ -641,6 +641,13 @@ ], } ], + ['OS=="solaris"', { + 'sources': [ + '../../src/platform-solaris.cc', + '../../src/platform-posix.cc' + ], + } + ], ['OS=="mac"', { 'sources': [ '../../src/platform-macos.cc', diff --git a/doc/api/addons.markdown b/doc/api/addons.markdown index 3234e7a6082..3e815d4d44e 100644 --- a/doc/api/addons.markdown +++ b/doc/api/addons.markdown @@ -22,8 +22,8 @@ Node statically compiles all its dependencies into the executable. When compiling your module, you don't need to worry about linking to any of these libraries. -To get started let's make a small Addon which does the following except in -C++: +To get started let's make a small Addon which is the C++ equivalent of +the following Javascript code: exports.hello = function() { return 'world'; }; @@ -40,11 +40,18 @@ To get started we create a file `hello.cc`: } void init(Handle target) { - NODE_SET_METHOD(target, "method", Method); + NODE_SET_METHOD(target, "hello", Method); } NODE_MODULE(hello, init) -This source code needs to be built into `hello.node`, the binary Addon. To +Note that all Node addons must export an initialization function: + + void Initialize (Handle target); + NODE_MODULE(module_name, Initialize) + +There is no semi-colon after `NODE_MODULE` as it's not a function (see `node.h`). + +The source code needs to be built into `hello.node`, the binary Addon. To do this we create a file called `wscript` which is python code and looks like this: @@ -70,10 +77,12 @@ Running `node-waf configure build` will create a file `node-waf` is just [WAF](http://code.google.com/p/waf), the python-based build system. `node-waf` is provided for the ease of users. -All Node addons must export an initialization function: +You can now use the binary addon in a Node project `hello.js` by pointing `require` to +the recently built module: - void Initialize (Handle target); - NODE_MODULE(hello, Initialize) + var addon = require('./build/Release/hello'); + + console.log(addon.hello()); // 'world' For the moment, that is all the documentation on addons. Please see for a real example. diff --git a/lib/tls.js b/lib/tls.js index 21bb2af0721..8f83ecf9865 100644 --- a/lib/tls.js +++ b/lib/tls.js @@ -849,15 +849,13 @@ function Server(/* [options], listener */) { passphrase: self.passphrase, cert: self.cert, ca: self.ca, - ciphers: self.ciphers, + ciphers: self.ciphers || 'RC4-SHA:AES128-SHA:AES256-SHA', secureProtocol: self.secureProtocol, secureOptions: self.secureOptions, crl: self.crl, sessionIdContext: self.sessionIdContext }); - sharedCreds.context.setCiphers('RC4-SHA:AES128-SHA:AES256-SHA'); - // constructor call net.Server.call(this, function(socket) { var creds = crypto.createCredentials(null, sharedCreds.context); @@ -1017,7 +1015,6 @@ exports.connect = function(port /* host, options, cb */) { var socket = new net.Stream(); var sslcontext = crypto.createCredentials(options); - //sslcontext.context.setCiphers('RC4-SHA:AES128-SHA:AES256-SHA'); convertNPNProtocols(options.NPNProtocols, this); var pair = new SecurePair(sslcontext, false, true, false, diff --git a/src/node.h b/src/node.h index 1d322370d19..cb58a220bbe 100644 --- a/src/node.h +++ b/src/node.h @@ -62,6 +62,7 @@ #include #include /* struct stat */ #include +#include #include diff --git a/src/node_buffer.h b/src/node_buffer.h index 2a93a1db679..ea3311245c6 100644 --- a/src/node_buffer.h +++ b/src/node_buffer.h @@ -63,7 +63,7 @@ namespace node { */ -class Buffer : public ObjectWrap { +class NODE_EXTERN Buffer: public ObjectWrap { public: static bool HasInstance(v8::Handle val); diff --git a/src/node_object_wrap.h b/src/node_object_wrap.h index 016d59578fb..0ead639b645 100644 --- a/src/node_object_wrap.h +++ b/src/node_object_wrap.h @@ -22,12 +22,13 @@ #ifndef object_wrap_h #define object_wrap_h +#include #include #include namespace node { -class ObjectWrap { +class NODE_EXTERN ObjectWrap { public: ObjectWrap ( ) { refs_ = 0; diff --git a/test/simple/test-tls-set-ciphers.js b/test/simple/test-tls-set-ciphers.js new file mode 100644 index 00000000000..ba5c868d12c --- /dev/null +++ b/test/simple/test-tls-set-ciphers.js @@ -0,0 +1,61 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +var common = require('../common'); +var assert = require('assert'); +var exec = require('child_process').exec; +var tls = require('tls'); +var fs = require('fs'); + +if (process.platform === 'win32') { + console.log("Skipping test, you probably don't have openssl installed."); + process.exit(); +} + +var options = { + key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'), + cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem'), + ciphers: 'NULL-MD5' // it's ultra-fast! +}; + +var reply = 'I AM THE WALRUS'; // something recognizable +var nconns = 0; +var response = ''; + +process.on('exit', function() { + assert.equal(nconns, 1); + assert.notEqual(response.indexOf(reply), -1); +}); + +var server = tls.createServer(options, function(conn) { + conn.end(reply); + nconns++; +}); + +server.listen(common.PORT, '127.0.0.1', function() { + var cmd = 'openssl s_client -cipher NULL-MD5 -connect 127.0.0.1:' + common.PORT; + + exec(cmd, function(err, stdout, stderr) { + if (err) throw err; + response = stdout; + server.close(); + }); +}); diff --git a/vcbuild.bat b/vcbuild.bat index 4e092b2ce54..709d71ce7c3 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -37,6 +37,8 @@ if /i "%1"=="test-all" set test=test-all&goto arg-ok if /i "%1"=="test" set test=test&goto arg-ok if /i "%1"=="msi" set msi=1&goto arg-ok if /i "%1"=="upload" set upload=1&goto arg-ok + + :arg-ok shift goto next-arg