Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
131 commits
Select commit Hold shift + click to select a range
cf2cb63
some node:net progress
nektro Mar 25, 2025
294c3fa
Merge remote-tracking branch 'origin/main' into nektro-patch-40023
nektro Apr 4, 2025
47415dc
more fixes
nektro Apr 5, 2025
e97be5e
Merge remote-tracking branch 'origin/main' into nektro-patch-40023
nektro Apr 8, 2025
5193024
end
nektro Apr 9, 2025
591248c
more fixes
nektro Apr 9, 2025
ef3a61e
Merge remote-tracking branch 'origin/main' into nektro-patch-40023
nektro Apr 12, 2025
b56edc7
merge fixes
nektro Apr 12, 2025
45e0e1b
remove lots of logs
nektro Apr 12, 2025
30b5cbd
tidy
nektro Apr 12, 2025
6926eea
add back a few logs as $debug
nektro Apr 12, 2025
8ca9a6d
`bun run clang-format`
nektro Apr 12, 2025
761f981
tidy
nektro Apr 12, 2025
7e64b50
add back a couple logs
nektro Apr 12, 2025
fb7c418
fix
nektro Apr 15, 2025
a7daebd
bring back tls handling
nektro Apr 15, 2025
f899805
more passing tls tests
nektro Apr 16, 2025
0836a30
more regression fix
nektro Apr 17, 2025
0b06159
this can return null when connecting on port 0
nektro Apr 17, 2025
61745b1
more
nektro Apr 17, 2025
579e48c
Merge remote-tracking branch 'origin/main' into nektro-patch-40023
nektro Apr 17, 2025
7945339
revert that for now
nektro Apr 17, 2025
5cffa7b
ci: disable some of the matrix while some tests are failing
nektro Apr 17, 2025
8d7224a
types: allowHalfOpen is allowed on both tcp and unix sockets
nektro Apr 17, 2025
28174dc
types fixes
nektro Apr 18, 2025
b99e5db
bring back some of the short circuiting logic for tls
nektro Apr 18, 2025
0da9a7c
pull new SocketHandlers out into variable
nektro Apr 18, 2025
8284a91
regression fixes
nektro Apr 18, 2025
fa85b64
try this too
nektro Apr 18, 2025
b760fbd
reduce import cost of node:net and node:events
nektro Apr 18, 2025
81c2d38
oops
nektro Apr 18, 2025
80dfd71
this was not actually fixed yet, come back to it
nektro Apr 18, 2025
95a3a5e
more nets got fixed
nektro Apr 19, 2025
e2fff4a
fix typo from b760fbd54
nektro Apr 19, 2025
ac7ac89
do this later
nektro Apr 19, 2025
b5019a6
writables dont always have a readable state
nektro Apr 19, 2025
418b22b
do that in a non- breaking change way
nektro Apr 19, 2025
0193fff
include whether the socket is a client or server in these logs
nektro Apr 19, 2025
6087a1b
Merge remote-tracking branch 'origin/main' into nektro-patch-40023
nektro Apr 19, 2025
2d7a651
merge fix
nektro Apr 19, 2025
b1aadeb
fix ban-words.test.ts
nektro Apr 19, 2025
e4e2700
fix bun-types.test.ts
nektro Apr 19, 2025
36c6f26
'| undefined' on optional fields is redundant
nektro Apr 21, 2025
3ba34ea
document socket.upgradeTLS
nektro Apr 21, 2025
351c87e
regression fixes
nektro Apr 22, 2025
1fe8f6a
add back some more test targets
nektro Apr 22, 2025
18eee12
Merge remote-tracking branch 'origin/main' into nektro-patch-40023
nektro Apr 22, 2025
5ed4e9e
`bun run clang-format`
nektro Apr 22, 2025
b2f9cf5
x64 macos takes too long
nektro Apr 22, 2025
9443527
tidy
nektro Apr 22, 2025
087b584
asserting this turned out to be wrong
nektro Apr 22, 2025
83bcac8
getting closer, add more test targets
nektro Apr 22, 2025
ab1b211
Merge remote-tracking branch 'origin/main' into nektro-patch-40023
nektro Apr 23, 2025
f650ba0
fixes
nektro Apr 23, 2025
262e257
more http2 pass
nektro Apr 23, 2025
46742d6
dont mess with the number of args
nektro Apr 23, 2025
0b3ad0c
more
nektro Apr 23, 2025
7695e83
tidy
nektro Apr 24, 2025
a91c815
fix
nektro Apr 24, 2025
0983950
fixes
nektro Apr 24, 2025
c5bba60
remove test-net-connect-reset-after-destroy.js for now
nektro Apr 25, 2025
08cec41
remove test-net-socket-reset-send.js for now
nektro Apr 25, 2025
8f3d737
remove test-tls-connect-abort-controller.js for now
nektro Apr 25, 2025
fb03052
ci: add back flaky test retry
nektro Apr 25, 2025
aa34062
this change was bad
nektro Apr 25, 2025
3f8ef98
this needed just a lil more time
nektro Apr 25, 2025
d40e825
better assertion here
nektro Apr 25, 2025
be3219e
Merge remote-tracking branch 'origin/main' into nektro-patch-40023
nektro Apr 25, 2025
82af73a
Merge remote-tracking branch 'origin/main' into nektro-patch-40023
nektro May 1, 2025
5e3f335
fix net-buffersize timeout and others
nektro May 3, 2025
0217823
fix test-http-keep-alive-drop-requests.js regression
nektro May 3, 2025
794737b
ci: turn the rest back on
nektro May 6, 2025
321947f
Merge remote-tracking branch 'origin/main' into nektro-patch-40023
nektro May 6, 2025
ceafd58
this isnt passing on main either
nektro May 6, 2025
f45c6c6
we report openssl v1 but hit the error in the comment for openssl v3
nektro May 6, 2025
3d8e900
fix test-http2-trailers-after-session-close.js regression
nektro May 6, 2025
4594684
tidy some logs
nektro May 6, 2025
89cc382
new and not passing, investigate later
nektro May 6, 2025
14beca8
add server/client differentiation to the socket logs
nektro May 7, 2025
15d2e31
fix test-tls-inception
nektro May 7, 2025
9d131ff
Merge remote-tracking branch 'origin/main' into nektro-patch-40023
nektro May 7, 2025
b0bebf8
revert this message change
nektro May 8, 2025
23d32a5
unregress ENOENT connect failure message
nektro May 9, 2025
be3f96f
sync kConnectPipe promise handling with kConnectTcp
nektro May 9, 2025
2edd2aa
unregress another test in node-net.test.ts
nektro May 9, 2025
e759354
sync arg handling here
nektro May 9, 2025
9b24e25
unregress next dev-server.test.ts
nektro May 9, 2025
25e9fb9
add more expectations here
nektro May 9, 2025
b0b606a
ci: redisable x64-darwin until its green
nektro May 9, 2025
fbddcdd
fix windows build
nektro May 9, 2025
2dc227d
come back to this
nektro May 9, 2025
ff31948
just to be sure
nektro May 9, 2025
91b7026
those iterations dont work in node either
nektro May 9, 2025
df42b45
another windows fix
nektro May 9, 2025
910e9b2
`bun run prettier`
nektro May 9, 2025
5ce7088
another windows fix smh
nektro May 9, 2025
dab5c1e
come back to this one
nektro May 10, 2025
2a5eb5c
the errnos here are actuall always positive
nektro May 10, 2025
f5667ed
these need more time to pass in debug mode
nektro May 10, 2025
fe1bda5
Merge branch 'main' into nektro-patch-40023
nektro May 12, 2025
41e3d09
address some review
nektro May 14, 2025
e0630dc
ci: disable auto retry from timeout
nektro May 14, 2025
fbb0c4a
address more review
nektro May 14, 2025
9dbe028
Merge remote-tracking branch 'origin/main' into nektro-patch-40023
nektro May 14, 2025
c9d3069
ci: disable more auto retry
nektro May 14, 2025
91f18c9
investigate macos http2 fails
nektro May 15, 2025
3ef7b46
Merge remote-tracking branch 'origin/main' into nektro-patch-40023
nektro May 15, 2025
b60f6d6
surely this time'll work
nektro May 16, 2025
9e07091
long running test, add logs in debug mode
nektro May 16, 2025
08200c7
test wasnt working before, false positive
nektro May 16, 2025
e035f9b
tidy
nektro May 16, 2025
4668d66
edits
nektro May 16, 2025
ecacf4a
fixes from time on windows
nektro May 17, 2025
a3b95c6
see if this fixes http2 timeout issues on mac
nektro May 20, 2025
edbc80d
align the style of the comment with the others
nektro May 22, 2025
307f81b
better return type for try_parse_ip
nektro May 22, 2025
7c2a4c2
align param name here with others
nektro May 22, 2025
0541af5
fix http2 yay
nektro May 22, 2025
081fa6c
tidying
nektro May 23, 2025
02e9f06
`bun run prettier`
nektro May 23, 2025
9e2b893
come back to these
nektro May 23, 2025
46f2055
fix node-tls-namedpipes.test.ts
nektro May 23, 2025
595dd4f
address review
nektro May 23, 2025
c92af17
address review
nektro May 24, 2025
3fac122
fix skipped test
nektro May 28, 2025
d733c2c
oops git too close to the sun
nektro May 28, 2025
f774a1e
Merge branch 'main' into nektro-patch-40023
nektro May 28, 2025
12d20e7
undo modifications to test-tls-inception
nektro May 28, 2025
73dd2c3
fix lint
nektro May 28, 2025
2db9101
:facepalm:
nektro May 28, 2025
6a07f7e
address review
nektro May 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions .buildkite/ci.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,7 @@ function getRetry(limit = 0) {
manual: {
permit_on_passed: true,
},
automatic: [
{ exit_status: 1, limit },
{ exit_status: -1, limit: 1 },
{ exit_status: 255, limit: 1 },
{ signal_reason: "cancel", limit: 1 },
{ signal_reason: "agent_stop", limit: 1 },
],
automatic: false,
};
}

