| 1 |
NAME |
| 2 |
|
| 3 |
HTTP::Tinyish - HTTP::Tiny compatible HTTP client wrappers |
| 4 |
|
| 5 |
SYNOPSIS |
| 6 |
|
| 7 |
my $http = HTTP::Tinyish->new(agent => "Mozilla/4.0"); |
| 8 |
|
| 9 |
my $res = $http->get("http://www.cpan.org/"); |
| 10 |
warn $res->{status}; |
| 11 |
|
| 12 |
$http->post("http://example.com/post", { |
| 13 |
headers => { "Content-Type" => "application/x-www-form-urlencoded" }, |
| 14 |
content => "foo=bar&baz=quux", |
| 15 |
}); |
| 16 |
|
| 17 |
$http->mirror("http://www.cpan.org/modules/02packages.details.txt.gz", "./02packages.details.txt.gz"); |
| 18 |
|
| 19 |
DESCRIPTION |
| 20 |
|
| 21 |
HTTP::Tinyish is a wrapper module for HTTP client modules LWP, |
| 22 |
HTTP::Tiny and HTTP client software curl and wget. |
| 23 |
|
| 24 |
It provides an API compatible to HTTP::Tiny, and the implementation has |
| 25 |
been extracted out of App::cpanminus. This module can be useful in a |
| 26 |
restrictive environment where you need to be able to download CPAN |
| 27 |
modules without an HTTPS support in built-in HTTP library. |
| 28 |
|
| 29 |
BACKEND SELECTION |
| 30 |
|
| 31 |
Backends are searched in the order of: LWP, HTTP::Tiny, curl and wget. |
| 32 |
HTTP::Tinyish will auto-detect if the backend also supports HTTPS, and |
| 33 |
use the appropriate backend based on the given URL to the request |
| 34 |
methods. |
| 35 |
|
| 36 |
For example, if you only have HTTP::Tiny but without SSL related |
| 37 |
modules, it is possible that: |
| 38 |
|
| 39 |
my $http = HTTP::Tinyish->new; |
| 40 |
|
| 41 |
$http->get("http://example.com"); # uses HTTP::Tiny |
| 42 |
$http->get("https://example.com"); # uses curl |
| 43 |
|
| 44 |
COMPATIBILITIES |
| 45 |
|
| 46 |
All request related methods such as get, post, put, delete, request, |
| 47 |
patch and mirror are supported. |
| 48 |
|
| 49 |
LWP |
| 50 |
|
| 51 |
* LWP backend requires LWP 5.802 or over to be functional, and |
| 52 |
LWP::Protocol::https to send HTTPS requests. |
| 53 |
|
| 54 |
* mirror method doesn't consider third options hash into account |
| 55 |
(i.e. you can't override the HTTP headers). |
| 56 |
|
| 57 |
* proxy is automatically detected from environment variables. |
| 58 |
|
| 59 |
* timeout, max_redirect, agent, default_headers and verify_SSL are |
| 60 |
translated. |
| 61 |
|
| 62 |
HTTP::Tiny |
| 63 |
|
| 64 |
Because the actual HTTP::Tiny backend is used, all APIs are supported. |
| 65 |
|
| 66 |
Curl |
| 67 |
|
| 68 |
* This module has been tested with curl 7.22 and later. |
| 69 |
|
| 70 |
* HTTPS support is automatically detected by running curl --version |
| 71 |
and see its protocol output. |
| 72 |
|
| 73 |
* timeout, max_redirect, agent, default_headers and verify_SSL are |
| 74 |
supported. |
| 75 |
|
| 76 |
Wget |
| 77 |
|
| 78 |
* This module requires Wget 1.12 and later. |
| 79 |
|
| 80 |
* Wget prior to 1.15 doesn't support sending custom HTTP methods, so |
| 81 |
if you use $http->put for example, you'll get an internal error |
| 82 |
response (599). |
| 83 |
|
| 84 |
* HTTPS support is automatically detected. |
| 85 |
|
| 86 |
* mirror() method doesn't send If-Modified-Since header to the |
| 87 |
server, which will result in full-download every time because wget |
| 88 |
doesn't support --timestamping combined with -O option. |
| 89 |
|
| 90 |
* timeout, max_redirect, agent, default_headers and verify_SSL are |
| 91 |
supported. |
| 92 |
|
| 93 |
SIMILAR MODULES |
| 94 |
|
| 95 |
* File::Fetch - is core since 5.10. Has support for non-HTTP |
| 96 |
protocols such as ftp and git. Does not support HTTPS or basic |
| 97 |
authentication as of this writing. |
| 98 |
|
| 99 |
* Plient - provides more complete runtime API, but seems only |
| 100 |
compatible on Unix environments. Does not support mirror() method. |
| 101 |
|
| 102 |
AUTHOR |
| 103 |
|
| 104 |
Tatsuhiko Miyagawa |
| 105 |
|
| 106 |
COPYRIGHT |
| 107 |
|
| 108 |
Tatsuhiko Miyagawa, 2015- |
| 109 |
|
| 110 |
LICENSE |
| 111 |
|
| 112 |
This module is licensed under the same terms as Perl itself. |
| 113 |
|