mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 23:16:30 +01:00
TLS sockets should not be writable after 'end'
Closes GH-694.
This commit is contained in:
parent
c72ae27be1
commit
c2a62951f6
@ -1282,7 +1282,8 @@ Agent.prototype._establishNewConnection = function() {
|
||||
// but outgoingFlush instead.
|
||||
if (!req.shouldKeepAlive) {
|
||||
debug('AGENT socket.end()');
|
||||
socket.end();
|
||||
if (socket.writable) socket.end();
|
||||
assert(!socket.writable);
|
||||
} else {
|
||||
debug('AGENT socket keep-alive');
|
||||
}
|
||||
|
@ -553,6 +553,9 @@ SecurePair.prototype._destroy = function() {
|
||||
this._ssl.close();
|
||||
this._ssl = null;
|
||||
|
||||
self.encrypted.writable = self.encrypted.readable = false;
|
||||
self.cleartext.writable = self.cleartext.readable = false;
|
||||
|
||||
process.nextTick(function() {
|
||||
self.encrypted.emit('end');
|
||||
if (self.encrypted.onend) self.encrypted.onend();
|
||||
|
31
test/disabled/test-https-loop-to-google.js
Normal file
31
test/disabled/test-https-loop-to-google.js
Normal file
@ -0,0 +1,31 @@
|
||||
// Failing test for https
|
||||
|
||||
// Will fail with "socket hang up" for 4 out of 10 requests
|
||||
// Tested on node 0.5.0-pre commit 9851574
|
||||
|
||||
|
||||
var https = require('https');
|
||||
|
||||
for(var i = 0; i < 10; ++i)
|
||||
{
|
||||
https.get(
|
||||
{
|
||||
host: 'www.google.com',
|
||||
path: '/accounts/o8/id',
|
||||
port: 443,
|
||||
}, function(res)
|
||||
{
|
||||
var data = '';
|
||||
res.on('data', function(chunk)
|
||||
{
|
||||
data += chunk;
|
||||
});
|
||||
res.on('end', function()
|
||||
{
|
||||
console.log(res.statusCode);
|
||||
});
|
||||
}).on('error', function(error)
|
||||
{
|
||||
console.log(error);
|
||||
});
|
||||
}
|
@ -52,8 +52,6 @@ var server = net.createServer(function(socket) {
|
||||
|
||||
socket.on('end', function() {
|
||||
log('socket end');
|
||||
pair.cleartext.write('goodbye\r\n');
|
||||
pair.cleartext.end();
|
||||
});
|
||||
|
||||
pair.cleartext.on('error', function(err) {
|
||||
|
Loading…
Reference in New Issue
Block a user