Module

HTTPHeader

Header module.

Provides access to @header in the mixed-into class as a hash-like object, except with case-insensitive keys. Also provides methods for accessing commonly-used header values in a more convenient format.

Public Methods
[] Returns the header field corresponding to the case-insensitive key. For example, a key of "Content-Type" might return "text/html"
[]= Sets the header field corresponding to the case-insensitive key.
add_field [Ruby 1.8.3] Adds header field instead of replace. Second argument val must be a String. See also #[]=, #[] and #get_fields.
basic_auth Set the Authorization: header for "Basic" authorization.
canonical_each Alias for #each_capitalized
chunked? Returns "true" if the "transfer-encoding" header is present and set to "chunked". This is an HTTP/1.1 feature, allowing the the content to be sent in "chunks" without at the outset stating the entire content length.
content_length Returns an Integer object which represents the Content-Length: header field or nil if that field is not provided.
content_length=
content_range Returns a Range object which represents Content-Range: header field. This indicates, for a partial entity body, where this fragment fits inside the full entity body, as range of byte offsets.
content_type Returns a content type string such as "text/html". This method returns nil if Content-Type: header field does not exist.
content_type= Alias for #set_content_type
delete Removes a header field.
each Alias for #each_header
each_capitalized As for #each_header, except the keys are provided in capitalized form.
each_capitalized_name Iterates for each capitalized header names.
each_header Iterates for each header names and values.
each_key Alias for #each_name
each_name Iterates for each header names.
each_value Iterates for each header values.
fetch Returns the header field corresponding to the case-insensitive key. Returns the default value args, or the result of the block, or nil, if there’s no header field named key. See Hash#fetch
form_data= Alias for #set_form_data
get_fields [Ruby 1.8.3] Returns an array of header field strings corresponding to the case-insensitive key. This method allows you to get duplicated header fields without any processing. See also #[].
initialize_http_header
key? true if key header exists.
length Alias for #size
main_type Returns a content type string such as "text". This method returns nil if Content-Type: header field does not exist.
proxy_basic_auth Set Proxy-Authorization: header for "Basic" authorization.
range Returns an Array of Range objects which represents Range: header field, or nil if there is no such header.
range= Alias for #set_range
range_length The length of the range represented in Content-Range: header.
set_content_type Set Content-Type: header field by type and params. type must be a String, params must be a Hash.
set_form_data Set header fields and a body from HTML form data. params should be a Hash containing HTML form data. Optional argument sep means data record separator.
set_range Set Range: header from Range (arg r) or beginning index and length from it (arg idx&len).
size
sub_type Returns a content type string such as "html". This method returns nil if Content-Type: header field does not exist or sub-type is not given (e.g. "Content-Type: text").
to_hash Returns a Hash consist of header names and values.
type_params Returns content type parameters as a Hash as like {"charset" => "iso-2022-jp"}.
Private Methods
basic_encode
capitalize
urlencode
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.