@@ -115,7 +115,9 @@ describe("When configured for HTTPS", () => {
115
115
keyPath : './test/fixtures/test-ca.key' ,
116
116
certPath : './test/fixtures/test-ca.pem' ,
117
117
tlsPassthrough : [
118
- { hostname : 'example.com' }
118
+ { hostname : 'example.com' } ,
119
+ // A convenient server that doesn't require SNI to serve the right cert:
120
+ { hostname : 'ip-api.com' }
119
121
]
120
122
}
121
123
} ) ;
@@ -196,28 +198,28 @@ describe("When configured for HTTPS", () => {
196
198
} ) ;
197
199
198
200
const cert = tlsSocket . getPeerCertificate ( ) ;
199
- expect ( cert . subject . CN ) . to . equal ( 'www .example.org ' ) ;
201
+ expect ( cert . subject . CN ) . to . equal ( '* .example.com ' ) ;
200
202
expect ( cert . issuer . CN ) . to . include ( 'DigiCert' ) ; // <-- This is the real issuer, right now at least
201
203
} ) ;
202
204
203
205
it ( "bypasses Mockttp for TLS connections inside matching HTTP/1 CONNECT tunnel" , async ( ) => {
204
206
const tunnel = await openRawSocket ( server ) ;
205
207
206
- tunnel . write ( 'CONNECT example .com:443 HTTP/1.1\r\n\r\n' ) ;
208
+ tunnel . write ( 'CONNECT ip-api .com:443 HTTP/1.1\r\n\r\n' ) ;
207
209
208
210
await delay ( 50 ) ;
209
211
210
212
const result = tunnel . read ( ) ;
211
213
expect ( result . toString ( ) ) . to . equal ( 'HTTP/1.1 200 OK\r\n\r\n' ) ;
212
214
213
215
const tlsSocket = await openRawTlsSocket ( tunnel , {
214
- host : 'example .com'
215
- // No SNI used here!
216
+ host : 'ip-api .com' ,
217
+ servername : '' // No SNI used here!
216
218
} ) ;
217
219
218
220
const cert = tlsSocket . getPeerCertificate ( ) ;
219
- expect ( cert . subject . CN ) . to . equal ( 'www.example.org ' ) ;
220
- expect ( cert . issuer . CN ) . to . include ( 'DigiCert' ) ; // <-- This is the real issuer, right now at least
221
+ expect ( cert . subject . CN ) . to . equal ( '*.ip-api.com ' ) ;
222
+ expect ( cert . issuer . CN ) . to . include ( 'Sectigo RSA Domain Validation Secure' ) ;
221
223
} ) ;
222
224
223
225
it ( "still handles matching CONNECT-tunnelled plain-HTTP requests" , async ( ) => {
0 commit comments