mirror of
https://github.com/oven-sh/bun
synced 2026-02-11 11:29:02 +00:00
53 lines
1.8 KiB
Zig
53 lines
1.8 KiB
Zig
const std = @import("std");
|
|
const bun = @import("root").bun;
|
|
const Environment = bun.Environment;
|
|
const JSC = bun.JSC;
|
|
const string = bun.string;
|
|
const Output = bun.Output;
|
|
const ZigString = JSC.ZigString;
|
|
const uv = bun.windows.libuv;
|
|
|
|
pub fn getBunServerAllClosedPromise(globalThis: *JSC.JSGlobalObject, callframe: *JSC.CallFrame) bun.JSError!JSC.JSValue {
|
|
const arguments = callframe.arguments(1).slice();
|
|
if (arguments.len < 1) {
|
|
globalThis.throwNotEnoughArguments("getBunServerAllClosePromise", 1, arguments.len);
|
|
return .zero;
|
|
}
|
|
|
|
const value = arguments[0];
|
|
|
|
inline for ([_]type{
|
|
JSC.API.HTTPServer,
|
|
JSC.API.HTTPSServer,
|
|
JSC.API.DebugHTTPServer,
|
|
JSC.API.DebugHTTPSServer,
|
|
}) |Server| {
|
|
if (value.as(Server)) |server| {
|
|
return server.getAllClosedPromise(globalThis);
|
|
}
|
|
}
|
|
|
|
return globalThis.throwInvalidArgumentTypeValue("server", "bun.Server", value);
|
|
}
|
|
|
|
pub fn getMaxHTTPHeaderSize(globalThis: *JSC.JSGlobalObject, callframe: *JSC.CallFrame) bun.JSError!JSC.JSValue {
|
|
_ = globalThis; // autofix
|
|
_ = callframe; // autofix
|
|
return JSC.JSValue.jsNumber(bun.http.max_http_header_size);
|
|
}
|
|
|
|
pub fn setMaxHTTPHeaderSize(globalThis: *JSC.JSGlobalObject, callframe: *JSC.CallFrame) bun.JSError!JSC.JSValue {
|
|
const arguments = callframe.arguments(1).slice();
|
|
if (arguments.len < 1) {
|
|
globalThis.throwNotEnoughArguments("setMaxHTTPHeaderSize", 1, arguments.len);
|
|
return .zero;
|
|
}
|
|
const value = arguments[0];
|
|
const num = value.coerceToInt64(globalThis);
|
|
if (num <= 0) {
|
|
return globalThis.throwInvalidArgumentTypeValue("maxHeaderSize", "non-negative integer", value);
|
|
}
|
|
bun.http.max_http_header_size = @intCast(num);
|
|
return JSC.JSValue.jsNumber(bun.http.max_http_header_size);
|
|
}
|