Method: Protocol::HTTP2::Stream#send_data

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

#send_data(*args) ⇒ Object



293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/protocol/http2/stream.rb', line 293

def send_data(*args)
	if @state == :open
		frame = write_data(*args)
		
		if frame.end_stream?
			@state = :half_closed_local
		end
	elsif @state == :half_closed_remote
		frame = write_data(*args)
		
		if frame.end_stream?
			close!
		end
	else
		raise ProtocolError, "Cannot send data in state: #{@state}"
	end
end