Class: Protocol::HTTP2::PriorityUpdateFrame

Inherits:
Frame
  • Object
show all
Defined in:
lib/protocol/http2/priority_update_frame.rb

Overview

The PRIORITY_UPDATE frame is used by clients to signal the initial priority of a response, or to reprioritize a response or push stream. It carries the stream ID of the response and the priority in ASCII text, using the same representation as the Priority header field value.

-————------------------------------------------------ |R| Prioritized Stream ID (31) | -—————————–------------------------------- | Priority Field Value (*) … ---------------------------------------------------------------

Constant Summary collapse

TYPE =
0x10
FORMAT =
"N".freeze

Constants inherited from Frame

Frame::HEADER_FORMAT, Frame::LENGTH_HISHIFT, Frame::LENGTH_LOMASK, Frame::STREAM_ID_MASK, Frame::VALID_LENGTH, Frame::VALID_STREAM_ID

Instance Attribute Summary

Attributes inherited from Frame

#flags, #length, #payload, #stream_id, #type

Instance Method Summary collapse

Methods inherited from Frame

#<=>, #clear_flags, #connection?, #flag_set?, #header, #initialize, #inspect, parse_header, #read, #read_header, #read_payload, #set_flags, #to_ary, #valid_type?, #write, #write_header, #write_payload

Constructor Details

This class inherits a constructor from Protocol::HTTP2::Frame

Instance Method Details

#apply(connection) ⇒ Object

Apply this PRIORITY_UPDATE frame to a connection for processing.



44
45
46
# File 'lib/protocol/http2/priority_update_frame.rb', line 44

def apply(connection)
	connection.receive_priority_update(self)
end

#pack(prioritized_stream_id, data, **options) ⇒ Object

Pack the prioritized stream ID and priority field value into the frame.



38
39
40
# File 'lib/protocol/http2/priority_update_frame.rb', line 38

def pack(prioritized_stream_id, data, **options)
	super([prioritized_stream_id].pack(FORMAT) + data, **options)
end

#unpackObject

Unpack the prioritized stream ID and priority field value.



26
27
28
29
30
31
32
# File 'lib/protocol/http2/priority_update_frame.rb', line 26

def unpack
	data = super
	
	prioritized_stream_id = data.unpack1(FORMAT)
	
	return prioritized_stream_id, data.byteslice(4, data.bytesize - 4)
end