class LLHttp::Parser
Call ‘LLHttp::Parser#reset` to reset the parser for the next request or response.
Resetting
Call `LLHttp::Parser#finish` when processing is complete for the current request or response.
Finishing
* `LLHttp::Parser#keep_alive?` returns `true` if there might be more messages.
* `LLHttp::Parser#http_minor` returns the minor http version of the current request/response.
* `LLHttp::Parser#http_major` returns the major http version of the current request/response.
* `LLHttp::Parser#status_code` returns the status code of the current response.
* `LLHttp::Parser#method_name` returns the method name of the current response.
* `LLHttp::Parser#content_length` returns the content length of the current request.
Introspection
…
parser.finish
parser << “GET / HTTP/1.1rnrn”
parser = LLHttp::Parser.new(Delegate.new, type: :request)
end
…
end
…
def on_message_begin
class Delegate < LLHttp::Delegate<br><br> Wraps an llhttp context for parsing http requests and responses.
def initialize(delegate, type: :both)
def initialize(delegate, type: :both) @type, @delegate = type.to_sym, delegate llhttp_init(LLHTTP_TYPES.fetch(@type)) end