Class: HTTP::Protocol::HTTP2::PriorityFrame

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

Overview

The PRIORITY frame specifies the sender-advised priority of a stream. It can be sent in any stream state, including idle or closed streams.

-————————————————————-+ |E| Stream Dependency (31) | -————------------------------------------------------ | Weight (8) | -————-+

Constant Summary collapse

TYPE =
0x2

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, parse_header, #read, #read_header, #set_flags, #to_ary, #write, #write_header, #write_payload

Constructor Details

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

Instance Method Details

#apply(connection) ⇒ Object



68
69
70
# File 'lib/http/protocol/http2/priority_frame.rb', line 68

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

#pack(priority) ⇒ Object



60
61
62
# File 'lib/http/protocol/http2/priority_frame.rb', line 60

def pack priority
	super priority.pack
end

#priorityObject



56
57
58
# File 'lib/http/protocol/http2/priority_frame.rb', line 56

def priority
	Priority.unpack(@payload)
end

#read_payload(stream) ⇒ Object



72
73
74
75
76
77
78
# File 'lib/http/protocol/http2/priority_frame.rb', line 72

def read_payload(stream)
	super
	
	if @length != 5
		raise FrameSizeError, "Invalid frame length"
	end
end

#unpackObject



64
65
66
# File 'lib/http/protocol/http2/priority_frame.rb', line 64

def unpack
	Priority.unpack(super)
end