mirror of https://github.com/lukechilds/node.git
Browse Source
Helps in implementation of #6204, where some options passed to `createSecurePair()` are ignored before this patch. These options are very helpful if someone wants to pass `options.servername` or `options.SNICallback` to securepair. PR-URL: https://github.com/nodejs/node/pull/2441 Reviewed-By: Fedor Indutny <fedor@indutny.com>process-exit-stdio-flushing
Коренберг Марк
10 years ago
committed by
Fedor Indutny
4 changed files with 34 additions and 3 deletions
Binary file not shown.
@ -0,0 +1,27 @@ |
|||
'use strict'; |
|||
|
|||
const common = require('../common'); |
|||
const assert = require('assert'); |
|||
const fs = require('fs'); |
|||
const tls = require('tls'); |
|||
|
|||
const sslcontext = tls.createSecureContext({ |
|||
cert: fs.readFileSync(common.fixturesDir + '/test_cert.pem'), |
|||
key: fs.readFileSync(common.fixturesDir + '/test_key.pem') |
|||
}); |
|||
|
|||
var catchedServername; |
|||
const pair = tls.createSecurePair(sslcontext, true, false, false, { |
|||
SNICallback: common.mustCall(function(servername, cb) { |
|||
catchedServername = servername; |
|||
}) |
|||
}); |
|||
|
|||
// captured traffic from browser's request to https://www.google.com
|
|||
const sslHello = fs.readFileSync(common.fixturesDir + '/google_ssl_hello.bin'); |
|||
|
|||
pair.encrypted.write(sslHello); |
|||
|
|||
process.on('exit', function() { |
|||
assert.strictEqual('www.google.com', catchedServername); |
|||
}); |
Loading…
Reference in new issue