1
1
'use strict' ;
2
- var common = require ( '../common' ) ;
2
+ const common = require ( '../common' ) ;
3
3
4
4
if ( ! process . features . tls_ocsp ) {
5
5
common . skip ( 'node compiled without OpenSSL or ' +
@@ -15,33 +15,33 @@ if (!common.hasCrypto) {
15
15
common . skip ( 'missing crypto' ) ;
16
16
return ;
17
17
}
18
- var tls = require ( 'tls' ) ;
18
+ const tls = require ( 'tls' ) ;
19
19
20
- var assert = require ( 'assert' ) ;
21
- var fs = require ( 'fs' ) ;
22
- var join = require ( 'path' ) . join ;
20
+ const assert = require ( 'assert' ) ;
21
+ const fs = require ( 'fs' ) ;
22
+ const join = require ( 'path' ) . join ;
23
23
24
24
const SSL_OP_NO_TICKET = require ( 'crypto' ) . constants . SSL_OP_NO_TICKET ;
25
25
26
- var pfx = fs . readFileSync ( join ( common . fixturesDir , 'keys' , 'agent1-pfx.pem' ) ) ;
26
+ const pfx = fs . readFileSync ( join ( common . fixturesDir , 'keys' , 'agent1-pfx.pem' ) ) ;
27
27
28
28
function test ( testOptions , cb ) {
29
29
30
- var keyFile = join ( common . fixturesDir , 'keys' , 'agent1-key.pem' ) ;
31
- var certFile = join ( common . fixturesDir , 'keys' , 'agent1-cert.pem' ) ;
32
- var caFile = join ( common . fixturesDir , 'keys' , 'ca1-cert.pem' ) ;
33
- var key = fs . readFileSync ( keyFile ) ;
34
- var cert = fs . readFileSync ( certFile ) ;
35
- var ca = fs . readFileSync ( caFile ) ;
36
- var options = {
30
+ const keyFile = join ( common . fixturesDir , 'keys' , 'agent1-key.pem' ) ;
31
+ const certFile = join ( common . fixturesDir , 'keys' , 'agent1-cert.pem' ) ;
32
+ const caFile = join ( common . fixturesDir , 'keys' , 'ca1-cert.pem' ) ;
33
+ const key = fs . readFileSync ( keyFile ) ;
34
+ const cert = fs . readFileSync ( certFile ) ;
35
+ const ca = fs . readFileSync ( caFile ) ;
36
+ const options = {
37
37
key : key ,
38
38
cert : cert ,
39
39
ca : [ ca ]
40
40
} ;
41
- var requestCount = 0 ;
42
- var clientSecure = 0 ;
43
- var ocspCount = 0 ;
44
- var ocspResponse ;
41
+ let requestCount = 0 ;
42
+ let clientSecure = 0 ;
43
+ let ocspCount = 0 ;
44
+ let ocspResponse ;
45
45
46
46
if ( testOptions . pfx ) {
47
47
delete options . key ;
@@ -50,7 +50,7 @@ function test(testOptions, cb) {
50
50
options . passphrase = testOptions . passphrase ;
51
51
}
52
52
53
- var server = tls . createServer ( options , function ( cleartext ) {
53
+ const server = tls . createServer ( options , function ( cleartext ) {
54
54
cleartext . on ( 'error' , function ( er ) {
55
55
// We're ok with getting ECONNRESET in this test, but it's
56
56
// timing-dependent, and thus unreliable. Any other errors
@@ -73,7 +73,7 @@ function test(testOptions, cb) {
73
73
} , 100 ) ;
74
74
} ) ;
75
75
server . listen ( 0 , function ( ) {
76
- var client = tls . connect ( {
76
+ const client = tls . connect ( {
77
77
port : this . address ( ) . port ,
78
78
requestOCSP : testOptions . ocsp !== false ,
79
79
secureOptions : testOptions . ocsp === false ?
@@ -94,23 +94,23 @@ function test(testOptions, cb) {
94
94
95
95
process . on ( 'exit' , function ( ) {
96
96
if ( testOptions . ocsp === false ) {
97
- assert . equal ( requestCount , clientSecure ) ;
98
- assert . equal ( requestCount , 1 ) ;
97
+ assert . strictEqual ( requestCount , clientSecure ) ;
98
+ assert . strictEqual ( requestCount , 1 ) ;
99
99
return ;
100
100
}
101
101
102
102
if ( testOptions . response ) {
103
- assert . equal ( ocspResponse . toString ( ) , testOptions . response ) ;
103
+ assert . strictEqual ( ocspResponse . toString ( ) , testOptions . response ) ;
104
104
} else {
105
- assert . ok ( ocspResponse === null ) ;
105
+ assert . strictEqual ( ocspResponse , null ) ;
106
106
}
107
- assert . equal ( requestCount , testOptions . response ? 0 : 1 ) ;
108
- assert . equal ( clientSecure , requestCount ) ;
109
- assert . equal ( ocspCount , 1 ) ;
107
+ assert . strictEqual ( requestCount , testOptions . response ? 0 : 1 ) ;
108
+ assert . strictEqual ( clientSecure , requestCount ) ;
109
+ assert . strictEqual ( ocspCount , 1 ) ;
110
110
} ) ;
111
111
}
112
112
113
- var tests = [
113
+ const tests = [
114
114
{ response : false } ,
115
115
{ response : 'hello world' } ,
116
116
{ ocsp : false }
0 commit comments