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 1
1
'use strict' ;
2
- const common = require ( '../common' ) ;
3
2
const assert = require ( 'assert' ) ;
4
3
5
4
const net = require ( 'net' ) ;
@@ -50,9 +49,10 @@ function makeHttp10Request(cb) {
50
49
'\r\n' ) ;
51
50
socket . resume ( ) ; // Ignore the response itself
52
51
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.
56
56
} ) ;
57
57
}
58
58
@@ -62,9 +62,7 @@ server.listen(0, function() {
62
62
// Both HTTP/1.1 requests should have used the same socket:
63
63
assert . strictEqual ( firstSocket , secondSocket ) ;
64
64
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 ( ) {
68
66
server . close ( ) ;
69
67
} ) ;
70
68
} ) ;
You can’t perform that action at this time.
0 commit comments