diff --git a/src/connmgr/zhttppacket.rs b/src/connmgr/zhttppacket.rs index 9507fee1..865e7800 100644 --- a/src/connmgr/zhttppacket.rs +++ b/src/connmgr/zhttppacket.rs @@ -325,6 +325,7 @@ pub struct RequestData<'buf, 'headers> { pub credits: u32, pub more: bool, pub stream: bool, + pub router_resp: bool, pub max_size: u32, pub timeout: u32, pub method: &'buf str, @@ -349,6 +350,7 @@ impl RequestData<'_, '_> { credits: 0, more: false, stream: false, + router_resp: false, max_size: 0, timeout: 0, method: "", @@ -425,6 +427,11 @@ impl<'a> Serialize<'a> for RequestData<'a, 'a> { w.write_bool(true)?; } + if self.router_resp { + w.write_string(b"router-resp")?; + w.write_bool(true)?; + } + if self.max_size > 0 { w.write_string(b"max-size")?; w.write_int(self.max_size as isize)?; @@ -457,6 +464,7 @@ impl<'buf: 'scratch, 'scratch> Parse<'buf, 'scratch> for RequestData<'buf, 'scra let mut credits = 0; let mut more = false; let mut stream = false; + let mut router_resp = false; let mut max_size = 0; let mut timeout = 0; let mut method = ""; @@ -495,6 +503,11 @@ impl<'buf: 'scratch, 'scratch> Parse<'buf, 'scratch> for RequestData<'buf, 'scra stream = b; } + "router-resp" => { + let b = tnetstring::parse_bool(e.data).field("router-resp")?; + + router_resp = b; + } "max-size" => { let x = tnetstring::parse_int(e.data).field("max-size")?; @@ -641,6 +654,7 @@ impl<'buf: 'scratch, 'scratch> Parse<'buf, 'scratch> for RequestData<'buf, 'scra credits, more, stream, + router_resp, max_size, timeout, method, @@ -1783,6 +1797,7 @@ mod tests { credits: 0, more: true, stream: false, + router_resp: false, max_size: 0, timeout: 0, method: "POST", diff --git a/src/core/zhttprequestpacket.cpp b/src/core/zhttprequestpacket.cpp index 4dc5ee41..6bc0f75e 100644 --- a/src/core/zhttprequestpacket.cpp +++ b/src/core/zhttprequestpacket.cpp @@ -88,6 +88,9 @@ QVariant ZhttpRequestPacket::toVariant() const if(stream) obj["stream"] = true; + if(routerResp) + obj["router-resp"] = true; + if(maxSize != -1) obj["max-size"] = maxSize; @@ -309,6 +312,15 @@ bool ZhttpRequestPacket::fromVariant(const QVariant &in) stream = obj["stream"].toBool(); } + routerResp = false; + if(obj.contains("router-resp")) + { + if(typeId(obj["router-resp"]) != QMetaType::Bool) + return false; + + routerResp = obj["router-resp"].toBool(); + } + maxSize = -1; if(obj.contains("max-size")) { diff --git a/src/core/zhttprequestpacket.h b/src/core/zhttprequestpacket.h index 16ba0785..c89dbfd0 100644 --- a/src/core/zhttprequestpacket.h +++ b/src/core/zhttprequestpacket.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2012-2016 Fanout, Inc. + * Copyright (C) 2024 Fastly, Inc. * * $FANOUT_BEGIN_LICENSE:APACHE2$ * @@ -70,6 +71,7 @@ class ZhttpRequestPacket int credits; bool more; bool stream; + bool routerResp; int maxSize; int timeout; @@ -101,6 +103,7 @@ class ZhttpRequestPacket credits(-1), more(false), stream(false), + routerResp(false), maxSize(-1), timeout(-1), code(-1),