if (read <= 0)
break;
+ char* current = out;
while (read > 0) {
int avail = read;
OnAlloc(avail, &buf);
if (static_cast<int>(buf.len) < avail)
avail = buf.len;
- memcpy(buf.base, out, avail);
+ memcpy(buf.base, current, avail);
OnRead(avail, &buf);
read -= avail;
+ current += avail;
}
}
var options, a, b, portA, portB;
var gotHello = false;
+var body = new Buffer(4000).fill('A');
+
options = {
key: fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem')),
cert: fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem'))
// the "target" server
b = tls.createServer(options, function(socket) {
- socket.end('hello');
+ socket.end(body);
});
process.on('exit', function() {
rejectUnauthorized: false
});
ssl.setEncoding('utf8');
+ var buf = '';
ssl.once('data', function(data) {
- assert.equal('hello', data);
+ buf += data;
gotHello = true;
});
ssl.on('end', function() {
+ assert.equal(buf, body);
ssl.end();
a.close();
b.close();