Class: HTTPX::Plugins::H2C::H2CParser

Inherits:
Connection::HTTP2 show all
Defined in:
lib/httpx/plugins/h2c.rb

Constant Summary

Constants inherited from Connection::HTTP2

Connection::HTTP2::Error

Constants included from Loggable

Loggable::COLORS

Instance Attribute Summary

Attributes inherited from Connection::HTTP2

#pending, #streams

Instance Method Summary collapse

Methods inherited from Connection::HTTP2

#<<, #close, #consume, #empty?, #handle_error, #initialize, #reenqueue!, #send

Methods included from Loggable

#log, #log_exception

Methods included from Callbacks

#emit, #on, #once

Constructor Details

This class inherits a constructor from HTTPX::Connection::HTTP2

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class HTTPX::Connection::HTTP2

Instance Method Details

#upgrade(request, response) ⇒ Object


69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/httpx/plugins/h2c.rb', line 69

def upgrade(request, response)
  @connection.send_connection_preface  # skip checks, it is assumed that this is the first
  # request in the connection

  stream = @connection.upgrade
  handle_stream(stream, request)
  @streams[request] = stream

  # clean up data left behind in the buffer, if the server started
  # sending frames
  data = response.to_s
  @connection << data
end