AnyEvent-HTTP

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

	- work around a perl core bug not properly refcounting function arguments,
          causing "200 OK" with random body results (reported by Дмитрий Шалашов).

1.1  Thu Oct 30 04:46:27 CET 2008
	- work around different behaviour of AnyEvent::Handle in TLS mode.
	- cleanup cookie implementation, many examples and comments were
          provided by Дмитрий Шалашов.
        - document the return values of http_* functions better.
        - separate multiple header values by "," not "\x00" (this does not
          break correctly written users of the old API).
        - improve Set-Cookie: parsing.
        - add experimental https-over-http-proxy support.
        - downgrade https-over-https proxy to https-over-http.
        - ignore spurious CR characters in headers, they show up
          in the weirdest of places.
        - ucfirst the request headers, for a slightly less weird look.
        - work around (some) memleaks in perl regarding qr.

1.05 Mon Sep 29 15:49:58 CEST 2008
	- fix a regex when parsing cookie domains
          (patch by Дмитрий Шалашов).

HTTP.pm  view on Meta::CPAN

other retries and so on, and how often to do so.

Only redirects to http and https URLs are supported. While most common
redirection forms are handled entirely within this module, some require
the use of the optional L<URI> module. If it is required but missing, then
the request will fail with an error.

=item headers => hashref

The request headers to use. Currently, C<http_request> may provide its own
C<Host:>, C<Content-Length:>, C<Connection:> and C<Cookie:> headers and
will provide defaults at least for C<TE:>, C<Referer:> and C<User-Agent:>
(this can be suppressed by using C<undef> for these headers in which case
they won't be sent at all).

You really should provide your own C<User-Agent:> header value that is
appropriate for your program - I wouldn't be surprised if the default
AnyEvent string gets blocked by webservers sooner or later.

Also, make sure that your headers names and values do not contain any
embedded newlines.

HTTP.pm  view on Meta::CPAN

The C<$hash_ref> must be an (initially empty) hash reference which
will get updated automatically. It is possible to save the cookie jar
to persistent storage with something like JSON or Storable - see the
C<AnyEvent::HTTP::cookie_jar_expire> function if you wish to remove
expired or session-only cookies, and also for documentation on the format
of the cookie jar.

Note that this cookie implementation is not meant to be complete. If
you want complete cookie management you have to do that on your
own. C<cookie_jar> is meant as a quick fix to get most cookie-using sites
working. Cookies are a privacy disaster, do not use them unless required
to.

When cookie processing is enabled, the C<Cookie:> and C<Set-Cookie:>
headers will be set and handled by this module, otherwise they will be
left untouched.

=item tls_ctx => $scheme | $tls_ctx

Specifies the AnyEvent::TLS context to be used for https connections. This
parameter follows the same rules as the C<tls_ctx> parameter to
L<AnyEvent::Handle>, but additionally, the two strings C<low> or
C<high> can be specified, which give you a predefined low-security (no
verification, highest compatibility) and high-security (CA and common-name

HTTP.pm  view on Meta::CPAN

      },
   }

=item $date = AnyEvent::HTTP::format_date $timestamp

Takes a POSIX timestamp (seconds since the epoch) and formats it as a HTTP
Date (RFC 2616).

=item $timestamp = AnyEvent::HTTP::parse_date $date

Takes a HTTP Date (RFC 2616) or a Cookie date (netscape cookie spec) or a
bunch of minor variations of those, and returns the corresponding POSIX
timestamp, or C<undef> if the date cannot be parsed.

=item $AnyEvent::HTTP::MAX_RECURSE

The default value for the C<recurse> request parameter (default: C<10>).

=item $AnyEvent::HTTP::TIMEOUT

The default timeout for connection operations (default: C<300>).

README  view on Meta::CPAN


            Only redirects to http and https URLs are supported. While most
            common redirection forms are handled entirely within this
            module, some require the use of the optional URI module. If it
            is required but missing, then the request will fail with an
            error.

        headers => hashref
            The request headers to use. Currently, "http_request" may
            provide its own "Host:", "Content-Length:", "Connection:" and
            "Cookie:" headers and will provide defaults at least for "TE:",
            "Referer:" and "User-Agent:" (this can be suppressed by using
            "undef" for these headers in which case they won't be sent at
            all).

            You really should provide your own "User-Agent:" header value
            that is appropriate for your program - I wouldn't be surprised
            if the default AnyEvent string gets blocked by webservers sooner
            or later.

            Also, make sure that your headers names and values do not

README  view on Meta::CPAN

            The $hash_ref must be an (initially empty) hash reference which
            will get updated automatically. It is possible to save the
            cookie jar to persistent storage with something like JSON or
            Storable - see the "AnyEvent::HTTP::cookie_jar_expire" function
            if you wish to remove expired or session-only cookies, and also
            for documentation on the format of the cookie jar.

            Note that this cookie implementation is not meant to be
            complete. If you want complete cookie management you have to do
            that on your own. "cookie_jar" is meant as a quick fix to get
            most cookie-using sites working. Cookies are a privacy disaster,
            do not use them unless required to.

            When cookie processing is enabled, the "Cookie:" and
            "Set-Cookie:" headers will be set and handled by this module,
            otherwise they will be left untouched.

        tls_ctx => $scheme | $tls_ctx
            Specifies the AnyEvent::TLS context to be used for https
            connections. This parameter follows the same rules as the
            "tls_ctx" parameter to AnyEvent::Handle, but additionally, the
            two strings "low" or "high" can be specified, which give you a
            predefined low-security (no verification, highest compatibility)
            and high-security (CA and common-name verification) TLS context.

README  view on Meta::CPAN

                    },
                 },
              },
           }

    $date = AnyEvent::HTTP::format_date $timestamp
        Takes a POSIX timestamp (seconds since the epoch) and formats it as
        a HTTP Date (RFC 2616).

    $timestamp = AnyEvent::HTTP::parse_date $date
        Takes a HTTP Date (RFC 2616) or a Cookie date (netscape cookie spec)
        or a bunch of minor variations of those, and returns the
        corresponding POSIX timestamp, or "undef" if the date cannot be
        parsed.

    $AnyEvent::HTTP::MAX_RECURSE
        The default value for the "recurse" request parameter (default: 10).

    $AnyEvent::HTTP::TIMEOUT
        The default timeout for connection operations (default: 300).



( run in 0.379 second using v1.01-cache-2.11-cpan-e9199f4ba4c )