Sha256: da107f3c9f87bdc6afaf4c945ca894c38265378106ac829890f7f257abbb2dee
Contents?: true
Size: 1022 Bytes
Versions: 1
Compression:
Stored size: 1022 Bytes
Contents
module HTTP class Response class Parser attr_reader :headers def initialize @parser = Http::Parser.new(self) reset end def add(data) @parser << data end alias_method :<<, :add def headers? !!@headers end def http_version @parser.http_version.join(".") end def status_code @parser.status_code end # # Http::Parser callbacks # def on_headers_complete(headers) @headers = headers end def on_body(chunk) if @chunk @chunk << chunk else @chunk = chunk end end def chunk if (chunk = @chunk) @chunk = nil chunk end end def on_message_complete @finished = true end def reset @finished = false @headers = nil @chunk = nil end def finished? @finished end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
http-0.5.0.pre | lib/http/response_parser.rb |