Public Instance methods
upgrade_to_h2()
[show source]
# File lib/httpx/plugins/upgrade/h2.rb 25 def upgrade_to_h2 26 prev_parser = @parser 27 28 if prev_parser 29 prev_parser.reset 30 @inflight -= prev_parser.requests.size 31 end 32 33 @parser = Connection::HTTP2.new(@write_buffer, @options) 34 set_parser_callbacks(@parser) 35 @upgrade_protocol = "h2" 36 37 # what's happening here: 38 # a deviation from the state machine is done to perform the actions when a 39 # connection is closed, without transitioning, so the connection is kept in the pool. 40 # the state is reset to initial, so that the socket reconnect works out of the box, 41 # while the parser is already here. 42 purge_after_closed 43 transition(:idle) 44 45 prev_parser.requests.each do |req| 46 req.transition(:idle) 47 send(req) 48 end 49 end