Class: SiteHub::HttpHeaders
- Inherits:
-
Hash
- Object
- Hash
- SiteHub::HttpHeaders
- Includes:
- Constants, Constants::HttpHeaderKeys
- Defined in:
- lib/sitehub/http_headers.rb
Constant Summary collapse
- HTTP_PREFIX =
/^HTTP_/- RACK_HTTP_HEADER_ID =
/#{HTTP_PREFIX.source}[A-Z_]+$/- EXCLUDED_HEADERS =
[CONNECTION_HEADER, KEEP_ALIVE, PROXY_CONNECTION, PROXY_AUTHENTICATE, PROXY_AUTHORIZATION, TE, TRAILERS, TRANSFER_ENCODING, CONTENT_ENCODING, UPGRADE].freeze
Constants included from Constants::HttpHeaderKeys
Constants::HttpHeaderKeys::CONNECTION_HEADER, Constants::HttpHeaderKeys::CONTENT_ENCODING, Constants::HttpHeaderKeys::CONTENT_LENGTH, Constants::HttpHeaderKeys::HOST_HEADER, Constants::HttpHeaderKeys::KEEP_ALIVE, Constants::HttpHeaderKeys::LOCATION_HEADER, Constants::HttpHeaderKeys::PROXY_AUTHENTICATE, Constants::HttpHeaderKeys::PROXY_AUTHORIZATION, Constants::HttpHeaderKeys::PROXY_CONNECTION, Constants::HttpHeaderKeys::SET_COOKIE, Constants::HttpHeaderKeys::TE, Constants::HttpHeaderKeys::TRAILERS, Constants::HttpHeaderKeys::TRANSACTION_ID, Constants::HttpHeaderKeys::TRANSFER_ENCODING, Constants::HttpHeaderKeys::UPGRADE, Constants::HttpHeaderKeys::X_FORWARDED_FOR_HEADER, Constants::HttpHeaderKeys::X_FORWARDED_HOST_HEADER
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(env) ⇒ HttpHeaders
constructor
A new instance of HttpHeaders.
Constructor Details
#initialize(env) ⇒ HttpHeaders
Returns a new instance of HttpHeaders.
45 46 47 48 49 50 51 |
# File 'lib/sitehub/http_headers.rb', line 45 def initialize(env) env.each do |key, value| self[key.to_s.downcase] = value end filter_prohibited_headers end |
Class Method Details
.from_rack_env(env) ⇒ Object
7 8 9 |
# File 'lib/sitehub/http_headers.rb', line 7 def from_rack_env(env) new(format_keys(remove_rack_specific_headers(env.dup))) end |