aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/ScriptExecutionContext.cpp
diff options
context:
space:
mode:
authorGravatar Ciro Spaciari <ciro.spaciari@gmail.com> 2023-05-21 13:50:53 -0300
committerGravatar GitHub <noreply@github.com> 2023-05-21 09:50:53 -0700
commit3870f674f90b2780e247bcd670a89ab8dd41fa22 (patch)
treefc8226fe554da7e15352055f9689778aabfb1d0c /src/bun.js/bindings/ScriptExecutionContext.cpp
parent12b34c625833c7cff4ecb6ebd67b3872028f4a80 (diff)
downloadbun-3870f674f90b2780e247bcd670a89ab8dd41fa22.tar.gz
bun-3870f674f90b2780e247bcd670a89ab8dd41fa22.tar.zst
bun-3870f674f90b2780e247bcd670a89ab8dd41fa22.zip
fix(tls.connect) fix SNI on tls sockets and also servername (mongodb) (#2934)
* fixes SNI on tls sockets and also servername * 💅 * 💅 * add support for https and wss * fix bun types * support Bun.file on ca, key and cert * 💅 * add setTimeout (makes fastify run) * fix httpVersion * fix WebSocketServer and add listen event * fix ws exports and http listening * fix default import * bump uws * add nodebuffer compatibility * fix drain and allow more passing tests to run * fix enqueud messages * default to arraybuffer * fix constructor binaryType * fmt * fixup * skip some tests * skip more * skip fault tests * reuse encoder instance * fix handshake WS Client * temporary revert handshake fix * fix handshake * disable all socket.io test temp * fixup * add back socket.io tests * use node_fs to read cert, ca and key on server.zig * throw the error returned by NodeFS * 💅
Diffstat (limited to 'src/bun.js/bindings/ScriptExecutionContext.cpp')
-rw-r--r--src/bun.js/bindings/ScriptExecutionContext.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/bun.js/bindings/ScriptExecutionContext.cpp b/src/bun.js/bindings/ScriptExecutionContext.cpp
index 151c66495..08e8e11ef 100644
--- a/src/bun.js/bindings/ScriptExecutionContext.cpp
+++ b/src/bun.js/bindings/ScriptExecutionContext.cpp
@@ -38,9 +38,13 @@ us_socket_context_t* ScriptExecutionContext::webSocketContextSSL()
{
if (!m_ssl_client_websockets_ctx) {
us_loop_t* loop = (us_loop_t*)uws_get_loop();
- us_socket_context_options_t opts;
- memset(&opts, 0, sizeof(us_socket_context_options_t));
- this->m_ssl_client_websockets_ctx = us_create_socket_context(1, loop, sizeof(size_t), opts);
+ us_bun_socket_context_options_t opts;
+ memset(&opts, 0, sizeof(us_bun_socket_context_options_t));
+ // adds root ca
+ opts.request_cert = true;
+ // but do not reject unauthorized
+ opts.reject_unauthorized = false;
+ this->m_ssl_client_websockets_ctx = us_create_bun_socket_context(1, loop, sizeof(size_t), opts);
void** ptr = reinterpret_cast<void**>(us_socket_context_ext(1, m_ssl_client_websockets_ctx));
*ptr = this;
registerHTTPContextForWebSocket<true, false>(this, m_ssl_client_websockets_ctx, loop);