File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
2- const common = require ( '../common' ) ;
32const assert = require ( 'assert' ) ;
43
54const net = require ( 'net' ) ;
@@ -50,9 +49,10 @@ function makeHttp10Request(cb) {
5049 '\r\n' ) ;
5150 socket . resume ( ) ; // Ignore the response itself
5251
53- setTimeout ( function ( ) {
54- cb ( socket ) ;
55- } , common . platformTimeout ( 50 ) ) ;
52+ // Invoke the callback when the socket closes. The server should close it
53+ // immediately after sending the response.
54+ socket . on ( 'close' , cb ) ;
55+ // If the socket is not closed, the test will fail with a timeout.
5656 } ) ;
5757}
5858
@@ -62,9 +62,7 @@ server.listen(0, function() {
6262 // Both HTTP/1.1 requests should have used the same socket:
6363 assert . strictEqual ( firstSocket , secondSocket ) ;
6464
65- makeHttp10Request ( function ( socket ) {
66- // The server should have immediately closed the HTTP/1.0 socket:
67- assert . strictEqual ( socket . closed , true ) ;
65+ makeHttp10Request ( function ( ) {
6866 server . close ( ) ;
6967 } ) ;
7068 } ) ;
You can’t perform that action at this time.
0 commit comments