mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
fix(http2) fix remoteSettings not emitting on default settings (#20622)
This commit is contained in:
@@ -1461,7 +1461,7 @@ pub const H2FrameParser = struct {
|
||||
}
|
||||
|
||||
pub fn sendSettingsACK(this: *H2FrameParser) void {
|
||||
log("HTTP_FRAME_SETTINGS ack true", .{});
|
||||
log("send HTTP_FRAME_SETTINGS ack true", .{});
|
||||
var buffer: [FrameHeader.byteSize]u8 = undefined;
|
||||
@memset(&buffer, 0);
|
||||
var stream = std.io.fixedBufferStream(&buffer);
|
||||
@@ -2386,7 +2386,7 @@ pub const H2FrameParser = struct {
|
||||
if (this.remoteSettings == null) {
|
||||
|
||||
// ok empty settings so default settings
|
||||
const remoteSettings: FullSettingsPayload = .{};
|
||||
var remoteSettings: FullSettingsPayload = .{};
|
||||
this.remoteSettings = remoteSettings;
|
||||
log("remoteSettings.initialWindowSize: {} {} {}", .{ remoteSettings.initialWindowSize, this.remoteUsedWindowSize, this.remoteWindowSize });
|
||||
|
||||
@@ -2399,6 +2399,7 @@ pub const H2FrameParser = struct {
|
||||
}
|
||||
}
|
||||
}
|
||||
this.dispatch(.onRemoteSettings, remoteSettings.toJS(this.handlers.globalObject));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3785,6 +3786,7 @@ pub const H2FrameParser = struct {
|
||||
|
||||
pub fn request(this: *H2FrameParser, globalObject: *JSC.JSGlobalObject, callframe: *JSC.CallFrame) bun.JSError!JSValue {
|
||||
JSC.markBinding(@src());
|
||||
log("request", .{});
|
||||
|
||||
const args_list = callframe.arguments_old(5);
|
||||
if (args_list.len < 4) {
|
||||
|
||||
@@ -214,6 +214,31 @@ for (const nodeExecutable of [nodeExe(), bunExe()]) {
|
||||
expect(parsed.url).toBe(`${HTTPS_SERVER}/get`);
|
||||
}
|
||||
});
|
||||
it("http2 should receive remoteSettings when receiving default settings frame", async () => {
|
||||
const { promise, resolve, reject } = Promise.withResolvers();
|
||||
const session = http2.connect(HTTPS_SERVER, TLS_OPTIONS);
|
||||
|
||||
session.once("remoteSettings", resolve);
|
||||
session.once("close", () => {
|
||||
reject(new Error("Failed to receive remoteSettings"));
|
||||
});
|
||||
try {
|
||||
const settings = await promise;
|
||||
expect(settings).toBeDefined();
|
||||
expect(settings).toEqual({
|
||||
headerTableSize: 4096,
|
||||
enablePush: false,
|
||||
maxConcurrentStreams: 4294967295,
|
||||
initialWindowSize: 65535,
|
||||
maxFrameSize: 16384,
|
||||
maxHeaderListSize: 65535,
|
||||
maxHeaderSize: 65535,
|
||||
enableConnectProtocol: false,
|
||||
});
|
||||
} finally {
|
||||
session.close();
|
||||
}
|
||||
});
|
||||
it("should be able to mutiplex POST requests", async () => {
|
||||
const results = await doMultiplexHttp2Request(HTTPS_SERVER, [
|
||||
{ headers: { ":path": "/post", ":method": "POST" }, payload: JSON.stringify({ "request": 1 }) },
|
||||
|
||||
Reference in New Issue
Block a user