view release on metacpan or search on metacpan
lib/AnySan/Provider/Slack.pm view on Meta::CPAN
use base 'AnySan::Provider';
our @EXPORT = qw(slack);
use AnySan;
use AnySan::Receive;
use HTTP::Request::Common;
use AnyEvent::HTTP;
use AnyEvent::SlackRTM;
use JSON;
use Encode;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/ACEProxy.pm view on Meta::CPAN
return OK;
}
sub proxy_handler {
my($class, $r) = @_;
my $request = HTTP::Request->new($r->method, $r->uri);
my %headers_in = $r->headers_in;
while(my($key, $val) = each %headers_in) {
$request->header($key, $val);
}
view all matches for this distribution
view release on metacpan or search on metacpan
example/lwp_test_url.pl view on Meta::CPAN
# $Id$
use LWP::UserAgent ;
use HTTP::Request ;
use HTTP::Headers ;
my $BASE_URL = 'http://perl.rulez.com' ;
my @tests = (
example/lwp_test_url.pl view on Meta::CPAN
my $headers = HTTP::Headers->new() ;
$headers->header( $t->{'header'} => $t->{'value'} ) ;
$headers->referer( $t->{'referer'} ) if ( $t->{'referer'} ) ;
my $request = HTTP::Request->new( 'GET', $BASE_URL . $t->{'url'}, $headers ) ;
my $ua = LWP::UserAgent->new() ;
my $response = $ua->request( $request ) ;
if ( $response->is_success() )
view all matches for this distribution
view release on metacpan or search on metacpan
Server/t/lib/Apache/test.pm view on Meta::CPAN
$request->{headers}{Content_Type} = 'application/x-www-form-urlencoded'
if (!$request->{headers} and $request->{method} eq 'POST'); # Is this necessary?
# Create & send the request
$request->{headers} = new HTTP::Headers(%{$request->{headers}||{}});
my $req = new HTTP::Request(@{$request}{'method','uri','headers','content'});
my $response = $ua->request($req);
return $want_response ? $response : $response->content;
}
Server/t/lib/Apache/test.pm view on Meta::CPAN
my $ua = LWP::UserAgent->new;
my $url = URI::URL->new("http://$net::httpserver");
my($path,$q) = split /\?/, shift;
$url->path($path);
$url->query($q) if $q;
my $request = new HTTP::Request('GET', $url);
my $response = $ua->request($request, undef, undef);
$response->is_success;
}
#even if eval $mod fails, the .pm ends up in %INC
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/AppSamurai/AuthBasic.pm view on Meta::CPAN
use Apache::AppSamurai::AuthBase;
# Below is used to make client connection to backend server to test auth
# and collect any cookies we want to keep
use LWP::UserAgent;
use HTTP::Request;
use MIME::Base64;
@ISA = qw( Apache::AppSamurai::AuthBase );
sub Configure {
lib/Apache/AppSamurai/AuthBasic.pm view on Meta::CPAN
$self->{alterlist} = {};
# Create LWP client and empty request
$self->{client} = new LWP::UserAgent(timeout => $self->{conf}{Timeout});
($self->{client}) || ($self->AddError("Initialization of LWP::UserAgent failed: $!") && return 0);
$self->{request} = new HTTP::Request("GET", $self->{conf}{LoginUrl});
($self->{request}) || ($self->AddError("Initialization of HTTP::Request failed: $!") && return 0);
# Turn off all redirects if configured
($self->{conf}{AllowRedirect} == 1) || ($self->{client}->requests_redirectable([]));
# Set the User-Agent for the request (You may want to use
lib/Apache/AppSamurai/AuthBasic.pm view on Meta::CPAN
Creates a L<LWP::UserAgent|LWP::UserAgent> instance and saves it in
C<< $self->{client} >>.
=item *
Creates a L<HTTP::Request|HTTP::Request> instance, containing the auth
server URL, and saves it in C<< $self->{request} >>.
=item *
If C<UserAgent> is set, collects (if C<header:> is used), then sets the
lib/Apache/AppSamurai/AuthBasic.pm view on Meta::CPAN
F<examples/conf/> inside the Apache::AppSamurai distribution.
=head1 SEE ALSO
L<Apache::AppSamurai>, L<Apache::AppSamurai::AuthBase>, L<LWP::UserAgent>,
L<HTTP::Request>
=head1 AUTHOR
Paul M. Hirsch, C<< <paul at voltagenoir.org> >>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/AuthenURL.pm view on Meta::CPAN
my $lwp_ua = new LWP::UserAgent;
if($attr->{proxy}) {
$lwp_ua->proxy('http', $attr->{proxy});
}
$lwp_ua->use_alarm(0);
my $lwp_req = new HTTP::Request $attr->{method} => $attr->{url};
unless( defined $lwp_req ) {
$r->log->error("$prefix: LWP failed to use METHOD: ", $attr->{method},
" to connect to URL: ", $attr->{url}, $r->uri);
return MP2 ? Apache2::Const::HTTP_INTERNAL_SERVER_ERROR :
Apache::Constants::HTTP_INTERNAL_SERVER_ERROR;
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/Apache/test.pm view on Meta::CPAN
$request->{headers}{Content_Type} = 'application/x-www-form-urlencoded'
if (!$request->{headers} and $request->{method} eq 'POST'); # Is this necessary?
# Create & send the request
$request->{headers} = new HTTP::Headers(%{$request->{headers}||{}});
my $req = new HTTP::Request(@{$request}{'method','uri','headers','content'});
my $response = $ua->request($req);
return $want_response ? $response : $response->content;
}
t/lib/Apache/test.pm view on Meta::CPAN
my $ua = LWP::UserAgent->new;
my $url = URI::URL->new("http://$net::httpserver");
my($path,$q) = split /\?/, shift;
$url->path($path);
$url->query($q) if $q;
my $request = new HTTP::Request('GET', $url);
my $response = $ua->request($request, undef, undef);
$response->is_success;
}
#even if eval $mod fails, the .pm ends up in %INC
view all matches for this distribution
view release on metacpan or search on metacpan
DoCoMoProxy.pm view on Meta::CPAN
my($key,$val);
my ($user,$ua) = split(m|,|,$r->connection->user);
$ua ||= 'DoCoMo/1.0/N503i/c30';
my $request = new HTTP::Request $r->method, get_filter($user,$r->uri);
my(%headers_in) = $r->headers_in;
while(($key,$val) = each %headers_in) {
$request->header($key,$val);
}
view all matches for this distribution
view release on metacpan or search on metacpan
ProxyPassThru.pm view on Meta::CPAN
sub proxy_handler {
my($r) = @_;
my($key,$val);
my $request = new HTTP::Request $r->method, $r->uri;
my(%headers_in) = $r->headers_in;
while(($key,$val) = each %headers_in) {
$request->header($key,$val);
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/Apache/test.pm view on Meta::CPAN
$request->{headers}{Content_Type} = 'application/x-www-form-urlencoded'
if (!$request->{headers} and $request->{method} eq 'POST'); # Is this necessary?
# Create & send the request
$request->{headers} = new HTTP::Headers(%{$request->{headers}||{}});
my $req = new HTTP::Request(@{$request}{'method','uri','headers','content'});
my $response = $ua->request($req);
return $want_response ? $response : $response->content;
}
t/lib/Apache/test.pm view on Meta::CPAN
my $ua = LWP::UserAgent->new;
my $url = URI::URL->new("http://$net::httpserver");
my($path,$q) = split /\?/, shift;
$url->path($path);
$url->query($q) if $q;
my $request = new HTTP::Request('GET', $url);
my $response = $ua->request($request, undef, undef);
$response->is_success;
}
#even if eval $mod fails, the .pm ends up in %INC
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/FilteringProxy.pm view on Meta::CPAN
}
$r->warn("requesting document 'http://$remote_servername$port_string$path' via '".$r->method()."' method") unless ($Apache::FilteringProxy::logging < 2);
# Create a request object to use to fetch data from the remote server
my $request = HTTP::Request->new ($r->method, "http://$remote_servername$port_string$path");
# Copy the headers the client gave us into the new request object
$r->headers_in->do (sub {
my $name = shift;
my $value = shift || "";
view all matches for this distribution
view release on metacpan or search on metacpan
$Apache::Gateway::VERSION = sprintf("%d.%02d", q$Revision: 1.12 $ =~ /(\d+)\.(\d+)/g);
use Apache::Constants ':server'; # for SERVER_VERSION for Via comment
use Apache::URI ();
use HTTP::Date ();
use HTTP::Request ();
use HTTP::Status ();
use IO::File ();
use LWP::UserAgent ();
use Time::Zone ();
# UA's from field.
if($url->scheme eq 'ftp' && $url->user eq 'anonymous') {
$url->password($ua->from) # anon-FTP passwd
}
my $request = HTTP::Request->new($r->method, $url->unparse);
# If upstream server has a broken clock, calculate how much we
# need to adjust condition GET time fields. Note: this code won't
# work correctly if we get redirected to another server with a
# different clock. Oh, well.
view all matches for this distribution
view release on metacpan or search on metacpan
Client/lib/HTTunnel/Client.pm view on Meta::CPAN
package HTTunnel::Client ;
@ISA = qw(LWP::UserAgent) ;
use strict ;
use LWP::UserAgent ;
use HTTP::Request::Common ;
use HTTP::Status ;
use IO::Select ;
use Carp ;
Client/lib/HTTunnel/Client.pm view on Meta::CPAN
$this->conn_cache({total_capacity => 1}) ;
}
$this->{__PACKAGE__}->{pid} = $$ ;
}
my $req = HTTP::Request::Common::POST(
join("/", $this->{__PACKAGE__}->{url}, $cmd, @{$args}),
{"Content-Length" => length($data || '')},
"content" => $data
) ;
$req->protocol("HTTP/1.1") ;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Hadoop/WebHDFS.pm view on Meta::CPAN
}
# Added as LWP::UserAgent and WWW:Mechanize don't have delete
# stolen from http://code.google.com/p/www-mechanize/issues/detail?id=219
sub _SUPER_delete {
require HTTP::Request::Common;
my($self, @parameters) = @_;
my @suff = $self->_process_colonic_headers(\@parameters,1);
return $self->request( HTTP::Request::Common::DELETE( @parameters ), @suff );
}
sub Delete {
# curl -i -X DELETE "http://<host>:<port>/webhdfs/v1/<path>?op=DELETE[&recursive=<true|false>]"
my ( $path, $recursive, $url ) = undef;
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/Apache/test.pm view on Meta::CPAN
$request->{headers}{Content_Type} = 'application/x-www-form-urlencoded'
if (!$request->{headers} and $request->{method} eq 'POST'); # Is this necessary?
# Create & send the request
$request->{headers} = new HTTP::Headers(%{$request->{headers}||{}});
my $req = new HTTP::Request(@{$request}{'method','uri','headers','content'});
my $response = $ua->request($req);
return $want_response ? $response : $response->content;
}
t/lib/Apache/test.pm view on Meta::CPAN
my $ua = LWP::UserAgent->new;
my $url = URI::URL->new("http://$net::httpserver");
my($path,$q) = split /\?/, shift;
$url->path($path);
$url->query($q) if $q;
my $request = new HTTP::Request('GET', $url);
my $response = $ua->request($request, undef, undef);
$response->is_success;
}
#even if eval $mod fails, the .pm ends up in %INC
view all matches for this distribution
view release on metacpan or search on metacpan
eg/logbench.pl view on Meta::CPAN
use strict;
use Benchmark qw/ :all /;
use File::Temp qw/ tempfile /;
use Storable qw/ nstore retrieve /;
use HTTP::Request::Common;
my $result = {};
for my $name (qw! extlib-1.0022/lib/perl5 lib !) {
my ($fh, $fn) = tempfile();
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/MONITOR.pm view on Meta::CPAN
my $args = @_ ? \@_ : \@ARGV;
my ($url,$reply_to,$proxy) = @$args;
$ua->proxy(['http'], $proxy ) if(defined $proxy);
my $req = HTTP::Request->new('MONITOR' => $url );
$req->header('Reply_To' => $reply_to );
#$req->header('Accept' => 'text/plain' );
my $res = $ua->request($req);
lib/Apache/MONITOR.pm view on Meta::CPAN
my $ua = __PACKAGE__->new;
my $args = @_ ? \@_ : \@ARGV;
my ($mon_url) = @$args;
my $req = HTTP::Request->new('DELETE' => $mon_url );
my $res = $ua->request($req);
if($res->is_success)
{
lib/Apache/MONITOR.pm view on Meta::CPAN
{
my $value = $monitors{$muri};
my ($u,$re) = split(/ / , $value);
next unless ($u eq $monitored_uri);
#my $req = HTTP::Request->new('GET' => $monitored_uri);
#my $res = $ua->request($req);
#my $body;
#if($res->is_success)
#{
# $body = $res->content;
lib/Apache/MONITOR.pm view on Meta::CPAN
my $ua = __PACKAGE__->new;
my $args = @_ ? \@_ : \@ARGV;
my ($uri) = @$args;
my $req = HTTP::Request->new('GET' => $uri);
my $res = $ua->request($req);
if($res->is_success)
{
my $s = $res->content;
$s =~ s/<meta[^>]+>//gi;
view all matches for this distribution
view release on metacpan or search on metacpan
eg/bench.pl view on Meta::CPAN
## one apache's running on adjust the URL appropriately.
##
timethese( $times, {
'1: Straight file' => q~
my $req = new HTTP::Request( 'GET',
'http://localhost/file.html' );
my $response = $ua->request($req);
carp "problem\n" unless $response->is_success();
~,
'2: open/print while <INFILE>/close' => q~
my $req = new HTTP::Request( 'GET',
'http://localhost/perl/foo' );
my $response = $ua->request($req);
carp "problem\n" unless $response->is_success();
~,
'3: Mmapped' => q~
my $req = new HTTP::Request( 'GET',
'http://localhost/mmapped.html' );
my $response = $ua->request($req);
carp "problem\n" unless $response->is_success();
~,
} );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/No404Proxy.pm view on Meta::CPAN
return OK;
}
sub proxy_handler {
my($class, $r) = @_;
my $request = HTTP::Request->new($r->method, $r->uri);
my %headers_in = $r->headers_in;
while(my($key, $val) = each %headers_in) {
$request->header($key, $val);
}
view all matches for this distribution
view release on metacpan or search on metacpan
ProxyPass.pm view on Meta::CPAN
}
if ($uri ne $r->uri) {
my(%headers) = $r->headers_in();
my $query = $r->args() || '';
$uri .= "?$query" if defined $query and length $query;
my $request = new HTTP::Request($r->method, $uri);
my(%headers) = $r->headers_in;
for (keys(%headers)) {
$request->header($_, $headers{$_});
}
view all matches for this distribution
view release on metacpan or search on metacpan
ProxyRewrite.pm view on Meta::CPAN
$my_uri = $r->uri;
}
$my_uri = $remote_location . $my_uri;
$my_uri .= '?' . $r->args() if $args;
my $request = HTTP::Request->new($r->method, $my_uri);
$r->log->info("ProxyRewrite::fetch: Time proxy request method created: ", time);
$r->log->debug("fetch: Base URI (aka location section): $base");
$r->log->info("ProxyRewrite::fetch: Request for $my_uri with method ", $r->method);
view all matches for this distribution
view release on metacpan or search on metacpan
ProxyScan.pm view on Meta::CPAN
$trustmime =~ s/\*/.*/igs;
$trustmime = join('|', split(/\s+/, $trustmime));
}
# create the request
my $request = new HTTP::Request $r->method, $r->uri;
# copy request headers
my $table = $r->headers_in;
foreach my $key (keys %{$table}) {
$request->header($key,$table->{$key});
view all matches for this distribution
view release on metacpan or search on metacpan
ProxyStuff.pm view on Meta::CPAN
my $file_uri = join '/', $proxy_prefix, $uri;
$file_uri .= q(?) . $r->args if $r->args;
$r->log->debug("URI: $file_uri");
# Build the request
my $req = new HTTP::Request($r->method => $file_uri);
# Set headers
$req = set_headers($req, $r->headers_in);
# Copy POST data, if any
ProxyStuff.pm view on Meta::CPAN
# If it's text
if ($r->content_type =~ /^text/) {
# Get the header and footer
my $header_req = new HTTP::Request('GET' => $header_file);
my $footer_req = new HTTP::Request('GET' => $footer_file);
$header_req = set_headers($header_req, $r->headers_in);
$footer_req = set_headers($footer_req, $r->headers_in);
$header_req->push_header('REAL_URI' => $file_uri); # Somebody might need the real page
$footer_req->push_header('REAL_URI' => $file_uri); # Ditto
$header_req->push_header('ORIG_URI' => $r->uri); # Somebody might need the real page
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/TestApReqI18N.pm view on Meta::CPAN
use warnings FATAL => 'all';
use Apache::TestRequest;
use Carp;
use Exporter;
use HTTP::Request;
use IO::File;
our @ISA = qw(Exporter);
our @EXPORT = qw(request_from_file last_test_name);
t/lib/TestApReqI18N.pm view on Meta::CPAN
# FIXME: What to do with an empty request?
$line =~ s!^(\s*\w+\s+)!$1http://$hostport$root!;
$line = join ('' => $line, $fh->getlines);
my $request = parse HTTP::Request $line
or croak "Cannot parse request $source";
my $content_type = $request->header('Content-Type');
if ($content_type && $content_type =~ /x-www-form-urlencoded/) {
my $content = $request->content_ref;
view all matches for this distribution
view release on metacpan or search on metacpan
Redirect.pm view on Meta::CPAN
@ISA = qw(Exporter);
@EXPORT = qw($LOG_REQUEST $LOG_QUERYSTRING $LOG_RESPONSE);
use HTTP::Response;
use HTTP::Request;
use HTTP::Headers;
use LWP::UserAgent;
use URI;
$Apache::Request::Redirect::VERSION = '0.05';
Redirect.pm view on Meta::CPAN
} else {
# nel get il content non c'e' (sara' vero ? :-)
$headers->remove_header('Content-Length');
}
# costruisco la nuova richiesta per il recupero dell'url
my $request = new HTTP::Request($self->{apachereq}->method,
$uri,
$headers,
$content
);
return $request;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/ReverseProxy.pm view on Meta::CPAN
}
if (length $munged_uri_query) { $uri = $munged_uri .'?'. $munged_uri_query }
my $request = new HTTP::Request($r->method, $uri);
# copy in client headers
my(%headers) = $r->headers_in();
for (keys(%headers)) {
$request->header($_, $headers{$_});
view all matches for this distribution
view release on metacpan or search on metacpan
RewritingProxy.pm view on Meta::CPAN
my $rurl = $url;
$rurl .= "?". $r->args if ($r->args && $url !~ /\?/);
if ($r->method eq 'GET')
{
$req = new HTTP::Request 'GET' => "$rurl";
$req->header('Referer'=>"$referer");
$serverCookies->add_cookie_header($req);
# This needs to be a simple request or else the redirects will
# not work very nicely. LWP is too smart sometimes.
$res = $ua->simple_request($req);
RewritingProxy.pm view on Meta::CPAN
# This is a little bit of tricky ju ju here.
# We will use another PERLy package to
# prepare the URL and pack in the encoded form data.
use URI::URL;
my %FORM;
$req = new HTTP::Request 'POST' => "$rurl";
$req->header('Referer'=>"$referer");
$req->content_type('application/x-www-form-urlencoded');
$serverCookies->add_cookie_header($req);
# $req->content('$buffer');
my $pair;
view all matches for this distribution
view release on metacpan or search on metacpan
t/10methods.t view on Meta::CPAN
}
sub Request ($$$;$$@) {
my($ua, $method, $url, $type, $contents, @headers) = @_;
$url = 'http://127.0.0.1:' . $cfg->{'httpd_port'} . $url;
my $req = HTTP::Request->new($method => $url);
Test($req);
$req->content_type($type) if defined($type);
$req->content($contents) if defined($contents);
$req->authorization_basic('foo bar', 'eoj');
while (@headers) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/SPARQL/RDFStore.pm view on Meta::CPAN
</Location>
#
my $ua = LWP::UserAgent->new();
my $req = HTTP::Request->new(GET => "http://pim.example/rdfstore?query=PREFIX+foaf%3A+%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E%0
D%0ASELECT+%3Fpg%0D%0AWHERE%0D%0A++%28%3Fwho+foaf%3Aname+%22Norm+Walsh%22%29%0D%0A++%28%3Fwho+foaf%3Aweblog+%3Fpg%29%0D%0A");
my $res = $ua->request($req);
=head1 DESCRIPTION
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/SPARQL.pm view on Meta::CPAN
</Location>
#
my $ua = LWP::UserAgent->new();
my $req = HTTP::Request->new(GET => "http://pim.example/rdfstore?query=PREFIX+foaf%3A+%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E%0D%0ASELECT+%3Fpg%0D%0AWHERE%0D%0A++%28%3Fwho+foaf%3Aname+%22Norm+Walsh%22%29%0D%0A++%28%3Fwho+foaf%3Aweblog+%3Fpg%29%...
my $res = $ua->request($req);
=head1 DESCRIPTION
view all matches for this distribution