view release on metacpan or search on metacpan
lib/Continuity/Adapt/FCGI.pm view on Meta::CPAN
Continuity::Adapt::FCGI - Use HTTP::Daemon as a continuation server
=head1 DESCRIPTION
This module provides the glue between FastCGI Web and Continuity, translating FastCGI requests into HTTP::RequestWrapper
objects that are sent to applications running inside Continuity.
=head1 METHODS
=over
lib/Continuity/Adapt/FCGI.pm view on Meta::CPAN
package Continuity::Adapt::FCGI::Request;
use strict;
use CGI::Util qw(unescape);
use HTTP::Headers;
use base 'HTTP::Request';
use Continuity::Request;
use base 'Continuity::Request';
# CGI query params
sub cached_params { exists $_[1] ? $_[0]->{cached_params} = $_[1] : $_[0]->{cached_params} }
lib/Continuity/Adapt/FCGI.pm view on Meta::CPAN
sub debug_callback :lvalue { $_[0]->{debug_callback} }
=item $request = Continuity::Adapt::FCGI::Request->new($client, $id, $cgi, $query)
Creates a new C<Continuity::Adapt::FCGI::Request> object. This deletes values
from C<$cgi> while converting it into a L<HTTP::Request> object.
It also assumes $cgi contains certain CGI variables.
This code was borrowed from POE::Component::FastCGI
=cut
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Cookie/Jar.pm view on Meta::CPAN
return( $self->error( "Response object provided is not an object." ) ) if( !Scalar::Util::blessed( $resp ) );
my $uri;
if( $self->_is_a( $resp, 'HTTP::Response' ) )
{
my $req = $resp->request;
return( $self->error( "No HTTP::Request object is set in this HTTP::Response." ) ) if( !$resp->request );
$uri = $resp->request->uri;
}
elsif( $resp->can( 'uri' ) && $resp->can( 'header' ) )
{
$uri = $resp->uri;
lib/Cookie/Jar.pm view on Meta::CPAN
my $jar = Cookie::Jar->new( request => $r ) ||
die( "An error occurred while trying to get the cookie jar:", Cookie::Jar->error );
# set the default host
$jar->host( 'www.example.com' );
$jar->fetch;
# or using a HTTP::Request object
# Retrieve cookies from Cookie header sent from client
$jar->fetch( request => $http_request );
if( $jar->exists( 'my-cookie' ) )
{
# do something
lib/Cookie/Jar.pm view on Meta::CPAN
For example, Apache2::Cookie does not work well in decoding cookies, and L<Cookie::Baker> C<Set-Cookie> timestamp format is wrong. They use Mon-09-Jan 2020 12:17:30 GMT where it should be, as per rfc 6265 Mon, 09 Jan 2020 12:17:30 GMT
Also L<APR::Request::Cookie> and L<Apache2::Cookie> which is a wrapper around L<APR::Request::Cookie> return a cookie object that returns the value of the cookie upon stringification instead of the full C<Set-Cookie> parameters. Clearly they designed...
This module supports modperl and uses a L<Apache2::RequestRec> if provided, or can use package objects that implement similar interface as L<HTTP::Request> and L<HTTP::Response>, or if none of those above are available or provided, this module return...
This module is also compatible with L<LWP::UserAgent>, so you can use like this:
use LWP::UserAgent;
use Cookie::Jar;
lib/Cookie/Jar.pm view on Meta::CPAN
This is an alias for L</add_request_header> for backward compatibility with L<HTTP::Cookies>
=head2 add_request_header
Provided with a request object, such as, but not limited to L<HTTP::Request> and this will add all relevant cookies in the repository into the C<Cookie> C<HTTP> request header. The object method needs to have the C<header> method in order to get, or ...
As long as the object provided supports the C<uri> and C<header> method, you can provide any class of object you want.
Please refer to the L<rfc6265|https://datatracker.ietf.org/doc/html/rfc6265> for more information on the applicable rule when adding cookies to the outgoing request header.
lib/Cookie/Jar.pm view on Meta::CPAN
It retrieves all possible cookies from the HTTP request received from the web browser.
It takes an optional hash or hash reference of parameters, such as C<host>. If it is not provided, the value set with L</host> is used instead.
If the parameter C<request> containing an HTTP request object, such as, but not limited to L<HTTP::Request>, is provided, it will use it to get the C<Cookie> header value. The object method needs to have the C<header> method in order to get, or set t...
Alternatively, if a value for L</request> has been set, it will use it to get the C<Cookie> header value from Apache modperl.
You can also provide the C<Cookie> string to parse by providing the C<string> option to this method.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Cookies/Roundtrip.pm view on Meta::CPAN
use HTTP::Cookies;
use HTTP::CookieJar;
use Firefox::Marionette::Cookie;
use HTTP::Date qw(str2time parse_date time2str);
use HTTP::Response;
use HTTP::Request;
use DateTime;
use HTTP::Headers::Util qw/join_header_words/;
use Data::Compare;
use Devel::StackTrace; # until the module is stable
lib/Cookies/Roundtrip.pm view on Meta::CPAN
$httpcookies->set_cookie(@$parsed_setcookie_array);
if( $verbosity > 0 ){ print STDOUT "${whoami}, line ".__LINE__." (via $parent): inserting 1 Set-Cookies into HTTP::Cookies which now has ".count_httpcookies($httpcookies, undef, $verbosity)." cookies.\n" }
# this way is bogus, what with response and request and url and all
# my $response = HTTP::Response->new(200);
# my $request = HTTP::Request->new(GET => $url);
# $response->request($request);
# $response->header('Set-Cookie2', $newasc); # TODO: does it push multiple Cookie headers or overrides?
# if( ! defined $httpcookies->extract_cookies($response) ){ print STDERR "--begin cookies:\n".as_string_setcookies($setcookies)."\n--end cookies.\n\n"."${whoami}, line ".__LINE__." (via $parent): error, call to ".'httpcookies->extract_cookies()'." h...
# if( $verbosity > 0 ){ print STDOUT "${whoami}, line ".__LINE__." (via $parent): inserting 1 Set-Cookies into HTTP::Cookies which now has ".count_httpcookies($httpcookies, undef, $verbosity)." cookies.\n" }
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Coro/Amazon/SimpleDB.pm view on Meta::CPAN
REPLACE_AMAZON_SIMPLEDB_CLIENT_HTTPPOST: {
package Amazon::SimpleDB::Client;
use common::sense;
use AnyEvent::HTTP;
use HTTP::Request;
use HTTP::Response;
# The only mention of a time-out in Amazon::SimpleDB::Client is in
# reference to a select operation. I'm using the value from there
# (5 seconds) as the default time-out for HTTP requests, as it
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CouchDB/Client.pm view on Meta::CPAN
our $VERSION = '0.09';
use JSON::Any qw(XS JSON DWIW);
use LWP::UserAgent qw();
use HTTP::Request qw();
use Encode qw(encode);
use Carp qw(confess);
use CouchDB::Client::DB;
lib/CouchDB/Client.pm view on Meta::CPAN
if (ref $content) {
$content = encode('utf-8', $self->{json}->encode($content));
$headers = HTTP::Headers->new('Content-Type' => 'application/json');
}
my $res = $self->{ua}->request( HTTP::Request->new($meth, $self->uriForPath($path), $headers, $content) );
my $ret = {
status => $res->code,
msg => $res->status_line,
success => 0,
};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crop/HTTP/Request.pm view on Meta::CPAN
package Crop::HTTP::Request;
use base qw/ Crop::Object::Simple /;
=begin nd
Class: Crop::HTTP::Request
HTTP request.
Base class for particular gateways such FastCGI, PSGI, CGI.
Attributes contain start and finish time besides regular HTTP data.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crop/HTTP/Request.pm view on Meta::CPAN
package Crop::HTTP::Request;
use base qw/ Crop::Object::Simple /;
=begin nd
Class: Crop::HTTP::Request
HTTP request.
Base class for particular gateways such FastCGI, PSGI, CGI.
Attributes contain start and finish time besides regular HTTP data.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CrowdSec/Client.pm view on Meta::CPAN
package CrowdSec::Client;
use strict;
use Date::Parse;
use HTTP::Request::Common;
use JSON;
use LWP::UserAgent;
use Moo;
use POSIX "strftime";
view all matches for this distribution
view release on metacpan or search on metacpan
script/ct-submit.pl view on Meta::CPAN
while (my ($log_name, $log_url) = each %logs) {
write_log("\nSending request to $log_url");
my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new('POST', $log_url . '/ct/v1/add-chain', ['Content-Type' => 'application/json'], $json_data);
my $res = $ua->request($req);
if (!$res->is_success) {
write_log('Failed: ', $res->status_line, "\n");
next;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypt/OpenPGP/KeyServer.pm view on Meta::CPAN
my($address) = @_;
my $ua = LWP::UserAgent->new;
$ua->agent('Crypt::OpenPGP/' . Crypt::OpenPGP->VERSION);
my $url = $server->{keyserver} . '?op=index&search=' .
uri_escape($address);
my $req = HTTP::Request->new(GET => $url);
my $res = $ua->request($req);
return $server->error("HTTP error: " . $res->status_line)
unless $res->is_success;
my $page = $res->content;
my @kb;
lib/Crypt/OpenPGP/KeyServer.pm view on Meta::CPAN
$key_id = unpack 'H*', $key_id;
my $ua = LWP::UserAgent->new;
$ua->agent('Crypt::OpenPGP/' . Crypt::OpenPGP->VERSION);
$key_id = substr($key_id, -8, 8);
my $url = $server->{keyserver} . '?op=get&search=0x' . $key_id;
my $req = HTTP::Request->new(GET => $url);
my $res = $ua->request($req);
return $server->error("HTTP error: " . $res->status_line)
unless $res->is_success;
my $page = $res->content;
my($key) = $page =~ /(-----BEGIN PGP PUBLIC KEY BLOCK-----.*?-----END PGP PUBLIC KEY BLOCK-----)/s;
view all matches for this distribution
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
eval {
eval "require LWP::UserAgent"; die $@ if $@;
my $ua = LWP::UserAgent->new;
$ua->agent("crypt-pbc-fetcher/1.0");
my $req = HTTP::Request->new(GET => "http://voltar.org/pbcfiles/pbc-$ver.tar.gz");
my $res = $ua->request($req, "pbc-$ver.tar.gz");
$worked = 1 if $res->is_success;
};
warn "LWP fetch problem: $@\n" if $@;
view all matches for this distribution
view release on metacpan or search on metacpan
eg/lwp-ssl-test view on Meta::CPAN
$opt_cadir && ( $ENV{HTTPS_CA_DIR} = $opt_cadir );
my $url = shift || 'https://www.nodeworks.com';
my $ua = new LWP::UserAgent;
$ua->timeout(15);
my $req = new HTTP::Request('HEAD', $url);
my $res = $ua->request($req);
print Dumper($res);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypto/NanoRPC.pm view on Meta::CPAN
package Crypto::NanoRPC;
use 5.018001;
use strict;
use warnings;
use HTTP::Request;
use LWP::UserAgent;
use JSON;
require Exporter;
our @ISA = qw(Exporter);
lib/Crypto/NanoRPC.pm view on Meta::CPAN
my $class = shift;
my $self = {
url => shift,
};
$self->{url} = 'http://[::1]:7076' unless defined $self->{url};
$self->{request} = HTTP::Request->new( 'POST', $self->{url} );
$self->{request}->content_type('application/json');
$self->{ua} = LWP::UserAgent->new;
bless $self, $class;
return $self;
}
lib/Crypto/NanoRPC.pm view on Meta::CPAN
These modules are required:
=over 1
=item HTTP::Request
=item LWP::UserAgent
=item JSON
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DAPNET/API.pm view on Meta::CPAN
my($type) = shift;
my($username) = $self->{DAPNET_USERNAME};
my($pw) = $self->{DAPNET_PW};
my($uri) = 'http://www.hampager.de:8080/'.$type;
print("Building HTTP request\n") if($self->{DEBUG});
my($req) = HTTP::Request->new(
POST => $uri
);
$req->header( 'Content-Type' => 'application/json',
'Authorization'=>'Basic ' . encode_base64($username.':'.$pw)
);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DB/CouchDB.pm view on Meta::CPAN
my $self = shift;
my $method = shift;
my $uri = shift;
my $content = shift;
my $req = HTTP::Request->new($method, $uri);
$req->content(Encode::encode('utf8', $content));
my $ua = LWP::UserAgent->new();
my $return = $ua->request($req);
my $response = $return->decoded_content({
view all matches for this distribution
view release on metacpan or search on metacpan
my $remote_source = shift;
undef $@;
eval{ require 'LWP/UserAgent.pm'; };
die "LWP module not found! $@" if $@;
my $ua = new LWP::UserAgent;
my $req = new HTTP::Request GET => $remote_source;
my $res = $ua->request($req);
die "[$remote_source] : " . $res->message if !$res->is_success;
my $data = $res->content;
return $data;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBD/libsql.pm view on Meta::CPAN
use 5.018;
use strict;
use warnings;
use DBI ();
use LWP::UserAgent;
use HTTP::Request;
use JSON;
use Data::Dumper;
our $VERSION = '0.06';
our $drh;
lib/DBD/libsql.pm view on Meta::CPAN
die "Cannot connect to libsql server at $server_url: " . $health_response->status_line;
}
# Initialize session baton with a simple query
eval {
my $init_request = HTTP::Request->new('POST', "$server_url/v2/pipeline");
$init_request->header('Content-Type' => 'application/json');
# Add Turso authentication header if token is available
if ($auth_token) {
$init_request->header('Authorization' => 'Bearer ' . $auth_token);
lib/DBD/libsql.pm view on Meta::CPAN
# Add baton if available for session continuity
if ($client_data->{baton}) {
$pipeline_data->{baton} = $client_data->{baton};
}
my $request = HTTP::Request->new('POST', $client_data->{base_url} . '/v2/pipeline');
$request->header('Content-Type' => 'application/json');
# Add Turso authentication header if token is available
if ($client_data->{auth_token}) {
$request->header('Authorization' => 'Bearer ' . $client_data->{auth_token});
lib/DBD/libsql.pm view on Meta::CPAN
=item * DBI (1.631 or later)
=item * LWP::UserAgent (6.00 or later)
=item * HTTP::Request (6.00 or later)
=item * JSON (4.00 or later)
=item * IO::Socket::SSL (2.00 or later) - for HTTPS connections
view all matches for this distribution