///|
fn main {
let proxy = @utf8.encode(
"PROXY TCP4 192.0.2.10 198.51.100.20 50000 80\r\n",
bom=false,
)
let http = @utf8.encode(
"GET /health HTTP/1.1\r\nHost: local\r\n\r\n",
bom=false,
)
let frame = @proxyproto.decode_v1(
@proxyproto.bytes_concat(proxy, http),
@proxyproto.DecodePolicy::v1_only(),
).unwrap()
if !@proxyproto.bytes_equal_constant_time(frame.remaining, http) {
abort("HTTP request changed")
}
println("HTTP preamble preserved")
}