feat(ext-vite): recognise navigations by Sec-Fetch-Mode, read every header in place
A path that is no file falls back to index.html when the request is a navigation: Sec-Fetch-Mode: navigate, or an Accept naming text/html for older clients. That check, Accept-Encoding and If-None-Match are all matched on the header bytes through the new Request.headerView(name), so serving still allocates nothing. navigationOnly(false) drops the check for an app that wants every GET miss to get the page. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
680bbca8c7
commit
003fd6d1f0
@@ -181,6 +181,12 @@ public class Request {
|
||||
*/
|
||||
public String header(String name) { checkActive(); return requestLine.getHeaders().first(name); }
|
||||
|
||||
/**
|
||||
* The first value of header {@code name} as a view over the request's own bytes, or {@code null}:
|
||||
* {@link #header} without the {@code String}, for a hot path. Valid only while the handler runs.
|
||||
*/
|
||||
public ByteView headerView(String name) { checkActive(); return requestLine.getHeaders().view(name); }
|
||||
|
||||
/**
|
||||
* Returns all values of header {@code name} in declaration order.
|
||||
* Useful for headers that appear multiple times (e.g. {@code Accept}, {@code Cookie}).
|
||||
|
||||
Reference in New Issue
Block a user