Record Class SecFetch
- Record Components:
site- The relationship between the request initiator and requested resource, ornullifSec-Fetch-Sitewas absent or carried an unrecognised valuemode- The request mode, ornullifSec-Fetch-Modewas absent or carried an unrecognised valuedest- The request destination, ornullifSec-Fetch-Destwas absent or carried a value not listed byDestination. The Fetch specification keeps adding destinations, so a newer client can legitimately send one this version does not knowuser- Whether the request was initiated by user activation. OnlySec-Fetch-User: ?1yieldstrue; an absent header, the structured field boolean?0, and any unrecognised value all yieldfalse
Each component is populated independently: a header that is absent, or that carries a value
this version does not recognise, yields a null component while the headers that did
parse remain readable. An unrecognised Sec-Fetch-Dest therefore does not hide the site
and mode, which is what a resource isolation policy needs in order to fail closed on the part it
could not classify rather than on the whole request.
- Since:
- 5.1.12
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSecFetch(@Nullable Site site, @Nullable Mode mode, @Nullable Destination dest, boolean user) Creates an instance of aSecFetchrecord class. -
Method Summary
Modifier and TypeMethodDescription@Nullable Destinationdest()Returns the value of thedestrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@Nullable Modemode()Returns the value of themoderecord component.static @Nullable SecFetchof(HttpHeaders headers) Creates Fetch Metadata from the given headers.static @Nullable SecFetchof(HttpRequest<?> request) Creates Fetch Metadata from the request headers.@Nullable Sitesite()Returns the value of thesiterecord component.final StringtoString()Returns a string representation of this record class.booleanuser()Returns the value of theuserrecord component.
-
Constructor Details
-
Method Details
-
of
Creates Fetch Metadata from the request headers.- Parameters:
request- The HTTP request- Returns:
- The Fetch Metadata, or
nullif the request carries none of the Fetch Metadata headers. Seeof(HttpHeaders)for what anullreturn does and does not tell a caller - Since:
- 5.1.12
-
of
Creates Fetch Metadata from the given headers.The result is best effort. Headers that parse are reported; those that are absent or carry an unrecognised value become
nullcomponents. Headers that could not be classified never suppress the ones that could, so a request whoseSec-Fetch-Destis unknown still reports its site and mode.- Parameters:
headers- The HTTP headers- Returns:
- The Fetch Metadata, or
nullif none ofSec-Fetch-Site,Sec-Fetch-Mode,Sec-Fetch-DestandSec-Fetch-Useris present.A
nullreturn means only that the client sent no Fetch Metadata at all — an older browser, or a non-browser client — and carries no assurance that the request is safe. Likewise anullcomponent means "not classified", not "harmless". Resource isolation policies should decide deliberately what to do with unclassified requests rather than treatingnullas an implicit allow - Since:
- 5.1.12
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
site
-
mode
-
dest
-
user
-