Frame type opcodes (RFC 7540 §11.2). Use these symbolic names instead of literal integers when calling write_frame / matching headers.
write_frame_bytes(buf, FrameType::headers(),
FrameFlag::end_headers(), 1, hdr_payload);
defined in C:\Users\bye45\.glide\bin/src/stdlib/http/h2.glide
Frame type opcodes (RFC 7540 §11.2). Use these symbolic names instead
Frame type opcodes (RFC 7540 §11.2). Use these symbolic names instead of literal integers when calling write_frame / matching headers.
write_frame_bytes(buf, FrameType::headers(),
FrameFlag::end_headers(), 1, hdr_payload);
Frame flag bits (RFC 7540 §6). Combine with | for multi-flag frames (e.g. last HEADERS frame with no body sets both end_headers and end_stream). ack and end_stream happen to share bit 1 — they're never used on the same frame type.
let f: int = FrameFlag::end_headers() | FrameFlag::end_stream();
write_frame_bytes(buf, FrameType::headers(), f, 1, hdr_payload);
Append a 9-byte frame header to buf, then payload. RFC 7540 §4.1. Use write_frame_bytes for binary payloads that may contain NUL — this entry truncates at the first NUL because Glide string is a cstring.
let buf: *ByteBuffer = ByteBuffer::new(); defer buf.free();
write_frame(buf, FrameType::ping(), 0, 0, "ABCDEFGH"); // 8-byte ping
tls.write_bytes(buf.data, buf.len);
Same as write_frame but pulls the payload from a ByteBuffer with explicit length. Use this for HPACK-encoded headers and for any payload that may carry NUL bytes mid-frame.
let hdrs: *ByteBuffer = ByteBuffer::new(); defer hdrs.free();
enc.encode_header(hdrs, ":method", "GET");
enc.encode_header(hdrs, ":path", "/");
let buf: *ByteBuffer = ByteBuffer::new(); defer buf.free();
let f: int = FrameFlag::end_headers() | FrameFlag::end_stream();
write_frame_bytes(buf, FrameType::headers(), f, 1, hdrs);
Parse a 9-byte frame header at pos in raw. Returns the header and the new position (header end; payload starts here). Binary safe (uses ByteBuffer.at, not string indexing).
let r: !*FrameHeader = read_frame_header(rx_buf, 0);
if r.ok {
let h: *FrameHeader = r.val;
println!("type", h.frame_type, "len", h.length, "stream", h.stream_id);
}
The 24-byte HTTP/2 connection preface (RFC 7540 §3.5). Send this immediately after the TLS handshake (or the bare TCP connection for h2c). H2Conn::over does this for you.
let preface: string = h2_preface();
preface is "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"
Empty SETTINGS frame (acknowledges defaults). Use with flags=0 to announce our settings, or with FrameFlag::ack() to ack the peer's.
Acknowledge the peer's SETTINGS:
write_frame(buf, FrameType::settings(),
FrameFlag::ack(), 0, settings_payload_empty());
Append a single 6-byte SETTINGS entry (16-bit key + 32-bit value). Settings keys (RFC 7540 §6.5.2): 0x1 HEADER_TABLE_SIZE 0x2 ENABLE_PUSH 0x3 MAX_CONCURRENT_STREAMS 0x4 INITIAL_WINDOW_SIZE 0x5 MAX_FRAME_SIZE 0x6 MAX_HEADER_LIST_SIZE
let pl: *ByteBuffer = ByteBuffer::new(); defer pl.free();
settings_pair_to(pl, 2, 0); // ENABLE_PUSH = false
settings_pair_to(pl, 4, 1048576); // INITIAL_WINDOW_SIZE = 1 MiB
write_frame_bytes(buf, FrameType::settings(), 0, 0, pl);
Append a 4-byte WINDOW_UPDATE payload (31-bit increment + reserved bit).
let wu: *ByteBuffer = ByteBuffer::new(); defer wu.free();
window_update_to(wu, 65535); // grow stream window by 64 KiB
write_frame_bytes(buf, FrameType::window_update(), 0, stream_id, wu);