Skip to content

Commit fa28c8e

Browse files
committed
Update TLS tunnel test hostnames to fix build
1 parent ee7c8be commit fa28c8e

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

test/integration/https.spec.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ describe("When configured for HTTPS", () => {
115115
keyPath: './test/fixtures/test-ca.key',
116116
certPath: './test/fixtures/test-ca.pem',
117117
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' }
119121
]
120122
}
121123
});
@@ -196,28 +198,28 @@ describe("When configured for HTTPS", () => {
196198
});
197199

198200
const cert = tlsSocket.getPeerCertificate();
199-
expect(cert.subject.CN).to.equal('www.example.org');
201+
expect(cert.subject.CN).to.equal('*.example.com');
200202
expect(cert.issuer.CN).to.include('DigiCert'); // <-- This is the real issuer, right now at least
201203
});
202204

203205
it("bypasses Mockttp for TLS connections inside matching HTTP/1 CONNECT tunnel", async () => {
204206
const tunnel = await openRawSocket(server);
205207

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');
207209

208210
await delay(50);
209211

210212
const result = tunnel.read();
211213
expect(result.toString()).to.equal('HTTP/1.1 200 OK\r\n\r\n');
212214

213215
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!
216218
});
217219

218220
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');
221223
});
222224

223225
it("still handles matching CONNECT-tunnelled plain-HTTP requests", async () => {

0 commit comments

Comments
 (0)