File tree 1 file changed +6
-7
lines changed
1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
- const common = require ( '../common' ) ;
2
+ require ( '../common' ) ;
3
3
const assert = require ( 'assert' ) ;
4
4
5
5
const net = require ( 'net' ) ;
@@ -50,9 +50,10 @@ function makeHttp10Request(cb) {
50
50
'\r\n' ) ;
51
51
socket . resume ( ) ; // Ignore the response itself
52
52
53
- setTimeout ( function ( ) {
54
- cb ( socket ) ;
55
- } , common . platformTimeout ( 50 ) ) ;
53
+ // Invoke the callback when the socket closes. The server should close it
54
+ // immediately after sending the response.
55
+ socket . on ( 'close' , cb ) ;
56
+ // If the socket is not closed, the test will fail with a timeout.
56
57
} ) ;
57
58
}
58
59
@@ -62,9 +63,7 @@ server.listen(0, function() {
62
63
// Both HTTP/1.1 requests should have used the same socket:
63
64
assert . strictEqual ( firstSocket , secondSocket ) ;
64
65
65
- makeHttp10Request ( function ( socket ) {
66
- // The server should have immediately closed the HTTP/1.0 socket:
67
- assert . strictEqual ( socket . closed , true ) ;
66
+ makeHttp10Request ( function ( ) {
68
67
server . close ( ) ;
69
68
} ) ;
70
69
} ) ;
You can’t perform that action at this time.
0 commit comments