pub struct Modified { /* private fields */ }Expand description
§A handler for the Last-Modified and If-Modified-Since header interaction.
This handler does not set a Last-Modified header on its own, but
relies on other handlers doing so.
§Precedence: If-None-Match wins
If-Modified-Since is evaluated only when the request carries no
If-None-Match. Per RFC 9110 §13.1.3:
A recipient MUST ignore If-Modified-Since if the request contains an If-None-Match header field; the condition in If-None-Match is considered to be a more accurate replacement for the condition in If-Modified-Since, and the two are only combined for the sake of interoperating with older intermediaries that might not implement If-None-Match.
This matters most in the case it is easiest to overlook: when the entity tag
did not match. Honoring both conditions would let a coarse timestamp
comparison override an Etag that had already determined the representation
changed, answering 304 for a body that is genuinely new. Browsers routinely
replay both headers, so any handler whose Last-Modified is coarser than its
entity tag — a rendered response whose inputs are versioned rather than
timestamped, say — would otherwise serve stale content.
Implementations§
Trait Implementations§
impl Copy for Modified
Source§impl Handler for Modified
impl Handler for Modified
Source§async fn before_send(&self, conn: Conn) -> Conn
async fn before_send(&self, conn: Conn) -> Conn
Source§async fn run(&self, conn: Conn) -> Conn
async fn run(&self, conn: Conn) -> Conn
Source§fn init(&mut self, info: &mut Info) -> impl Future<Output = ()> + Send
fn init(&mut self, info: &mut Info) -> impl Future<Output = ()> + Send
Source§fn has_upgrade(&self, upgrade: &Upgrade) -> bool
fn has_upgrade(&self, upgrade: &Upgrade) -> bool
Handler::upgrade. The first handler that responds true to this will receive
ownership of the trillium::Upgrade in a subsequent call to
Handler::upgradeSource§fn upgrade(&self, upgrade: Upgrade) -> impl Future<Output = ()> + Send
fn upgrade(&self, upgrade: Upgrade) -> impl Future<Output = ()> + Send
Handler::has_upgrade and will
only be called once for this upgrade. There is no return value, and this function takes
exclusive ownership of the underlying transport once this is called. You can downcast
the transport to whatever the source transport type is and perform any non-http protocol
communication that has been negotiated. You probably don’t want this unless you’re
implementing something like websockets. Please note that for many transports such as
TcpStreams, dropping the transport (and therefore the Upgrade) will hang up /
disconnect.