mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
- Add proper SNI callback bridge with tagged union support
- Integrate with µSockets SNI infrastructure from commit 64a409e8
- Add SNICallback validation and property exposure in TLS servers
- Update setSecureContext to handle SNICallback option
- Add comprehensive test suite for SNI callback functionality
- Begin HTTPS server SNICallback support (needs build completion)
Core functionality working: TLS servers now support dynamic certificate
selection via SNICallback matching Node.js API compatibility.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
30 lines
1.0 KiB
JavaScript
30 lines
1.0 KiB
JavaScript
const tls = require("tls");
|
|
const https = require("https");
|
|
|
|
const options = {
|
|
SNICallback: (hostname, callback) => {
|
|
console.log("SNI callback called with:", hostname);
|
|
callback(null, null);
|
|
}
|
|
};
|
|
|
|
console.log("Creating HTTPS server with options:", Object.keys(options));
|
|
|
|
// Test direct TLS server creation
|
|
console.log("\n=== Direct TLS Server ===");
|
|
const directTls = tls.createServer(options);
|
|
console.log("Direct TLS SNICallback:", typeof directTls.SNICallback);
|
|
|
|
// Test HTTPS server creation (should route to TLS)
|
|
console.log("\n=== HTTPS Server (should route to TLS) ===");
|
|
const httpsServer = https.createServer(options);
|
|
console.log("HTTPS SNICallback:", typeof httpsServer.SNICallback);
|
|
|
|
// Check if they're actually the same type
|
|
console.log("\n=== Type comparison ===");
|
|
console.log("Direct TLS instanceof:", directTls.constructor.name);
|
|
console.log("HTTPS instanceof:", httpsServer.constructor.name);
|
|
console.log("Are same constructor:", directTls.constructor === httpsServer.constructor);
|
|
|
|
directTls.close();
|
|
httpsServer.close(); |