Package io.github.mahmoudimus.http2
Record Class Http2ClientProfile
java.lang.Object
java.lang.Record
io.github.mahmoudimus.http2.Http2ClientProfile
- Record Components:
name- the profile's name, such aschrome-156settings- the SETTINGS identifiers and values, in the order they are sentconnectionWindowIncrement- the connection WINDOW_UPDATE increment sent after SETTINGS, 0 for noneheadersPriority- the RFC 7540 priority on a request's HEADERS, or null for nonepseudoHeaderOrder- the request pseudo-headers in the order they are sentfirstStreamId- the id of the first stream a connection opens: 1, or 3 for a client that keeps 1 for an HTTP/1.1 upgrade (Firefox)teTrailers- whether every request carrieste: trailers, as Firefox's do; otherwise only those whose client accepted trailers
public record Http2ClientProfile(String name, Map<Integer,Long> settings, int connectionWindowIncrement, Http2ClientProfile.RequestPriority headersPriority, List<String> pseudoHeaderOrder, int firstStreamId, boolean teTrailers)
extends Record
What a client's HTTP/2 connections look like to a server, the parts of it that HTTP/2
fingerprints (Akamai's among them) record:
- the SETTINGS it opens with, in order;
- the WINDOW_UPDATE that grows the connection window;
- the priority its request HEADERS carry, which may depend on the request;
- the order of the request pseudo-headers;
- the id of its first stream.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceThe priority a request's HEADERS carry, from the request's header list. -
Constructor Summary
ConstructorsConstructorDescriptionHttp2ClientProfile(String name, Map<Integer, Long> settings, int connectionWindowIncrement, Frame.PrioritySpec headersPriority, List<String> pseudoHeaderOrder) A profile whose every request carriesheadersPriority, its first stream 1.Http2ClientProfile(String name, Map<Integer, Long> settings, int connectionWindowIncrement, Http2ClientProfile.RequestPriority headersPriority, List<String> pseudoHeaderOrder, int firstStreamId, boolean teTrailers) Creates an instance of aHttp2ClientProfilerecord class. -
Method Summary
Modifier and TypeMethodDescriptionakamai()The Akamai HTTP/2 fingerprint of this profile's connections:SETTINGS|WINDOW_UPDATE|PRIORITY frames|pseudo-header order, with no PRIORITY frames.static Http2ClientProfileChrome 156, as captured from 156.0.8078.48 (macOS): SETTINGSHEADER_TABLE_SIZE 65536,ENABLE_PUSH 0,INITIAL_WINDOW_SIZE 6291456,MAX_HEADER_LIST_SIZE 262144; a connection WINDOW_UPDATE of 15663105; HEADERS with an exclusive dependency on the root and weight 256; pseudo-headers:method :authority :scheme :path.intReturns the value of theconnectionWindowIncrementrecord component.final booleanIndicates whether some other object is "equal to" this one.static Http2ClientProfileFirefox 159, as captured from 159.0 (macOS): SETTINGSHEADER_TABLE_SIZE 65536,ENABLE_PUSH 0,INITIAL_WINDOW_SIZE 131072,MAX_FRAME_SIZE 16384; a connection WINDOW_UPDATE of 12517377; pseudo-headers:method :path :authority :scheme; streams from 3;te: trailerson every request; and HEADERS that depend on the root, not exclusively, with a weight that follows the request (firefoxPriority(java.util.List<io.github.mahmoudimus.http2.HeaderField>)).static Frame.PrioritySpecfirefoxPriority(List<HeaderField> request) Firefox's HEADERS priority for a request: no dependency (stream 0, not exclusive) and the weight Firefox gives that kind of request, 22 less its internal priority.intReturns the value of thefirstStreamIdrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of theheadersPriorityrecord component.The local settings the profile advertises, applied to the protocol's defaults: the values a connection must then hold itself to (its decoder's table size, its stream windows).name()Returns the value of thenamerecord component.order(List<HeaderField> fields) fieldswith its request pseudo-headers in the profile's order, and the rest after them as they were.priority(List<HeaderField> request) The priority on a request's HEADERS.Returns the value of thepseudoHeaderOrderrecord component.settings()Returns the value of thesettingsrecord component.booleanReturns the value of theteTrailersrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Http2ClientProfile
public Http2ClientProfile(String name, Map<Integer, Long> settings, int connectionWindowIncrement, Http2ClientProfile.RequestPriority headersPriority, List<String> pseudoHeaderOrder, int firstStreamId, boolean teTrailers) Creates an instance of aHttp2ClientProfilerecord class.- Parameters:
name- the value for thenamerecord componentsettings- the value for thesettingsrecord componentconnectionWindowIncrement- the value for theconnectionWindowIncrementrecord componentheadersPriority- the value for theheadersPriorityrecord componentpseudoHeaderOrder- the value for thepseudoHeaderOrderrecord componentfirstStreamId- the value for thefirstStreamIdrecord componentteTrailers- the value for theteTrailersrecord component
-
Http2ClientProfile
public Http2ClientProfile(String name, Map<Integer, Long> settings, int connectionWindowIncrement, Frame.PrioritySpec headersPriority, List<String> pseudoHeaderOrder) A profile whose every request carriesheadersPriority, its first stream 1.
-
-
Method Details
-
priority
The priority on a request's HEADERS.- Parameters:
request- the request's header list- Returns:
- the priority, or null for none
-
chrome156
Chrome 156, as captured from 156.0.8078.48 (macOS): SETTINGSHEADER_TABLE_SIZE 65536,ENABLE_PUSH 0,INITIAL_WINDOW_SIZE 6291456,MAX_HEADER_LIST_SIZE 262144; a connection WINDOW_UPDATE of 15663105; HEADERS with an exclusive dependency on the root and weight 256; pseudo-headers:method :authority :scheme :path. Its Akamai fingerprint is1:65536;2:0;4:6291456;6:262144|15663105|0|m,a,s,p.- Returns:
- the profile
-
firefox159
Firefox 159, as captured from 159.0 (macOS): SETTINGSHEADER_TABLE_SIZE 65536,ENABLE_PUSH 0,INITIAL_WINDOW_SIZE 131072,MAX_FRAME_SIZE 16384; a connection WINDOW_UPDATE of 12517377; pseudo-headers:method :path :authority :scheme; streams from 3;te: trailerson every request; and HEADERS that depend on the root, not exclusively, with a weight that follows the request (firefoxPriority(java.util.List<io.github.mahmoudimus.http2.HeaderField>)). Its Akamai fingerprint is1:65536;2:0;4:131072;5:16384|12517377|0|m,p,a,s.- Returns:
- the profile
-
firefoxPriority
Firefox's HEADERS priority for a request: no dependency (stream 0, not exclusive) and the weight Firefox gives that kind of request, 22 less its internal priority. Measured from Firefox 159 loading a page (fingerprints/firefox-159/h2-page.txt): 42 for a document (sec-fetch-dest: document); for an image, 14 at urgency 4 (priority: u=4, i) and 12 at urgency 5; and 22 for the rest (stylesheets, scripts, fetches, and the favicon, an image at urgency 6).- Parameters:
request- the request's header list- Returns:
- the priority
-
localSettings
The local settings the profile advertises, applied to the protocol's defaults: the values a connection must then hold itself to (its decoder's table size, its stream windows).- Returns:
- the settings
- Throws:
IllegalArgumentException- if a value is not a valid setting
-
order
fieldswith its request pseudo-headers in the profile's order, and the rest after them as they were.- Parameters:
fields- a request's header list, pseudo-headers first- Returns:
- the reordered list
-
akamai
The Akamai HTTP/2 fingerprint of this profile's connections:SETTINGS|WINDOW_UPDATE|PRIORITY frames|pseudo-header order, with no PRIORITY frames.- Returns:
- the fingerprint, such as
1:65536;2:0;4:6291456;6:262144|15663105|0|m,a,s,p
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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 '=='. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
settings
Returns the value of thesettingsrecord component.- Returns:
- the value of the
settingsrecord component
-
connectionWindowIncrement
public int connectionWindowIncrement()Returns the value of theconnectionWindowIncrementrecord component.- Returns:
- the value of the
connectionWindowIncrementrecord component
-
headersPriority
Returns the value of theheadersPriorityrecord component.- Returns:
- the value of the
headersPriorityrecord component
-
pseudoHeaderOrder
Returns the value of thepseudoHeaderOrderrecord component.- Returns:
- the value of the
pseudoHeaderOrderrecord component
-
firstStreamId
public int firstStreamId()Returns the value of thefirstStreamIdrecord component.- Returns:
- the value of the
firstStreamIdrecord component
-
teTrailers
public boolean teTrailers()Returns the value of theteTrailersrecord component.- Returns:
- the value of the
teTrailersrecord component
-