File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1282,7 +1282,8 @@ Agent.prototype._establishNewConnection = function() {
12821282 // but outgoingFlush instead.
12831283 if ( ! req . shouldKeepAlive ) {
12841284 debug ( 'AGENT socket.end()' ) ;
1285- socket . end ( ) ;
1285+ if ( socket . writable ) socket . end ( ) ;
1286+ assert ( ! socket . writable ) ;
12861287 } else {
12871288 debug ( 'AGENT socket keep-alive' ) ;
12881289 }
Original file line number Diff line number Diff line change @@ -553,6 +553,9 @@ SecurePair.prototype._destroy = function() {
553553 this . _ssl . close ( ) ;
554554 this . _ssl = null ;
555555
556+ self . encrypted . writable = self . encrypted . readable = false ;
557+ self . cleartext . writable = self . cleartext . readable = false ;
558+
556559 process . nextTick ( function ( ) {
557560 self . encrypted . emit ( 'end' ) ;
558561 if ( self . encrypted . onend ) self . encrypted . onend ( ) ;
Original file line number Diff line number Diff line change 1+ // Failing test for https
2+
3+ // Will fail with "socket hang up" for 4 out of 10 requests
4+ // Tested on node 0.5.0-pre commit 9851574
5+
6+
7+ var https = require ( 'https' ) ;
8+
9+ for ( var i = 0 ; i < 10 ; ++ i )
10+ {
11+ https . get (
12+ {
13+ host : 'www.google.com' ,
14+ path : '/accounts/o8/id' ,
15+ port : 443 ,
16+ } , function ( res )
17+ {
18+ var data = '' ;
19+ res . on ( 'data' , function ( chunk )
20+ {
21+ data += chunk ;
22+ } ) ;
23+ res . on ( 'end' , function ( )
24+ {
25+ console . log ( res . statusCode ) ;
26+ } ) ;
27+ } ) . on ( 'error' , function ( error )
28+ {
29+ console . log ( error ) ;
30+ } ) ;
31+ }
Original file line number Diff line number Diff line change @@ -52,8 +52,6 @@ var server = net.createServer(function(socket) {
5252
5353 socket . on ( 'end' , function ( ) {
5454 log ( 'socket end' ) ;
55- pair . cleartext . write ( 'goodbye\r\n' ) ;
56- pair . cleartext . end ( ) ;
5755 } ) ;
5856
5957 pair . cleartext . on ( 'error' , function ( err ) {
You can’t perform that action at this time.
0 commit comments