Expand Down Expand Up @@ -572,7 +566,7 @@ function getTestBunStep(platform, options, testOptions = {}) {
retry: getRetry(),
cancel_on_build_failing: isMergeQueue(),
parallelism: unifiedTests ? undefined : os === "darwin" ? 2 : 10,
timeout_in_minutes: profile === "asan" ? 90 : 30,
timeout_in_minutes: profile === "asan" ? 45 : 30,
command:
os === "windows"
? `node .\\scripts\\runner.node.mjs ${args.join(" ")}`
Expand Down
2 changes: 1 addition & 1 deletion docs/runtime/nodejs-apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ This page is updated regularly to reflect compatibility status of the latest ver

### [`node:net`](https://nodejs.org/api/net.html)

🟡 `SocketAddress` class not exposed (but implemented). `BlockList` exists but is a no-op.
🟢 Fully implemented.

### [`node:perf_hooks`](https://nodejs.org/api/perf_hooks.html)

Expand Down
90 changes: 66 additions & 24 deletions packages/bun-types/bun.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3662,7 +3662,7 @@ declare module "bun" {
* the well-known CAs curated by Mozilla. Mozilla's CAs are completely
* replaced when CAs are explicitly specified using this option.
*/
ca?: string | Buffer | BunFile | Array<string | Buffer | BunFile> | undefined;
ca?: string | BufferSource | BunFile | Array<string | BufferSource | BunFile> | undefined;
/**
* Cert chains in PEM format. One cert chain should be provided per
* private key. Each cert chain should consist of the PEM formatted
Expand All @@ -3674,7 +3674,7 @@ declare module "bun" {
* intermediate certificates are not provided, the peer will not be
* able to validate the certificate, and the handshake will fail.
*/
cert?: string | Buffer | BunFile | Array<string | Buffer | BunFile> | undefined;
cert?: string | BufferSource | BunFile | Array<string | BufferSource | BunFile> | undefined;
/**
* Private keys in PEM format. PEM allows the option of private keys
* being encrypted. Encrypted keys will be decrypted with
Expand All @@ -3685,13 +3685,25 @@ declare module "bun" {
* object.passphrase is optional. Encrypted keys will be decrypted with
* object.passphrase if provided, or options.passphrase if it is not.
*/
key?: string | Buffer | BunFile | Array<string | Buffer | BunFile> | undefined;
key?: string | BufferSource | BunFile | Array<string | BufferSource | BunFile> | undefined;
/**
* Optionally affect the OpenSSL protocol behavior, which is not
* usually necessary. This should be used carefully if at all! Value is
* a numeric bitmask of the SSL_OP_* options from OpenSSL Options
*/
secureOptions?: number | undefined; // Value is a numeric bitmask of the `SSL_OP_*` options

keyFile?: string;

certFile?: string;

ALPNProtocols?: string | BufferSource;

ciphers?: string;

clientRenegotiationLimit?: number;

clientRenegotiationWindow?: number;
}

// Note for contributors: TLSOptionsAsDeprecated should be considered immutable
Expand Down Expand Up @@ -6060,7 +6072,7 @@ declare module "bun" {
* certificate.
* @return A certificate object.
*/
getPeerCertificate(): import("tls").PeerCertificate;
getPeerCertificate(): import("node:tls").PeerCertificate;
getPeerX509Certificate(): import("node:crypto").X509Certificate;

/**
Expand Down Expand Up @@ -6165,6 +6177,34 @@ declare module "bun" {
* The number of bytes written to the socket.
*/
readonly bytesWritten: number;

resume(): void;

pause(): void;

renegotiate(): void;

setVerifyMode(requestCert: boolean, rejectUnauthorized: boolean): void;

getSession(): void;

setSession(session: string | Buffer | BufferSource): void;

exportKeyingMaterial(length: number, label: string, context?: string | BufferSource): void;

upgradeTLS<Data>(options: TLSUpgradeOptions<Data>): [raw: Socket<Data>, tls: Socket<Data>];

close(): void;

getServername(): string;

setServername(name: string): void;
}

interface TLSUpgradeOptions<Data> {
data?: Data;
tls: TLSOptions | boolean;
socket: SocketHandler<Data>;
}

interface SocketListener<Data = undefined> extends Disposable {
Expand Down Expand Up @@ -6265,6 +6305,22 @@ declare module "bun" {
* The per-instance data context
*/
data?: Data;
/**
* Whether to allow half-open connections.
*
* A half-open connection occurs when one end of the connection has called `close()`
* or sent a FIN packet, while the other end remains open. When set to `true`:
*
* - The socket won't automatically send FIN when the remote side closes its end
* - The local side can continue sending data even after the remote side has closed
* - The application must explicitly call `end()` to fully close the connection
*
* When `false`, the socket automatically closes both ends of the connection when
* either side closes.
*
* @default false
*/
allowHalfOpen?: boolean;
}

interface TCPSocketListenOptions<Data = undefined> extends SocketOptions<Data> {
Expand All @@ -6279,7 +6335,7 @@ declare module "bun" {
/**
* The TLS configuration object with which to create the server
*/
tls?: TLSOptions;
tls?: TLSOptions | boolean;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add to JSDoc why boolean is supported here/highlight the difference between the object or just a boolean

/**
* Whether to use exclusive mode.
*
Expand Down Expand Up @@ -6325,7 +6381,7 @@ declare module "bun" {
/**
* TLS Configuration with which to create the socket
*/
tls?: boolean;
tls?: TLSOptions | boolean;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add to JSDoc why boolean is supported here/highlight the difference between the object or just a boolean

/**
* Whether to use exclusive mode.
*
Expand All @@ -6341,22 +6397,8 @@ declare module "bun" {
* @default false
*/
exclusive?: boolean;
/**
* Whether to allow half-open connections.
*
* A half-open connection occurs when one end of the connection has called `close()`
* or sent a FIN packet, while the other end remains open. When set to `true`:
*
* - The socket won't automatically send FIN when the remote side closes its end
* - The local side can continue sending data even after the remote side has closed
* - The application must explicitly call `end()` to fully close the connection
*
* When `false` (default), the socket automatically closes both ends of the connection
* when either side closes.
*
* @default false
*/
allowHalfOpen?: boolean;
reusePort?: boolean;
ipv6Only?: boolean;
}

interface UnixSocketOptions<Data = undefined> extends SocketOptions<Data> {
Expand All @@ -6367,14 +6409,14 @@ declare module "bun" {
/**
* TLS Configuration with which to create the socket
*/
tls?: TLSOptions;
tls?: TLSOptions | boolean;
}

interface FdSocketOptions<Data = undefined> extends SocketOptions<Data> {
/**
* TLS Configuration with which to create the socket
*/
tls?: TLSOptions;
tls?: TLSOptions | boolean;
/**
* The file descriptor to connect to
*/
Expand Down
20 changes: 10 additions & 10 deletions packages/bun-usockets/src/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ struct us_socket_t* us_socket_context_connect_resolved_dns(struct us_socket_cont
socket->flags.is_paused = 0;
socket->flags.is_ipc = 0;
socket->connect_state = NULL;

socket->connect_next = NULL;

us_internal_socket_context_link_socket(context, socket);

Expand All @@ -459,7 +459,7 @@ static void init_addr_with_port(struct addrinfo* info, int port, struct sockaddr
}
}

static int try_parse_ip(const char *ip_str, int port, struct sockaddr_storage *storage) {
static bool try_parse_ip(const char *ip_str, int port, struct sockaddr_storage *storage) {
memset(storage, 0, sizeof(struct sockaddr_storage));
// Try to parse as IPv4
struct sockaddr_in *addr4 = (struct sockaddr_in *)storage;
Expand All @@ -469,7 +469,7 @@ static int try_parse_ip(const char *ip_str, int port, struct sockaddr_storage *s
#ifdef __APPLE__
addr4->sin_len = sizeof(struct sockaddr_in);
#endif
return 0;
return 1;
}

// Try to parse as IPv6
Expand All @@ -480,26 +480,26 @@ static int try_parse_ip(const char *ip_str, int port, struct sockaddr_storage *s
#ifdef __APPLE__
addr6->sin6_len = sizeof(struct sockaddr_in6);
#endif
return 0;
return 1;
}

// If we reach here, the input is neither IPv4 nor IPv6
return 1;
return 0;
}

void *us_socket_context_connect(int ssl, struct us_socket_context_t *context, const char *host, int port, int options, int socket_ext_size, int* is_connecting) {
void *us_socket_context_connect(int ssl, struct us_socket_context_t *context, const char *host, int port, int options, int socket_ext_size, int* has_dns_resolved) {
#ifndef LIBUS_NO_SSL
if (ssl == 1) {
return us_internal_ssl_socket_context_connect((struct us_internal_ssl_socket_context_t *) context, host, port, options, socket_ext_size, is_connecting);
return us_internal_ssl_socket_context_connect((struct us_internal_ssl_socket_context_t *) context, host, port, options, socket_ext_size, has_dns_resolved);
}
#endif

struct us_loop_t* loop = us_socket_context_loop(ssl, context);

// fast path for IP addresses in text form
struct sockaddr_storage addr;
if (try_parse_ip(host, port, &addr) == 0) {
*is_connecting = 1;
if (try_parse_ip(host, port, &addr)) {
*has_dns_resolved = 1;
return us_socket_context_connect_resolved_dns(context, &addr, options, socket_ext_size);
}

Expand All @@ -518,7 +518,7 @@ void *us_socket_context_connect(int ssl, struct us_socket_context_t *context, co
if (result->entries && result->entries->info.ai_next == NULL) {
struct sockaddr_storage addr;
init_addr_with_port(&result->entries->info, port, &addr);
*is_connecting = 1;
*has_dns_resolved = 1;
struct us_socket_t *s = us_socket_context_connect_resolved_dns(context, &addr, options, socket_ext_size);
Bun__addrinfo_freeRequest(ai_req, s == NULL);
return s;
Expand Down
30 changes: 15 additions & 15 deletions packages/bun-usockets/src/crypto/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ struct us_internal_ssl_socket_t *ssl_on_open(struct us_internal_ssl_socket_t *s,
s->ssl_read_wants_write = 0;
s->fatal_error = 0;
s->handshake_state = HANDSHAKE_PENDING;


SSL_set_bio(s->ssl, loop_ssl_data->shared_rbio, loop_ssl_data->shared_wbio);
// if we allow renegotiation, we need to set the mode here
Expand Down Expand Up @@ -255,7 +255,7 @@ struct us_internal_ssl_socket_t *ssl_on_open(struct us_internal_ssl_socket_t *s,
}

/// @brief Complete the shutdown or do a fast shutdown when needed, this should only be called before closing the socket
/// @param s
/// @param s
int us_internal_handle_shutdown(struct us_internal_ssl_socket_t *s, int force_fast_shutdown) {
// if we are already shutdown or in the middle of a handshake we dont need to do anything
// Scenarios:
Expand All @@ -265,7 +265,7 @@ int us_internal_handle_shutdown(struct us_internal_ssl_socket_t *s, int force_fa
// 4 - we are in the middle of a handshake
// 5 - we received a fatal error
if(us_internal_ssl_socket_is_shut_down(s) || s->fatal_error || !SSL_is_init_finished(s->ssl)) return 1;

// we are closing the socket but did not sent a shutdown yet
int state = SSL_get_shutdown(s->ssl);
int sent_shutdown = state & SSL_SENT_SHUTDOWN;
Expand All @@ -277,7 +277,7 @@ int us_internal_handle_shutdown(struct us_internal_ssl_socket_t *s, int force_fa
// Zero means that we should wait for the peer to close the connection
// but we are already closing the connection so we do a fast shutdown here
int ret = SSL_shutdown(s->ssl);
if(ret == 0 && force_fast_shutdown) {
if(ret == 0 && force_fast_shutdown) {
// do a fast shutdown (dont wait for peer)
ret = SSL_shutdown(s->ssl);
}
Expand Down Expand Up @@ -397,7 +397,7 @@ void us_internal_update_handshake(struct us_internal_ssl_socket_t *s) {
// nothing todo here, renegotiation must be handled in SSL_read
if (s->handshake_state != HANDSHAKE_PENDING)
return;

if (us_internal_ssl_socket_is_closed(s) || us_internal_ssl_socket_is_shut_down(s) ||
(s->ssl && SSL_get_shutdown(s->ssl) & SSL_RECEIVED_SHUTDOWN)) {

Expand All @@ -422,7 +422,7 @@ void us_internal_update_handshake(struct us_internal_ssl_socket_t *s) {
s->fatal_error = 1;
}
us_internal_trigger_handshake_callback(s, 0);

return;
}
s->handshake_state = HANDSHAKE_PENDING;
Expand Down Expand Up @@ -504,7 +504,7 @@ struct us_internal_ssl_socket_t *ssl_on_data(struct us_internal_ssl_socket_t *s,
loop_ssl_data->ssl_read_output +
LIBUS_RECV_BUFFER_PADDING + read,
LIBUS_RECV_BUFFER_LENGTH - read);

if (just_read <= 0) {
int err = SSL_get_error(s->ssl, just_read);
// as far as I know these are the only errors we want to handle
Expand Down Expand Up @@ -603,7 +603,7 @@ struct us_internal_ssl_socket_t *ssl_on_data(struct us_internal_ssl_socket_t *s,
goto restart;
}
}
// Trigger writable if we failed last SSL_write with SSL_ERROR_WANT_READ
// Trigger writable if we failed last SSL_write with SSL_ERROR_WANT_READ
// If we failed SSL_read because we need to write more data (SSL_ERROR_WANT_WRITE) we are not going to trigger on_writable, we will wait until the next on_data or on_writable event
// SSL_read will try to flush the write buffer and if fails with SSL_ERROR_WANT_WRITE means the socket is not in a writable state anymore and only makes sense to trigger on_writable if we can write more data
// Otherwise we possible would trigger on_writable -> on_data event in a recursive loop
Expand Down Expand Up @@ -1133,7 +1133,7 @@ int us_verify_callback(int preverify_ok, X509_STORE_CTX *ctx) {
}

SSL_CTX *create_ssl_context_from_bun_options(
struct us_bun_socket_context_options_t options,
struct us_bun_socket_context_options_t options,
enum create_bun_socket_error_t *err) {
ERR_clear_error();

Expand Down Expand Up @@ -1250,8 +1250,8 @@ SSL_CTX *create_ssl_context_from_bun_options(
return NULL;
}

// It may return spurious errors here.
ERR_clear_error();
// It may return spurious errors here.
ERR_clear_error();

if (options.reject_unauthorized) {
SSL_CTX_set_verify(ssl_context,
Expand Down Expand Up @@ -1755,7 +1755,7 @@ int us_internal_ssl_socket_raw_write(struct us_internal_ssl_socket_t *s,

int us_internal_ssl_socket_write(struct us_internal_ssl_socket_t *s,
const char *data, int length, int msg_more) {

if (us_socket_is_closed(0, &s->s) || us_internal_ssl_socket_is_shut_down(s) || length == 0) {
return 0;
}
Expand Down Expand Up @@ -1989,7 +1989,7 @@ ssl_wrapped_context_on_end(struct us_internal_ssl_socket_t *s) {
if (wrapped_context->events.on_end) {
wrapped_context->events.on_end((struct us_socket_t *)s);
}

return s;
}

Expand Down Expand Up @@ -2082,7 +2082,7 @@ struct us_internal_ssl_socket_t *us_internal_ssl_socket_wrap_with_tls(
struct us_socket_context_t *context = us_create_bun_ssl_socket_context(
old_context->loop, sizeof(struct us_wrapped_socket_context_t),
options, &err);

// Handle SSL context creation failure
if (UNLIKELY(!context)) {
return NULL;
Expand Down Expand Up @@ -2186,4 +2186,4 @@ us_socket_context_on_socket_connect_error(
return socket;
}

#endif
#endif
Loading