class 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.

Public Instance Methods

chunked_encoding?() click to toggle source

Is the transfer encoding chunked?

# File lib/em-http/client.rb, line 50
def chunked_encoding?
  /chunked/ === self[HttpClient::TRANSFER_ENCODING]
end
compressed?() click to toggle source
# File lib/em-http/client.rb, line 58
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/client.rb, line 39
def content_length
  @content_length ||= ((s = self[HttpClient::CONTENT_LENGTH]) &&
                       (s =~ /^(\d+)$/)) ? $1.to_i : nil
end
etag() click to toggle source

E-Tag

# File lib/em-http/client.rb, line 25
def etag
  self[HttpClient::ETAG]
end
keep_alive?() click to toggle source
# File lib/em-http/client.rb, line 54
def keep_alive?
  /keep-alive/ === self[HttpClient::KEEP_ALIVE]
end
last_modified() click to toggle source
# File lib/em-http/client.rb, line 29
def last_modified
  self[HttpClient::LAST_MODIFIED]
end
location() click to toggle source
# File lib/em-http/client.rb, line 62
def location
  self[HttpClient::LOCATION]
end
status() click to toggle source

HTTP response status as an integer

# File lib/em-http/client.rb, line 34
def status
  Integer(http_status) rescue 0
end