Browse Source

Merge remote branch 'origin/v0.6'

v0.7.4-release
Ben Noordhuis 13 years ago
parent
commit
bed405cfea
  1. 7
      deps/v8/tools/gyp/v8-node.gyp
  2. 7
      deps/v8/tools/gyp/v8.gyp
  3. 23
      doc/api/addons.markdown
  4. 5
      lib/tls.js
  5. 1
      src/node.h
  6. 2
      src/node_buffer.h
  7. 3
      src/node_object_wrap.h
  8. 61
      test/simple/test-tls-set-ciphers.js
  9. 2
      vcbuild.bat

7
deps/v8/tools/gyp/v8-node.gyp

@ -3,4 +3,11 @@
'../../build/common.gypi', '../../build/common.gypi',
'v8.gyp' 'v8.gyp'
], ],
'target_defaults': {
'conditions': [
[ 'OS=="solaris"', {
'defines': [ '__C99FEATURES__=1' ],
}],
],
},
} }

7
deps/v8/tools/gyp/v8.gyp

@ -641,6 +641,13 @@
], ],
} }
], ],
['OS=="solaris"', {
'sources': [
'../../src/platform-solaris.cc',
'../../src/platform-posix.cc'
],
}
],
['OS=="mac"', { ['OS=="mac"', {
'sources': [ 'sources': [
'../../src/platform-macos.cc', '../../src/platform-macos.cc',

23
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 compiling your module, you don't need to worry about linking to any of these
libraries. libraries.
To get started let's make a small Addon which does the following except in To get started let's make a small Addon which is the C++ equivalent of
C++: the following Javascript code:
exports.hello = function() { return 'world'; }; exports.hello = function() { return 'world'; };
@ -40,11 +40,18 @@ To get started we create a file `hello.cc`:
} }
void init(Handle<Object> target) { void init(Handle<Object> target) {
NODE_SET_METHOD(target, "method", Method); NODE_SET_METHOD(target, "hello", Method);
} }
NODE_MODULE(hello, init) 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<Object> 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 do this we create a file called `wscript` which is python code and looks
like this: 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 `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. 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<Object> target); var addon = require('./build/Release/hello');
NODE_MODULE(hello, Initialize)
console.log(addon.hello()); // 'world'
For the moment, that is all the documentation on addons. Please see For the moment, that is all the documentation on addons. Please see
<https://github.com/ry/node_postgres> for a real example. <https://github.com/ry/node_postgres> for a real example.

5
lib/tls.js

@ -849,15 +849,13 @@ function Server(/* [options], listener */) {
passphrase: self.passphrase, passphrase: self.passphrase,
cert: self.cert, cert: self.cert,
ca: self.ca, ca: self.ca,
ciphers: self.ciphers, ciphers: self.ciphers || 'RC4-SHA:AES128-SHA:AES256-SHA',
secureProtocol: self.secureProtocol, secureProtocol: self.secureProtocol,
secureOptions: self.secureOptions, secureOptions: self.secureOptions,
crl: self.crl, crl: self.crl,
sessionIdContext: self.sessionIdContext sessionIdContext: self.sessionIdContext
}); });
sharedCreds.context.setCiphers('RC4-SHA:AES128-SHA:AES256-SHA');
// constructor call // constructor call
net.Server.call(this, function(socket) { net.Server.call(this, function(socket) {
var creds = crypto.createCredentials(null, sharedCreds.context); var creds = crypto.createCredentials(null, sharedCreds.context);
@ -1017,7 +1015,6 @@ exports.connect = function(port /* host, options, cb */) {
var socket = new net.Stream(); var socket = new net.Stream();
var sslcontext = crypto.createCredentials(options); var sslcontext = crypto.createCredentials(options);
//sslcontext.context.setCiphers('RC4-SHA:AES128-SHA:AES256-SHA');
convertNPNProtocols(options.NPNProtocols, this); convertNPNProtocols(options.NPNProtocols, this);
var pair = new SecurePair(sslcontext, false, true, false, var pair = new SecurePair(sslcontext, false, true, false,

1
src/node.h

@ -62,6 +62,7 @@
#include <v8.h> #include <v8.h>
#include <sys/types.h> /* struct stat */ #include <sys/types.h> /* struct stat */
#include <sys/stat.h> #include <sys/stat.h>
#include <assert.h>
#include <node_object_wrap.h> #include <node_object_wrap.h>

2
src/node_buffer.h

@ -63,7 +63,7 @@ namespace node {
*/ */
class Buffer : public ObjectWrap { class NODE_EXTERN Buffer: public ObjectWrap {
public: public:
static bool HasInstance(v8::Handle<v8::Value> val); static bool HasInstance(v8::Handle<v8::Value> val);

3
src/node_object_wrap.h

@ -22,12 +22,13 @@
#ifndef object_wrap_h #ifndef object_wrap_h
#define object_wrap_h #define object_wrap_h
#include <node.h>
#include <v8.h> #include <v8.h>
#include <assert.h> #include <assert.h>
namespace node { namespace node {
class ObjectWrap { class NODE_EXTERN ObjectWrap {
public: public:
ObjectWrap ( ) { ObjectWrap ( ) {
refs_ = 0; refs_ = 0;

61
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();
});
});

2
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"=="test" set test=test&goto arg-ok
if /i "%1"=="msi" set msi=1&goto arg-ok if /i "%1"=="msi" set msi=1&goto arg-ok
if /i "%1"=="upload" set upload=1&goto arg-ok if /i "%1"=="upload" set upload=1&goto arg-ok
:arg-ok :arg-ok
shift shift
goto next-arg goto next-arg

Loading…
Cancel
Save