Class: HTTP::Response::Parser

### Home Classes Methods

### In Files

- lib/http/response/parser.rb

### Parent

Object

### Methods

- ::new
- #<<
- #add
- #chunk
- #finished?
- #headers?
- #http_version
- #on_body
- #on_headers_complete
- #on_message_complete
- #reset
- #status_code

### Class/Module Index

Quicksearch

- HTTP
- HTTP::Cache
- HTTP::Cache::Headers
- HTTP::Cache::NullCache
- HTTP::Cache::NullLogger
- HTTP::CacheError
- HTTP::Chainable
- HTTP::Client
- HTTP::Connection
- HTTP::Error
- HTTP::Headers
- HTTP::Headers::Mixin
- HTTP::InvalidHeaderNameError
- HTTP::MimeType
- HTTP::MimeType::Adapter
- HTTP::MimeType::JSON
- HTTP::Options
- HTTP::Redirector
- HTTP::Redirector::EndlessRedirectError
- HTTP::Redirector::TooManyRedirectsError
- HTTP::Request
- HTTP::Request::Caching
- HTTP::Request::UnsupportedMethodError
- HTTP::Request::UnsupportedSchemeError
- HTTP::Request::Writer
- HTTP::RequestError
- HTTP::Response
- HTTP::Response::Body
- HTTP::Response::Caching
- HTTP::Response::IoBody
- HTTP::Response::Parser
- HTTP::Response::Status
- HTTP::Response::StringBody
- HTTP::ResponseError
- HTTP::StateError
- HTTP::Timeout
- HTTP::Timeout::Global
- HTTP::Timeout::Null
- HTTP::Timeout::PerOperation
- HTTP::TimeoutError
- HTTP::URI
- Object

No matching classes.

# HTTP::Response::Parser

### Attributes

headers[R]

### Public Class Methods

new() click to toggle source

    # File lib/http/response/parser.rb, line 6
    def initialize
      @parser = HTTP::Parser.new(self)
      reset
    end

### Public Instance Methods

<<(data) click to toggle source
Alias for: add
add(data) click to toggle source

    # File lib/http/response/parser.rb, line 11
    def add(data)
      @parser << data
    end

Also aliased as: <<
chunk() click to toggle source

    # File lib/http/response/parser.rb, line 44
    def chunk
      chunk, @chunk = @chunk, nil
      chunk
    end

finished?() click to toggle source

    # File lib/http/response/parser.rb, line 61
    def finished?
      @finished
    end

headers?() click to toggle source

    # File lib/http/response/parser.rb, line 16
    def headers?
      !!@headers
    end

http_version() click to toggle source

    # File lib/http/response/parser.rb, line 20
    def http_version
      @parser.http_version.join(".")
    end

on_body(chunk) click to toggle source

    # File lib/http/response/parser.rb, line 36
    def on_body(chunk)
      if @chunk
        @chunk << chunk
      else
        @chunk = chunk
      end
    end

on_headers_complete(headers) click to toggle source

HTTP::Parser callbacks

    # File lib/http/response/parser.rb, line 32
    def on_headers_complete(headers)
      @headers = headers
    end

on_message_complete() click to toggle source

    # File lib/http/response/parser.rb, line 49
    def on_message_complete
      @finished = true
    end

reset() click to toggle source

    # File lib/http/response/parser.rb, line 53
    def reset
      @parser.reset!

      @finished = false
      @headers  = nil
      @chunk    = nil
    end

status_code() click to toggle source

    # File lib/http/response/parser.rb, line 24
    def status_code
      @parser.status_code
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.