Package io.github.mahmoudimus.http3
Record Class HeaderField
java.lang.Object
java.lang.Record
io.github.mahmoudimus.http3.HeaderField
- Record Components:
name- the field name, one char per octetvalue- the field value, one char per octetsensitive- the field was, or must be, sent as a literal with the 'N' (never-indexed) bit set (RFC 9204 §4.5.4): an intermediary must forward it as a literal with the bit set, so that it never enters a compression context
One header or trailer field (a name and a value) as QPACK carries it. Names and values are
octet strings; they are held as Strings with one char per octet (ISO-8859-1), so no input is
lost and none is reinterpreted.
Http3Headers checks which octets HTTP allows.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe per-entry overhead QPACK adds to the octet lengths of name and value (RFC 9204 §3.2.1). -
Constructor Summary
ConstructorsConstructorDescriptionHeaderField(String name, String value) Creates a field that may enter a compression context.HeaderField(String name, String value, boolean sensitive) Creates a field. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.name()Returns the value of thenamerecord component.booleanReturns the value of thesensitiverecord component.intsize()The size QPACK and SETTINGS_MAX_FIELD_SECTION_SIZE count for this field: name + value + 32.toString()Returns a string representation of this record class.value()Returns the value of thevaluerecord component.
-
Field Details
-
ENTRY_OVERHEAD
public static final int ENTRY_OVERHEADThe per-entry overhead QPACK adds to the octet lengths of name and value (RFC 9204 §3.2.1).- See Also:
-
-
Constructor Details
-
HeaderField
Creates a field.- Parameters:
name- the field name, one char per octetvalue- the field value, one char per octetsensitive- whether the field is sent as a never-indexed literal
-
HeaderField
Creates a field that may enter a compression context.- Parameters:
name- the field name, one char per octetvalue- the field value, one char per octet
-
-
Method Details
-
size
public int size()The size QPACK and SETTINGS_MAX_FIELD_SECTION_SIZE count for this field: name + value + 32.- Returns:
- the size in octets
-
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
-
value
Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-
sensitive
public boolean sensitive()Returns the value of thesensitiverecord component.- Returns:
- the value of the
sensitiverecord component
-