11'use strict' ;
2- var common = require ( '../common' ) ;
2+ const common = require ( '../common' ) ;
33
44if ( ! process . features . tls_ocsp ) {
55common . skip ( 'node compiled without OpenSSL or ' +
@@ -15,33 +15,33 @@ if (!common.hasCrypto){
1515common . skip ( 'missing crypto' ) ;
1616return ;
1717}
18- var tls = require ( 'tls' ) ;
18+ const tls = require ( 'tls' ) ;
1919
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 ;
2323
2424const SSL_OP_NO_TICKET = require ( 'crypto' ) . constants . SSL_OP_NO_TICKET ;
2525
26- var pfx = fs . readFileSync ( join ( common . fixturesDir , 'keys' , 'agent1-pfx.pem' ) ) ;
26+ const pfx = fs . readFileSync ( join ( common . fixturesDir , 'keys' , 'agent1-pfx.pem' ) ) ;
2727
2828function test ( testOptions , cb ) {
2929
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 = {
3737key : key ,
3838cert : cert ,
3939ca : [ ca ]
4040} ;
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 ;
4545
4646if ( testOptions . pfx ) {
4747delete options . key ;
@@ -50,7 +50,7 @@ function test(testOptions, cb){
5050options . passphrase = testOptions . passphrase ;
5151}
5252
53- var server = tls . createServer ( options , function ( cleartext ) {
53+ const server = tls . createServer ( options , function ( cleartext ) {
5454cleartext . on ( 'error' , function ( er ) {
5555// We're ok with getting ECONNRESET in this test, but it's
5656// timing-dependent, and thus unreliable. Any other errors
@@ -73,7 +73,7 @@ function test(testOptions, cb){
7373} , 100 ) ;
7474} ) ;
7575server . listen ( 0 , function ( ) {
76- var client = tls . connect ( {
76+ const client = tls . connect ( {
7777port : this . address ( ) . port ,
7878requestOCSP : testOptions . ocsp !== false ,
7979secureOptions : testOptions . ocsp === false ?
@@ -94,23 +94,23 @@ function test(testOptions, cb){
9494
9595process . on ( 'exit' , function ( ) {
9696if ( testOptions . ocsp === false ) {
97- assert . equal ( requestCount , clientSecure ) ;
98- assert . equal ( requestCount , 1 ) ;
97+ assert . strictEqual ( requestCount , clientSecure ) ;
98+ assert . strictEqual ( requestCount , 1 ) ;
9999return ;
100100}
101101
102102if ( testOptions . response ) {
103- assert . equal ( ocspResponse . toString ( ) , testOptions . response ) ;
103+ assert . strictEqual ( ocspResponse . toString ( ) , testOptions . response ) ;
104104} else {
105- assert . ok ( ocspResponse === null ) ;
105+ assert . strictEqual ( ocspResponse , null ) ;
106106}
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 ) ;
110110} ) ;
111111}
112112
113- var tests = [
113+ const tests = [
114114{ response : false } ,
115115{ response : 'hello world' } ,
116116{ ocsp : false }
0 commit comments