Record Class Http2ClientProfile

java.lang.Object
java.lang.Record
io.github.mahmoudimus.http2.Http2ClientProfile
Record Components:
name - the profile's name, such as chrome-156
settings - the SETTINGS identifiers and values, in the order they are sent
connectionWindowIncrement - the connection WINDOW_UPDATE increment sent after SETTINGS, 0 for none
headersPriority - the RFC 7540 priority on a request's HEADERS, or null for none
pseudoHeaderOrder - the request pseudo-headers in the order they are sent
firstStreamId - 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 carries te: 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.
  • 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 a Http2ClientProfile record class.
      Parameters:
      name - the value for the name record component
      settings - the value for the settings record component
      connectionWindowIncrement - the value for the connectionWindowIncrement record component
      headersPriority - the value for the headersPriority record component
      pseudoHeaderOrder - the value for the pseudoHeaderOrder record component
      firstStreamId - the value for the firstStreamId record component
      teTrailers - the value for the teTrailers record component
    • Http2ClientProfile

      public Http2ClientProfile(String name, Map<Integer,Long> settings, int connectionWindowIncrement, Frame.PrioritySpec headersPriority, List<String> pseudoHeaderOrder)
      A profile whose every request carries headersPriority, its first stream 1.
  • Method Details

    • priority

      public Frame.PrioritySpec priority(List<HeaderField> request)
      The priority on a request's HEADERS.
      Parameters:
      request - the request's header list
      Returns:
      the priority, or null for none
    • chrome156

      public static Http2ClientProfile chrome156()
      Chrome 156, as captured from 156.0.8078.48 (macOS): SETTINGS HEADER_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 is 1:65536;2:0;4:6291456;6:262144|15663105|0|m,a,s,p.
      Returns:
      the profile
    • firefox159

      public static Http2ClientProfile firefox159()
      Firefox 159, as captured from 159.0 (macOS): SETTINGS HEADER_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: trailers on 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 is 1:65536;2:0;4:131072;5:16384|12517377|0|m,p,a,s.
      Returns:
      the profile
    • firefoxPriority

      public static Frame.PrioritySpec firefoxPriority(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. 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

      public Http2Settings 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

      public List<HeaderField> order(List<HeaderField> fields)
      fields with 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

      public String 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

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • settings

      public Map<Integer,Long> settings()
      Returns the value of the settings record component.
      Returns:
      the value of the settings record component
    • connectionWindowIncrement

      public int connectionWindowIncrement()
      Returns the value of the connectionWindowIncrement record component.
      Returns:
      the value of the connectionWindowIncrement record component
    • headersPriority

      public Http2ClientProfile.RequestPriority headersPriority()
      Returns the value of the headersPriority record component.
      Returns:
      the value of the headersPriority record component
    • pseudoHeaderOrder

      public List<String> pseudoHeaderOrder()
      Returns the value of the pseudoHeaderOrder record component.
      Returns:
      the value of the pseudoHeaderOrder record component
    • firstStreamId

      public int firstStreamId()
      Returns the value of the firstStreamId record component.
      Returns:
      the value of the firstStreamId record component
    • teTrailers

      public boolean teTrailers()
      Returns the value of the teTrailers record component.
      Returns:
      the value of the teTrailers record component