Copyright © 2007-2008 Basho Technologies
Authors: Justin Sheehy (justin@basho.com), Andy Gross (andy@basho.com).
Utilities for parsing, quoting, and negotiation.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.choose_charset/2 | Select the best fitting character set or 'none'. |
choose_encoding/2 | Select the best fitting encoding or 'none'. |
choose_media_type_accepted/2 | |
choose_media_type_provided/2 | Match the Accept request header with content_types_provided Return the Content-Type for the response. |
convert_request_date/1 | Parse the HTTP date (IMF-fixdate, rfc850, asctime). |
format_content_type/1 | |
is_media_type_accepted/2 | Match the Content-Type request header with content_types_accepted against. |
is_valid_header/1 | Check header valid characters, see https://www.ietf.org/rfc/rfc822.txt. |
is_valid_header_value/1 | Check if the given value is acceptaple for a http header value. |
normalize_content_type/1 | |
parse_header/1 | Parse a Content-Type like header, return the main Content-Type and a property list of options. |
parse_qs/1 | Parse an application/x-www-form-urlencoded string. |
quoted_string/1 | |
split_quoted_strings/1 | |
valid_location/1 | Check if the given location is safe to use as a location header. |
choose_charset(CSets::[binary()], AccCharHdr::binary()) -> binary() | none
Select the best fitting character set or 'none'
choose_encoding(Encs::[binary()], AccEncHdr::binary()) -> binary() | none
Select the best fitting encoding or 'none'
choose_media_type_accepted(ContentTypesAccepted::[cowmachine_req:media_type()], ReqHeader::cow_http_hd:media_type()) -> cowmachine_req:media_type()
choose_media_type_provided(Provided::list(), AcceptHead::binary()) -> cow_http_hd:media_type() | none
Match the Accept request header with content_types_provided Return the Content-Type for the response. If there is no acceptable/available match, return the atom 'none'. AcceptHead is the value of the request's Accept header Provided is a list of media types the controller can provide. each is either a binary e.g. -- <<"text/html">> or a binary and parameters e.g. -- {<<"text/html">>,[{<<"level">>,<<"1">>}]} or two binaries e.g. {<<"text">>, <<"html">>} or two binaries and parameters e.g. -- {<<"text">>,<<"html">>,[{<<"level">>,<<"1">>}]} (the plain string case with no parameters is much more common)
convert_request_date(Date::binary()) -> calendar:datetime()
Parse the HTTP date (IMF-fixdate, rfc850, asctime).
format_content_type(X1::cow_http_hd:media_type()) -> binary()
is_media_type_accepted(ContentTypesAccepted::list(), ReqHeader::cow_http_hd:media_type()) -> boolean()
Match the Content-Type request header with content_types_accepted against
is_valid_header(H::binary()) -> boolean()
Check header valid characters, see https://www.ietf.org/rfc/rfc822.txt
is_valid_header_value(X1::binary()) -> boolean()
Check if the given value is acceptaple for a http header value.
normalize_content_type(Type) -> any()
parse_header(String::binary()) -> {binary(), [{binary(), binary()}]}
Parse a Content-Type like header, return the main Content-Type and a property list of options.
parse_qs(Qs::binary()) -> [{binary(), binary()}]
Parse an application/x-www-form-urlencoded string.
quoted_string(Str::binary()) -> binary()
split_quoted_strings(Str::binary()) -> [binary()]
valid_location(Location::binary()) -> {true, binary()} | false
Check if the given location is safe to use as a location header. This is uses as a defense against urls with scripts. The test is quite strict and will drop values that might have been acceptable.
Generated by EDoc