Skip to content

Instantly share code, notes, and snippets.

@masakielastic
Last active October 19, 2024 04:37
Show Gist options
  • Save masakielastic/6b77b78079f7a980eb5ccdf533ca7b1f to your computer and use it in GitHub Desktop.
Save masakielastic/6b77b78079f7a980eb5ccdf533ca7b1f to your computer and use it in GitHub Desktop.
pub fn h2frames() []const u8 {
return
// PRI
"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" ++
// SETTINGS
"\x00\x00\x0C" ++
"\x04" ++
"\x00" ++
"\x00\x00\x00\x00" ++
"\x00\x02\x00\x00\x00\x00" ++
"\x00\x03\x00\x00\x00\x64" ++
// ACK
"\x00\x00\x00" ++
"\x04" ++
"\x01" ++
"\x00\x00\x00\x00" ++
// HEADERS
"\x00\x00\x3a" ++
"\x01" ++
"\x05" ++
"\x00\x00\x00\x01" ++
"\x00" ++
// 7:method
"\x07\x3a\x6d\x65\x74\x68\x6f\x64" ++
// 3GET
"\x03\x47\x45\x54" ++
"\x00" ++
// 5:path
"\x05\x3a\x70\x61\x74\x68" ++
// 1/
"\x01\x2f" ++
"\x00" ++
// 7:scheme
"\x07\x3a\x73\x63\x68\x65\x6d\x65" ++
// 4http
"\x04\x68\x74\x74\x70" ++
"\x00" ++
// 10:authority
"\x0a\x3a\x61\x75\x74\x68\x6f\x72\x69\x74\x79" ++
// 9localhost
"\x09\x6c\x6f\x63\x61\x6c\x68\x6f\x73\x74";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment