A simple hash is returned for each request made by HttpClient with the headers that were given by the server for that request.
The reason returned in the http response (“OK”,“File not found”,etc.)
The status code (as a string!)
The HTTP version returned.
Raw headers
# File lib/em-http/http_header.rb, line 59 def [](key) super(key) || super(key.upcase.gsub('-','_')) end
Is the transfer encoding chunked?
# File lib/em-http/http_header.rb, line 43 def chunked_encoding? /chunked/ === self[HttpClient::TRANSFER_ENCODING] end
# File lib/em-http/http_header.rb, line 51 def compressed? /gzip|compressed|deflate/ === self[HttpClient::CONTENT_ENCODING] end
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
E-Tag
# File lib/em-http/http_header.rb, line 18 def etag self[HttpClient::ETAG] end
# File lib/em-http/http_header.rb, line 47 def keepalive? /keep-alive/ === self[HttpClient::KEEP_ALIVE] end
# File lib/em-http/http_header.rb, line 22 def last_modified self[HttpClient::LAST_MODIFIED] end
# File lib/em-http/http_header.rb, line 55 def location self[HttpClient::LOCATION] end
HTTP response status as an integer
# File lib/em-http/http_header.rb, line 27 def status Integer(http_status) rescue 0 end