Method: Protocol::HTTP2::Connection#read_frame

Defined in:
lib/protocol/http2/connection.rb

#read_frameObject



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/protocol/http2/connection.rb', line 108

def read_frame
	frame = @framer.read_frame(@local_settings.maximum_frame_size)
	# puts "#{self.class} #{@state} read_frame: class=#{frame.class} flags=#{frame.flags} length=#{frame.length}"
	# puts "Windows: local_window=#{@local_window.inspect}; remote_window=#{@remote_window.inspect}"
	
	yield frame if block_given?
	
	frame.apply(self)
	
	return frame
rescue ProtocolError => error
	send_goaway(error.code || PROTOCOL_ERROR, error.message)
	
	raise
rescue HPACK::CompressionError => error
	send_goaway(COMPRESSION_ERROR, error.message)
	
	raise
rescue
	send_goaway(PROTOCOL_ERROR, $!.message)
	
	raise
end