?????????? ????????? - ??????????????? - /home/agenciai/public_html/cd38d8/perl-HTTP-Tiny.zip
???????
PK ��!\ː�� � CONTRIBUTING.mkdnnu �[��� ## HOW TO CONTRIBUTE Thank you for considering contributing to this distribution. This file contains instructions that will help you work with the source code. The distribution is managed with Dist::Zilla. This means than many of the usual files you might expect are not in the repository, but are generated at release time, as is much of the documentation. Some generated files are kept in the repository as a convenience (e.g. Makefile.PL or cpanfile). Generally, **you do not need Dist::Zilla to contribute patches**. You do need Dist::Zilla to create a tarball. See below for guidance. ### Getting dependencies If you have App::cpanminus 1.6 or later installed, you can use `cpanm` to satisfy dependencies like this: $ cpanm --installdeps . Otherwise, look for either a `Makefile.PL` or `cpanfile` file for a list of dependencies to satisfy. ### Running tests You can run tests directly using the `prove` tool: $ prove -l $ prove -lv t/some_test_file.t For most of my distributions, `prove` is entirely sufficient for you to test any patches you have. I use `prove` for 99% of my testing during development. ### Code style and tidying Please try to match any existing coding style. If there is a `.perltidyrc` file, please install Perl::Tidy and use perltidy before submitting patches. If there is a `tidyall.ini` file, you can also install Code::TidyAll and run `tidyall` on a file or `tidyall -a` to tidy all files. ### Patching documentation Much of the documentation Pod is generated at release time. Some is generated boilerplate; other documentation is built from pseudo-POD directives in the source like C<=method> or C<=func>. If you would like to submit a documentation edit, please limit yourself to the documentation you see. If you see typos or documentation issues in the generated docs, please email or open a bug ticket instead of patching. ### Installing and using Dist::Zilla Dist::Zilla is a very powerful authoring tool, optimized for maintaining a large number of distributions with a high degree of automation, but it has a large dependency chain, a bit of a learning curve and requires a number of author-specific plugins. To install it from CPAN, I recommend one of the following approaches for the quickest installation: # using CPAN.pm, but bypassing non-functional pod tests $ cpan TAP::Harness::Restricted $ PERL_MM_USE_DEFAULT=1 HARNESS_CLASS=TAP::Harness::Restricted cpan Dist::Zilla # using cpanm, bypassing *all* tests $ cpanm -n Dist::Zilla In either case, it's probably going to take about 10 minutes. Go for a walk, go get a cup of your favorite beverage, take a bathroom break, or whatever. When you get back, Dist::Zilla should be ready for you. Then you need to install any plugins specific to this distribution: $ cpan `dzil authordeps` $ dzil authordeps | cpanm Once installed, here are some dzil commands you might try: $ dzil build $ dzil test $ dzil xtest You can learn more about Dist::Zilla at http://dzil.org/ PK ��!\w�r{B B Changesnu �[��� Release notes for HTTP-Tiny 0.076 2018-08-05 21:07:38-04:00 America/New_York - No changes from 0.075-TRIAL. 0.075 2018-08-01 07:03:36-04:00 America/New_York (TRIAL RELEASE) [CHANGED] - The 'peer' option now also can take a code reference 0.074 2018-07-30 15:35:44-04:00 America/New_York - No changes from 0.073-TRIAL. 0.073 2018-07-24 11:33:53-04:00 America/New_York (TRIAL RELEASE) 0.071 never made it to CPAN; skipping to 0.073 [DOCS] - Documented 'protocol' field in response hash. 0.071 2018-04-22 14:45:43+02:00 Europe/Oslo (TRIAL RELEASE) [DOCS] - Documented that method argument to request() is case-sensitive. [INTERNAL] - Minor regex cleanup - Updated .travis.yml for recent Perls 0.070 2016-10-09 23:23:28-04:00 America/New_York - No changes from 0.069-TRIAL. 0.069 2016-10-05 11:35:58-04:00 America/New_York (TRIAL RELEASE) [INTERNAL] - Lazy load Carp only if needed. 0.068 2016-09-23 16:10:03-04:00 America/New_York - No changes from 0.067-TRIAL. 0.067 2016-09-14 11:43:14-04:00 America/New_York (TRIAL RELEASE) [FIXED] - Includes redirect history when issuing a 599 internal error. 0.065 2016-09-09 22:42:43-04:00 America/New_York (TRIAL RELEASE) [TESTS] - Try harder to clean up environment in t/140_proxy.t (needed for VMS) 0.064 2016-08-16 21:37:51-04:00 America/New_York - No changes from 0.063-TRIAL 0.063 2016-08-08 12:18:03-04:00 America/New_York (TRIAL RELEASE) [FIXED] - Fixed chunked transfer encoding, which previously omitted a trailing CRLF. 0.061 2016-08-05 12:10:19-04:00 America/New_York (TRIAL RELEASE) [FIXED] - Avoid overwriting 'If-Modified-Since' header in mirror() if the header already exists in something other than lower-case. [TESTS] - Normalize CRLF when reading test data files in t\150-post_form.t on Win32 0.059 2016-07-29 16:10:32-04:00 America/New_York (TRIAL RELEASE) [FIXED] - Timeout can now be set as a constructor argument again. - CVE-2016-1238: avoid loading optional modules from @INC path with `.` at the end. [TESTS] - Updated tests for a future perl which may omit `.` from the list of directories in @INC by default. 0.058 2016-05-03 11:29:57-04:00 America/New_York - No changes from 0.057 0.057 2016-04-18 10:17:00-04:00 America/New_York (TRIAL RELEASE) [ADDED] - Added support for the SSL_CERT_FILE environment variable. - Added 'peer' attribute to force a connection to a particular server. - Added 'connected' method to allow introspection of persistent connections. - An array reference of redirection result hash references is included in the final response hash reference (but only if redirects occur). [CHANGED] - Because folded headers are obsoleted in the revised RFCs, if CRLF is found in header values followed by one or more spaces, they are all replaced by a single space. [FIXED] - Per the RFC, control headers are now sent first before other headers (which are sent in arbitrary order). - Only well-known headers have their case canonicalized; all other headers are sent in the case provided by the user. - The 'keep_alive' option now also sets the SO_KEEPALIVE option on the underlying socket to help with long-lived, idle connections. - Request header field values are now validated against the RFC rules (i.e. empty or else space-or-tab separated tokens of printable characters). 0.056 2015-05-19 06:00:40-04:00 America/New_York - No changes from 0.055 0.055 2015-05-07 18:13:41-04:00 America/New_York (TRIAL RELEASE) [ADDED] - Added 'can_ssl' method to detect SSL support before trying and failing with a fatal exception. - Added support for 308 redirects [FIXED] - When specifying a custom CA file, if that file is missing or unreadable, HTTP::Tiny will no longer fall back to a default CA [DOCUMENTED] - Noted units are bytes for max_size 0.054 2015-01-27 07:18:19-05:00 America/New_York [ADDED] - Added more fallback paths to find CA files (thanks golang) [DOCUMENTED] - Fixed a typo 0.053 2014-12-11 23:42:17-05:00 America/New_York [FIXED] - Defended tests against HTTP_PROXY set in the environment 0.052 2014-12-11 15:23:54-05:00 America/New_York [CHANGED] - Proxy allowed from environment variable HTTP_PROXY (uppercase) unless REQUEST_METHOD is also set. 0.051 2014-11-17 22:58:44-05:00 America/New_York [FIXED] - Checks for threads without loading threads.pm 0.050 2014-09-23 15:30:18-04:00 America/New_York [FIXED] - Fixed CONNECT requests for some proxies 0.049 2014-09-02 11:20:07-04:00 America/New_York [FIXED] - 'keep_alive' is now fork-safe and thread-safe 0.048 2014-08-21 13:19:51-04:00 America/New_York [FIXED] - Protected proxy tests from ALL_PROXY in the environment 0.047 2014-07-29 14:09:05-04:00 America/New_York [CHANGED] - Updated Mozilla::CA module recommendation version to 20130114 [FIXED] - Fixed t/00-report-prereqs.t when CPAN::Meta is not installed 0.046 2014-07-21 10:32:32-04:00 America/New_York [FIXED] - Empty header fields are now allowed; headers with the 'undef' value will be rendered as an empty header. [DOCUMENTED] - Updated HTTP/1.1 spec description from RFC 2616 to RFC 7230-7235 0.045 2014-07-19 23:17:28-04:00 America/New_York (TRIAL RELEASE) [FIXED] - Fixed t/002_croakage.t for various operating systems. 0.044 2014-07-16 23:46:09-04:00 America/New_York [CHANGED] - Providing a custom 'Host' header is now a fatal exception. Previously, it was silently ignored, as the RFC mandates that Host be set from the URL, but ignoring it could lead to unexpected, confusing errors. - optimized URL splitting - Passing 'undef' for any proxy attribute will prevent HTTP::Tiny from setting the proxy from the environment. 0.043 2014-02-20 20:40:23-05:00 America/New_York [FIXED] - Does not send absolute request URI when tunneling SSL via proxy - Fixes regression in setting host name to verify SSL - Protects tests from https_proxy and all_proxy when doing mock testing 0.042 2014-02-18 11:23:17EST-0500 America/New_York [ADDED] - If IO::Socket::IP 0.25+ is installed, HTTP::Tiny will use it for transparent IPv4 or IPv6 support. 0.041 2014-02-17 13:07:54-05:00 America/New_York [no code change, only an amended Changes file] [INCOMPATIBLE CHANGES (from 0.039)] - The 'proxy' attribute no longer takes precedence over the 'http_proxy' environment variable. With the addition of http_proxy and https_proxy attributes (and corresponding environment variable defaults), the legacy 'proxy' attribute now maps to the all_proxy/ALL_PROXY environment variable and only takes effect when other proxy attributes are not defined. [ADDED (since 0.039)] - Added 'keep_alive' attribute for single-server persistent connections (Clinton Gormley) - Added support for Basic authorization with proxies - Added support for https proxies via CONNECT [FIXED (since 0.039)] - Requests are made with one less write for lower latency (Martin Evans) 0.040 2014-02-17 13:02:47-05:00 America/New_York [INCOMPATIBLE CHANGES] - The 'proxy' attribute no longer takes precedence over the 'http_proxy' environment variable. With the addition of http_proxy and https_proxy attributes (and corresponding environment variable defaults), the legacy 'proxy' attribute now maps to the all_proxy/ALL_PROXY environment variable and only takes effect when other proxy attributes are not defined. [ADDED] - Added support for Basic authorization with proxies - Added support for https proxies via CONNECT 0.039 2013-11-27 19:48:29 America/New_York [FIXED] - Temporary file creating during mirror() is now opened with O_EXCL for added security 0.038 2013-11-18 12:56:26 America/New_York [FIXED] - Fixed a bug where authentication parameters in the URL would override an existing Authorization header 0.037 2013-10-28 13:26:21 America/New_York [FIXED] - Basic authentication in the URL is now unescaped before being encoded into the authentication header [DOCUMENTED] - Added HTTP::Tiny::UA to SEE ALSO and suggested it as the appropriate place for new features 0.036 2013-09-25 12:10:06 America/New_York [FIXED] - Compile test could hang on Windows [PREREQS] - Dropped configure_requires for ExtUtils::MakeMaker to 6.17 [META] - Updated support files 0.035 2013-09-10 12:29:28 America/New_York [CHANGED] - Encoded from data from 'post_form' preserves term order if data is provided as an array reference. (They are still sorted for consistency if provided as a hash reference.) 0.034 2013-06-26 19:02:25 America/New_York [ADDED] - Added support for 'Basic' authorization from user:password parameters in the URL 0.033 2013-06-21 06:26:51 America/New_York [FIXED] - Modifying the 'agent' attribute with the accessor will append the default agent string, just like setting it during construction 0.032 2013-06-20 11:41:24 America/New_York [ADDED] - Added 'no_proxy' attribute, defaulting to $ENV{no_proxy} 0.031 2013-06-16 23:18:18 America/New_York [FIXED] - Fixed bug receiving 0-length content bodies 0.030 2013-06-13 11:46:15 America/New_York [FIXED] - Requests with the empty string as body content no longer generate 'content-type' and 'content-length' headers. 0.029 2013-04-17 13:49:07 America/New_York [FIXED] - Checks for new enough OpenSSL library before using SNI (otherwise IO::Socket::SSL throws warnings) 0.028 2013-03-05 14:11:57 America/New_York [SUPPORT] - Fix repository/issue links to reflect proper repo name 0.027 2013-03-05 12:02:58 America/New_York [SUPPORT] - Changed metadata to point to the chansen github repository for code and issues [DOCUMENTATION] - Added hyperlink for HTTP::CookieJar 0.026 2013-03-04 22:53:39 America/New_York [ADDED] - Added cookie support if an HTTP::CookieJar object is provided in the 'cookie_jar' attribute [Edward Zborowski] 0.025 2012-12-26 12:09:43 America/New_York [ADDED] - Agent string appends default if it ends in a space, just like LWP [Chris Weyl] 0.024 2012-10-09 20:44:53 America/New_York [ADDED] - SSL connections now auto-retry I/O after SSL renegotiation [Alan Gardner] [FIXED] - User-specified CA bundles take precedence over Mozilla::CA [Alan Gardner] [PREREQS] - SSL support now requires Net::SSLeay 1.49 or greater to support auto-retry [Mike Doherty] - Downgraded IO::Socket::SSL and related prereqs to 'suggests' again 0.023 2012-09-19 09:55:46 America/New_York [PREREQS] - IO::Socket::SSL and related prereqs changed to 'required' for dev release to get better failure diagnostics from CPAN Testers [TESTING] - Skip live SSL testing unless IO::Socket::SSL 1.56+ installed 0.022 2012-06-01 23:31:40 America/New_York [ADDED] - Supports local_address option to set local socket interface [Chris Nehren, David Golden] 0.021 2012-05-15 22:38:57 America/New_York [TESTING] - Skip live SSL testing if $ENV{http_proxy} is set 0.020 2012-05-14 15:24:37 America/New_York [TESTING] - Capture prerequisite versions under AUTOMATED_TESTING to help chase down some failures from CPAN Testers 0.019 2012-05-14 07:14:00 America/New_York [ADDED] - Require IO::Socket::SSL 1.56 (which added SSL_hostname support) when doing HTTPS. [Mike Doherty] [TESTING] - Provide better diagnostic output in t/210_live_ssl.t [Mike Doherty] 0.018 2012-04-18 09:39:50 America/New_York [ADDED] - Add verify_SSL option to do more secure SSL operations, incl. attempting to validate against a CA bundle (Mozilla::CA recommended, but will attempt to find some OS bundles). Also add SSL_opts, which passes through IO::Socket::SSL's SSL_* options to control SSL verification. (GH #6, #9) [Mike Doherty] - Reponse hashref includes final URL (including any redirections) [Lukas Eklund] 0.017 2012-02-22 21:57:37 EST5EDT [DOCUMENTATION] - Clarified how max_size exceptions work [rt.cpan.org #75142] - Clarify that 2XX is success for most methods (except mirror where 304 is also success) [rt.cpan.org #75141] 0.016 2011-10-26 23:05:50 America/New_York [BUG FIXES] - Fixed Perl 5.6 compatibility by emulating utf8::encode [David Golden] 0.015 2011-10-26 16:42:26 America/New_York [BUG FIXES] - Make sure PERL_UNICODE doesn't affect PUT test data [Tony Cook] [DOCUMENTATION] - Fixed typo 0.014 2011-10-20 13:54:13 America/New_York [NEW FEATURES] - Adds additional shorthand methods for all common HTTP verbs (HEAD, PUT, POST, DELETE) [David Golden] - post_form() method for POST-ing x-www-form-urlencoded data [David Golden] - www_form_urlencode() utility method [David Golden] 0.013 2011-07-17 23:14:22 America/New_York [NEW FEATURES] - $ENV{http_proxy} support added [Claes Jakobsson] [OTHER] - Internal/private errors converted from "croak" to "die" as internal errors are caught by "eval" 0.012 2011-03-31 15:48:02 America/New_York [BUG FIXES] - mirror() now uses binmode during output (RT #67118) [Serguei Trouchelle] [DOCUMENTATION] - noted that SSL certificates are not verified against CA's (RT #66907) 0.011 2011-03-19 20:48:39 America/New_York [BUG FIXES] - Made t/000_load.t less verbose under harness (RT#65507) [Dave Mitchell] - Removed 'Errno' as an explicit prefix (it is a core module, but not indexed by PAUSE, which might confuse some installers) 0.010 2011-02-04 02:45:31 EST5EDT [BUG FIXES] - Fixed test errors on VMS (RT#65430) [Craig Berry] 0.009 2011-01-17 16:29:22 EST5EDT - Added workaround for IO::Socket::SSL certificate verification bug - Minor documentation improvements - POST example added to the eg/ directory in the distribution tarball 0.008 2011-01-14 06:34:55 EST5EDT - Added support for direct 'https' connections if IO::Socket::SSL is installed - Added support for a callback to provide trailing headers for chunked transfer encoding - Data callbacks receive the response hashref as a second argument for greater flexibility - Additional limitations documented 0.007 2011-01-12 04:56:16 EST5EDT - Added support for redirecting 303 and 307 response codes - Retry (once) a request that fails due to a closed socket (per RFC2616 8.1.4) - Automatically sets request Content-Type to 'application/octet-stream' if there is content the user has not defined its type - Trailing headers from chunked transfer encoding are now merged into the response headers instead of ignored - Improved handling of malformed or unsupported HTTP protocols - Expanded http:///.../ as http://localhost/.../ and set Host header - Documented that URL's must be escaped/encoded - Documented that the headers hash option may contain an array reference to output multiple values of the same header field - Improved documentation of limitations - Added numerous new tests to ensure compliance with the HTTP/1.1 spec 0.006 2011-01-10 07:28:11 EST5EDT - Transfer-Encodings are case insensitive - Add additional test for proper behavior when both Content-Length and Transfer-Encoding headers are received 0.005 2011-01-08 06:32:05 EST5EDT - Fixed bug getting content for servers which do not sent Content-Length - Add test coverage for get(), mirror() and request() - Add test coverage for requests with static and generated content 0.004 2010-12-15 22:53:59 EST5EDT - Renamed 'ok' response field to 'success' - Handle all required HTTP/1.1 date formats - Documented how callbacks are supposed to work 0.003 2010-12-15 12:30:42 EST5EDT - Added 'ok' response field to simplify checking success - Added a 'mirror' method mirror content to a file, but shortcut if not modified 0.002 2010-12-13 21:59:39 EST5EDT - Added some initial documentation - Skips utf8::* code on Perls older than 5.8 0.001 2010-12-11 07:59:16 EST5EDT - Initial CPAN release # vim: ts=2 sts=2 sw=2 et: PK ��!\���8 8 eg/post.plnu �[��� #!/usr/bin/perl use strict; use warnings; use HTTP::Tiny; use URI::Escape qw/uri_escape_utf8/; my $url = 'http://search.cpan.org/search'; my %form_data = ( query => 'DAGOLDEN', mode => 'author', ); my @params; while( my @pair = each %form_data ) { push @params, join("=", map { uri_escape_utf8($_) } @pair); } my $response = HTTP::Tiny->new->request('POST', $url, { content => join("&", @params), headers => { 'content-type' => 'application/x-www-form-urlencoded' } }); print "$response->{status} $response->{reason}\n"; print $response->{content}; PK ��!\��J� � eg/mirror.plnu �[��� #!/usr/bin/perl use strict; use warnings; use HTTP::Tiny; my $url = shift(@ARGV) || 'http://example.com'; my $file = shift(@ARGV) || 'example.output'; my $response = HTTP::Tiny->new->mirror($url, $file); print "$response->{status} $response->{reason}\n"; while (my ($k, $v) = each %{$response->{headers}}) { for (ref $v eq 'ARRAY' ? @$v : $v) { print "$k: $_\n"; } } PK ��!\s�Cp� � eg/get.plnu �[��� #!/usr/bin/perl use strict; use warnings; use HTTP::Tiny; my $url = shift(@ARGV) || 'http://example.com'; my $response = HTTP::Tiny->new->get($url); print "$response->{status} $response->{reason}\n"; while (my ($k, $v) = each %{$response->{headers}}) { for (ref $v eq 'ARRAY' ? @$v : $v) { print "$k: $_\n"; } } print $response->{content} if length $response->{content}; PK ��!\D��@X @X READMEnu �[��� NAME HTTP::Tiny - A small, simple, correct HTTP/1.1 client VERSION version 0.076 SYNOPSIS use HTTP::Tiny; my $response = HTTP::Tiny->new->get('http://example.com/'); die "Failed!\n" unless $response->{success}; print "$response->{status} $response->{reason}\n"; while (my ($k, $v) = each %{$response->{headers}}) { for (ref $v eq 'ARRAY' ? @$v : $v) { print "$k: $_\n"; } } print $response->{content} if length $response->{content}; DESCRIPTION This is a very simple HTTP/1.1 client, designed for doing simple requests without the overhead of a large framework like LWP::UserAgent. It is more correct and more complete than HTTP::Lite. It supports proxies and redirection. It also correctly resumes after EINTR. If IO::Socket::IP 0.25 or later is installed, HTTP::Tiny will use it instead of IO::Socket::INET for transparent support for both IPv4 and IPv6. Cookie support requires HTTP::CookieJar or an equivalent class. METHODS new $http = HTTP::Tiny->new( %attributes ); This constructor returns a new HTTP::Tiny object. Valid attributes include: * "agent" — A user-agent string (defaults to 'HTTP-Tiny/$VERSION'). If "agent" — ends in a space character, the default user-agent string is appended. * "cookie_jar" — An instance of HTTP::CookieJar — or equivalent class that supports the "add" and "cookie_header" methods * "default_headers" — A hashref of default headers to apply to requests * "local_address" — The local IP address to bind to * "keep_alive" — Whether to reuse the last connection (if for the same scheme, host and port) (defaults to 1) * "max_redirect" — Maximum number of redirects allowed (defaults to 5) * "max_size" — Maximum response size in bytes (only when not using a data callback). If defined, responses larger than this will return an exception. * "http_proxy" — URL of a proxy server to use for HTTP connections (default is $ENV{http_proxy} — if set) * "https_proxy" — URL of a proxy server to use for HTTPS connections (default is $ENV{https_proxy} — if set) * "proxy" — URL of a generic proxy server for both HTTP and HTTPS connections (default is $ENV{all_proxy} — if set) * "no_proxy" — List of domain suffixes that should not be proxied. Must be a comma-separated string or an array reference. (default is $ENV{no_proxy} —) * "timeout" — Request timeout in seconds (default is 60) If a socket open, read or write takes longer than the timeout, an exception is thrown. * "verify_SSL" — A boolean that indicates whether to validate the SSL certificate of an "https" — connection (default is false) * "SSL_options" — A hashref of "SSL_*" — options to pass through to IO::Socket::SSL Passing an explicit "undef" for "proxy", "http_proxy" or "https_proxy" will prevent getting the corresponding proxies from the environment. Exceptions from "max_size", "timeout" or other errors will result in a pseudo-HTTP status code of 599 and a reason of "Internal Exception". The content field in the response will contain the text of the exception. The "keep_alive" parameter enables a persistent connection, but only to a single destination scheme, host and port. Also, if any connection-relevant attributes are modified, or if the process ID or thread ID change, the persistent connection will be dropped. If you want persistent connections across multiple destinations, use multiple HTTP::Tiny objects. See "SSL SUPPORT" for more on the "verify_SSL" and "SSL_options" attributes. get|head|put|post|delete $response = $http->get($url); $response = $http->get($url, \%options); $response = $http->head($url); These methods are shorthand for calling "request()" for the given method. The URL must have unsafe characters escaped and international domain names encoded. See "request()" for valid options and a description of the response. The "success" field of the response will be true if the status code is 2XX. post_form $response = $http->post_form($url, $form_data); $response = $http->post_form($url, $form_data, \%options); This method executes a "POST" request and sends the key/value pairs from a form data hash or array reference to the given URL with a "content-type" of "application/x-www-form-urlencoded". If data is provided as an array reference, the order is preserved; if provided as a hash reference, the terms are sorted on key and value for consistency. See documentation for the "www_form_urlencode" method for details on the encoding. The URL must have unsafe characters escaped and international domain names encoded. See "request()" for valid options and a description of the response. Any "content-type" header or content in the options hashref will be ignored. The "success" field of the response will be true if the status code is 2XX. mirror $response = $http->mirror($url, $file, \%options) if ( $response->{success} ) { print "$file is up to date\n"; } Executes a "GET" request for the URL and saves the response body to the file name provided. The URL must have unsafe characters escaped and international domain names encoded. If the file already exists, the request will include an "If-Modified-Since" header with the modification timestamp of the file. You may specify a different "If-Modified-Since" header yourself in the "$options->{headers}" hash. The "success" field of the response will be true if the status code is 2XX or if the status code is 304 (unmodified). If the file was modified and the server response includes a properly formatted "Last-Modified" header, the file modification time will be updated accordingly. request $response = $http->request($method, $url); $response = $http->request($method, $url, \%options); Executes an HTTP request of the given method type ('GET', 'HEAD', 'POST', 'PUT', etc.) on the given URL. The URL must have unsafe characters escaped and international domain names encoded. NOTE: Method names are case-sensitive per the HTTP/1.1 specification. Don't use "get" when you really want "GET". See LIMITATIONS for how this applies to redirection. If the URL includes a "user:password" stanza, they will be used for Basic-style authorization headers. (Authorization headers will not be included in a redirected request.) For example: $http->request('GET', 'http://Aladdin:open sesame@example.com/'); If the "user:password" stanza contains reserved characters, they must be percent-escaped: $http->request('GET', 'http://john%40example.com:password@example.com/'); A hashref of options may be appended to modify the request. Valid options are: * "headers" — A hashref containing headers to include with the request. If the value for a header is an array reference, the header will be output multiple times with each value in the array. These headers over-write any default headers. * "content" — A scalar to include as the body of the request OR a code reference that will be called iteratively to produce the body of the request * "trailer_callback" — A code reference that will be called if it exists to provide a hashref of trailing headers (only used with chunked transfer-encoding) * "data_callback" — A code reference that will be called for each chunks of the response body received. * "peer" — Override host resolution and force all connections to go only to a specific peer address, regardless of the URL of the request. This will include any redirections! This options should be used with extreme caution (e.g. debugging or very special circumstances). It can be given as either a scalar or a code reference that will receive the hostname and whose response will be taken as the address. The "Host" header is generated from the URL in accordance with RFC 2616. It is a fatal error to specify "Host" in the "headers" option. Other headers may be ignored or overwritten if necessary for transport compliance. If the "content" option is a code reference, it will be called iteratively to provide the content body of the request. It should return the empty string or undef when the iterator is exhausted. If the "content" option is the empty string, no "content-type" or "content-length" headers will be generated. If the "data_callback" option is provided, it will be called iteratively until the entire response body is received. The first argument will be a string containing a chunk of the response body, the second argument will be the in-progress response hash reference, as described below. (This allows customizing the action of the callback based on the "status" or "headers" received prior to the content body.) The "request" method returns a hashref containing the response. The hashref will have the following keys: * "success" — Boolean indicating whether the operation returned a 2XX status code * "url" — URL that provided the response. This is the URL of the request unless there were redirections, in which case it is the last URL queried in a redirection chain * "status" — The HTTP status code of the response * "reason" — The response phrase returned by the server * "content" — The body of the response. If the response does not have any content or if a data callback is provided to consume the response body, this will be the empty string * "headers" — A hashref of header fields. All header field names will be normalized to be lower case. If a header is repeated, the value will be an arrayref; it will otherwise be a scalar string containing the value * "protocol" - If this field exists, it is the protocol of the response such as HTTP/1.0 or HTTP/1.1 * "redirects" If this field exists, it is an arrayref of response hash references from redirects in the same order that redirections occurred. If it does not exist, then no redirections occurred. On an exception during the execution of the request, the "status" field will contain 599, and the "content" field will contain the text of the exception. www_form_urlencode $params = $http->www_form_urlencode( $data ); $response = $http->get("http://example.com/query?$params"); This method converts the key/value pairs from a data hash or array reference into a "x-www-form-urlencoded" string. The keys and values from the data reference will be UTF-8 encoded and escaped per RFC 3986. If a value is an array reference, the key will be repeated with each of the values of the array reference. If data is provided as a hash reference, the key/value pairs in the resulting string will be sorted by key and value for consistent ordering. can_ssl $ok = HTTP::Tiny->can_ssl; ($ok, $why) = HTTP::Tiny->can_ssl; ($ok, $why) = $http->can_ssl; Indicates if SSL support is available. When called as a class object, it checks for the correct version of Net::SSLeay and IO::Socket::SSL. When called as an object methods, if "SSL_verify" is true or if "SSL_verify_mode" is set in "SSL_options", it checks that a CA file is available. In scalar context, returns a boolean indicating if SSL is available. In list context, returns the boolean and a (possibly multi-line) string of errors indicating why SSL isn't available. connected $host = $http->connected; ($host, $port) = $http->connected; Indicates if a connection to a peer is being kept alive, per the "keep_alive" option. In scalar context, returns the peer host and port, joined with a colon, or "undef" (if no peer is connected). In list context, returns the peer host and port or an empty list (if no peer is connected). Note: This method cannot reliably be used to discover whether the remote host has closed its end of the socket. SSL SUPPORT Direct "https" connections are supported only if IO::Socket::SSL 1.56 or greater and Net::SSLeay 1.49 or greater are installed. An exception will be thrown if new enough versions of these modules are not installed or if the SSL encryption fails. You can also use "HTTP::Tiny::can_ssl()" utility function that returns boolean to see if the required modules are installed. An "https" connection may be made via an "http" proxy that supports the CONNECT command (i.e. RFC 2817). You may not proxy "https" via a proxy that itself requires "https" to communicate. SSL provides two distinct capabilities: * Encrypted communication channel * Verification of server identity By default, HTTP::Tiny does not verify server identity. Server identity verification is controversial and potentially tricky because it depends on a (usually paid) third-party Certificate Authority (CA) trust model to validate a certificate as legitimate. This discriminates against servers with self-signed certificates or certificates signed by free, community-driven CA's such as CAcert.org <http://cacert.org>. By default, HTTP::Tiny does not make any assumptions about your trust model, threat level or risk tolerance. It just aims to give you an encrypted channel when you need one. Setting the "verify_SSL" attribute to a true value will make HTTP::Tiny verify that an SSL connection has a valid SSL certificate corresponding to the host name of the connection and that the SSL certificate has been verified by a CA. Assuming you trust the CA, this will protect against a man-in-the-middle attack <http://en.wikipedia.org/wiki/Man-in-the-middle_attack>. If you are concerned about security, you should enable this option. Certificate verification requires a file containing trusted CA certificates. If the environment variable "SSL_CERT_FILE" is present, HTTP::Tiny will try to find a CA certificate file in that location. If the Mozilla::CA module is installed, HTTP::Tiny will use the CA file included with it as a source of trusted CA's. (This means you trust Mozilla, the author of Mozilla::CA, the CPAN mirror where you got Mozilla::CA, the toolchain used to install it, and your operating system security, right?) If that module is not available, then HTTP::Tiny will search several system-specific default locations for a CA certificate file: * /etc/ssl/certs/ca-certificates.crt * /etc/pki/tls/certs/ca-bundle.crt * /etc/ssl/ca-bundle.pem An exception will be raised if "verify_SSL" is true and no CA certificate file is available. If you desire complete control over SSL connections, the "SSL_options" attribute lets you provide a hash reference that will be passed through to "IO::Socket::SSL::start_SSL()", overriding any options set by HTTP::Tiny. For example, to provide your own trusted CA file: SSL_options => { SSL_ca_file => $file_path, } The "SSL_options" attribute could also be used for such things as providing a client certificate for authentication to a server or controlling the choice of cipher used for the SSL connection. See IO::Socket::SSL documentation for details. PROXY SUPPORT HTTP::Tiny can proxy both "http" and "https" requests. Only Basic proxy authorization is supported and it must be provided as part of the proxy URL: "http://user:pass@proxy.example.com/". HTTP::Tiny supports the following proxy environment variables: * http_proxy or HTTP_PROXY * https_proxy or HTTPS_PROXY * all_proxy or ALL_PROXY If the "REQUEST_METHOD" environment variable is set, then this might be a CGI process and "HTTP_PROXY" would be set from the "Proxy:" header, which is a security risk. If "REQUEST_METHOD" is set, "HTTP_PROXY" (the upper case variant only) is ignored. Tunnelling "https" over an "http" proxy using the CONNECT method is supported. If your proxy uses "https" itself, you can not tunnel "https" over it. Be warned that proxying an "https" connection opens you to the risk of a man-in-the-middle attack by the proxy server. The "no_proxy" environment variable is supported in the format of a comma-separated list of domain extensions proxy should not be used for. Proxy arguments passed to "new" will override their corresponding environment variables. LIMITATIONS HTTP::Tiny is *conditionally compliant* with the HTTP/1.1 specifications <http://www.w3.org/Protocols/>: * "Message Syntax and Routing" [RFC7230] * "Semantics and Content" [RFC7231] * "Conditional Requests" [RFC7232] * "Range Requests" [RFC7233] * "Caching" [RFC7234] * "Authentication" [RFC7235] It attempts to meet all "MUST" requirements of the specification, but does not implement all "SHOULD" requirements. (Note: it was developed against the earlier RFC 2616 specification and may not yet meet the revised RFC 7230-7235 spec.) Some particular limitations of note include: * HTTP::Tiny focuses on correct transport. Users are responsible for ensuring that user-defined headers and content are compliant with the HTTP/1.1 specification. * Users must ensure that URLs are properly escaped for unsafe characters and that international domain names are properly encoded to ASCII. See URI::Escape, URI::_punycode and Net::IDN::Encode. * Redirection is very strict against the specification. Redirection is only automatic for response codes 301, 302, 307 and 308 if the request method is 'GET' or 'HEAD'. Response code 303 is always converted into a 'GET' redirection, as mandated by the specification. There is no automatic support for status 305 ("Use proxy") redirections. * There is no provision for delaying a request body using an "Expect" header. Unexpected "1XX" responses are silently ignored as per the specification. * Only 'chunked' "Transfer-Encoding" is supported. * There is no support for a Request-URI of '*' for the 'OPTIONS' request. * Headers mentioned in the RFCs and some other, well-known headers are generated with their canonical case. Other headers are sent in the case provided by the user. Except for control headers (which are sent first), headers are sent in arbitrary order. Despite the limitations listed above, HTTP::Tiny is considered feature-complete. New feature requests should be directed to HTTP::Tiny::UA. SEE ALSO * HTTP::Tiny::UA - Higher level UA features for HTTP::Tiny * HTTP::Thin - HTTP::Tiny wrapper with HTTP::Request/HTTP::Response compatibility * HTTP::Tiny::Mech - Wrap WWW::Mechanize instance in HTTP::Tiny compatible interface * IO::Socket::IP - Required for IPv6 support * IO::Socket::SSL - Required for SSL support * LWP::UserAgent - If HTTP::Tiny isn't enough for you, this is the "standard" way to do things * Mozilla::CA - Required if you want to validate SSL certificates * Net::SSLeay - Required for SSL support SUPPORT Bugs / Feature Requests Please report any bugs or feature requests through the issue tracker at <https://github.com/chansen/p5-http-tiny/issues>. You will be notified automatically of any progress on your issue. Source Code This is open source software. The code repository is available for public review and contribution under the terms of the license. <https://github.com/chansen/p5-http-tiny> git clone https://github.com/chansen/p5-http-tiny.git AUTHORS * Christian Hansen <chansen@cpan.org> * David Golden <dagolden@cpan.org> CONTRIBUTORS * Alan Gardner <gardner@pythian.com> * Alessandro Ghedini <al3xbio@gmail.com> * A. Sinan Unur <nanis@cpan.org> * Brad Gilbert <bgills@cpan.org> * brian m. carlson <sandals@crustytoothpaste.net> * Chris Nehren <apeiron@cpan.org> * Chris Weyl <cweyl@alumni.drew.edu> * Claes Jakobsson <claes@surfar.nu> * Clinton Gormley <clint@traveljury.com> * Craig A. Berry <craigberry@mac.com> * Craig Berry <cberry@cpan.org> * David Golden <xdg@xdg.me> * David Mitchell <davem@iabyn.com> * Dean Pearce <pearce@pythian.com> * Edward Zborowski <ed@rubensteintech.com> * Felipe Gasper <felipe@felipegasper.com> * James Raspass <jraspass@gmail.com> * Jeremy Mates <jmates@cpan.org> * Jess Robinson <castaway@desert-island.me.uk> * Karen Etheridge <ether@cpan.org> * Lukas Eklund <leklund@gmail.com> * Martin J. Evans <mjegh@ntlworld.com> * Martin-Louis Bright <mlbright@gmail.com> * Mike Doherty <doherty@cpan.org> * Nicolas Rochelemagne <rochelemagne@cpanel.net> * Olaf Alders <olaf@wundersolutions.com> * Olivier Mengué <dolmen@cpan.org> * Petr Písař <ppisar@redhat.com> * Serguei Trouchelle <stro@cpan.org> * Shoichi Kaji <skaji@cpan.org> * SkyMarshal <skymarshal1729@gmail.com> * Sören Kornetzki <soeren.kornetzki@delti.com> * Steve Grazzini <steve.grazzini@grantstreet.com> * Syohei YOSHIDA <syohex@gmail.com> * Tatsuhiko Miyagawa <miyagawa@bulknews.net> * Tom Hukins <tom@eborcom.com> * Tony Cook <tony@develop-help.com> COPYRIGHT AND LICENSE This software is copyright (c) 2018 by Christian Hansen. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. PK ��!\ː�� � CONTRIBUTING.mkdnnu �[��� PK ��!\w�r{B B * Changesnu �[��� PK ��!\���8 8 {N eg/post.plnu �[��� PK ��!\��J� � �P eg/mirror.plnu �[��� PK ��!\s�Cp� � �R eg/get.plnu �[��� PK ��!\D��@X @X uT READMEnu �[��� PK � �
| ver. 1.6 |
Github
|
.
| PHP 8.2.30 | ??????????? ?????????: 0 |
proxy
|
phpinfo
|
???????????