NAME
HTTP::AnyUA::Util - Utility subroutines for HTTP::AnyUA backends and middleware
VERSION
version 0.904
FUNCTIONS
coderef_content_to_string
$content = coderef_content_to_string(\&code);
$content = coderef_content_to_string($content); # noop
Convert a coderef into a string of content by iteratively calling the coderef and concatenating the chunks it provides until the coderef returns undef or an empty string.
native_to_http_request
$http_request = native_to_http_request($method, $url);
$http_request = native_to_http_request($method, $url, \%options);
Convert a "native" request tuple to an HTTP::Request object.
http_headers_to_native
$headers = http_headers_to_native($http_headers);
Convert an HTTP::Headers object to a "native" hashref.
normalize_headers
$normalized_headers = normalize_headers(\%headers);
Normalize headers. Currently lowercases header keys.
internal_exception
$response = internal_exception($content);
$response = internal_exception($content, $response);
Create an internal exception response. If an existing response is passed, that response will have its fields modified to become an internal exception.
split_url
($scheme, $host, $port, $path_query, $auth) = split_url($url);
Split a URL into its components.
http_date
$http_date = http_date($epoch_time);
Convert an epoch time into a date format suitable for HTTP.
parse_http_date
$epoch_time = parse_http_date($http_date);
Convert an HTTP date into an epoch time. Returns undef if the date cannot be parsed.
uri_escape
$escaped = uri_escape($unescaped);
Escape a string for use in a URL query param or as application/x-www-form-urlencoded
data.
www_form_urlencode
$bytes = www_form_urlencode(\%form_data);
$bytes = www_form_urlencode(\@form_data);
Encode a hashref or arrayref as application/x-www-form-urlencoded
data.
BUGS
Please report any bugs or feature requests on the bugtracker website https://github.com/chazmcgarvey/HTTP-AnyUA/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
AUTHOR
Charles McGarvey <chazmcgarvey@brokenzipper.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2019 by Charles McGarvey.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.