Class: EventMachine::HttpResponseHeader

### Home Classes Methods

### In Files

- lib/em-http/http_header.rb

### Parent

Hash

### Methods

- #[]
- #chunked_encoding?
- #client_error?
- #compressed?
- #content_length
- #cookie
- #etag
- #informational?
- #keepalive?
- #last_modified
- #location
- #redirection?
- #server_error?
- #status
- #successful?

### Class/Module Index

Quicksearch

- EventMachine
- EventMachine::HTTPMethods
- EventMachine::HttpClient
- EventMachine::HttpClient::CookieJar
- EventMachine::HttpConnection
- EventMachine::HttpDecoders
- EventMachine::HttpDecoders::Base
- EventMachine::HttpDecoders::DecoderError
- EventMachine::HttpDecoders::Deflate
- EventMachine::HttpDecoders::GZip
- EventMachine::HttpDecoders::GZipHeader
- EventMachine::HttpEncoding
- EventMachine::HttpRequest
- EventMachine::HttpResponseHeader
- EventMachine::HttpStatus
- EventMachine::HttpStubConnection
- EventMachine::Middleware
- EventMachine::Middleware::DigestAuth
- EventMachine::Middleware::JSONResponse
- EventMachine::Middleware::OAuth
- EventMachine::Middleware::OAuth2
- EventMachine::MultiRequest
- HttpClientOptions
- HttpConnectionOptions
- String

No matching classes.

# EventMachine::HttpResponseHeader

A simple hash is returned for each request made by HttpClient with the headers that were given by the server for that request.

### Attributes

http_reason[RW]

The reason returned in the http response ("OK","File not found",etc.)

http_status[RW]

The status code (as a string!)

http_version[RW]

The HTTP version returned.

raw[RW]

Raw headers

### Public Instance Methods

[](key) click to toggle source

    # File lib/em-http/http_header.rb, line 59
    def [](key)
      super(key) || super(key.upcase.gsub('-','_'))
    end

chunked_encoding?() click to toggle source

Is the transfer encoding chunked?

    # File lib/em-http/http_header.rb, line 43
    def chunked_encoding?
      /chunked/ === self[HttpClient::TRANSFER_ENCODING]
    end

client_error?() click to toggle source

    # File lib/em-http/http_header.rb, line 75
    def client_error?
      400 <= status && 500 > status
    end

compressed?() click to toggle source

    # File lib/em-http/http_header.rb, line 51
    def compressed?
      /gzip|compressed|deflate/ === self[HttpClient::CONTENT_ENCODING]
    end

content_length() click to toggle source

Length of content as an integer, or nil if chunked/unspecified

    # File lib/em-http/http_header.rb, line 32
    def content_length
      @content_length ||= ((s = self[HttpClient::CONTENT_LENGTH]) &&
                           (s =~ /^(\d+)$/)) ? $1.to_i : nil
    end

cookie() click to toggle source

Cookie header from the server

    # File lib/em-http/http_header.rb, line 38
    def cookie
      self[HttpClient::SET_COOKIE]
    end

etag() click to toggle source

E-Tag

    # File lib/em-http/http_header.rb, line 18
    def etag
      self[HttpClient::ETAG]
    end

informational?() click to toggle source

    # File lib/em-http/http_header.rb, line 63
    def informational?
      100 <= status && 200 > status
    end

keepalive?() click to toggle source

    # File lib/em-http/http_header.rb, line 47
    def keepalive?
      /keep-alive/ === self[HttpClient::KEEP_ALIVE]
    end

last_modified() click to toggle source

    # File lib/em-http/http_header.rb, line 22
    def last_modified
      self[HttpClient::LAST_MODIFIED]
    end

location() click to toggle source

    # File lib/em-http/http_header.rb, line 55
    def location
      self[HttpClient::LOCATION]
    end

redirection?() click to toggle source

    # File lib/em-http/http_header.rb, line 71
    def redirection?
      300 <= status && 400 > status
    end

server_error?() click to toggle source

    # File lib/em-http/http_header.rb, line 79
    def server_error?
      500 <= status && 600 > status
    end

status() click to toggle source

HTTP response status as an integer

    # File lib/em-http/http_header.rb, line 27
    def status
      @status ||= Integer(http_status) rescue 0
    end

successful?() click to toggle source

    # File lib/em-http/http_header.rb, line 67
    def successful?
      200 <= status && 300 > status
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.