HTTP::AnyUA::Util − Utility subroutines for HTTP::AnyUA backends and middleware
version 0.904
$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.
$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.
$headers = http_headers_to_native($http_headers);
Convert an HTTP::Headers object to a "native" hashref.
$normalized_headers = normalize_headers(\%headers);
Normalize headers. Currently lowercases header keys.
$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.
($scheme, $host, $port, $path_query, $auth) = split_url($url);
Split a URL into its components.
$http_date = http_date($epoch_time);
Convert an epoch time into a date format suitable for HTTP.
$epoch_time = parse_http_date($http_date);
Convert an HTTP date into an epoch time. Returns undef if the date cannot be parsed.
$escaped = uri_escape($unescaped);
Escape a string for use in a URL query param or as "application/x−www−form−urlencoded" data.
$bytes =
www_form_urlencode(\%form_data);
$bytes = www_form_urlencode(\@form_data);
Encode a hashref or arrayref as "application/x−www−form−urlencoded" data.
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.
Charles McGarvey <[email protected]>
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.