view release on metacpan or search on metacpan
inc/HTTP/Request/Common.pm view on Meta::CPAN
#line 1
package HTTP::Request::Common;
use strict;
use vars qw(@EXPORT @EXPORT_OK $VERSION $DYNAMIC_FILE_UPLOAD);
$DYNAMIC_FILE_UPLOAD ||= 0; # make it defined (don't know why)
inc/HTTP/Request/Common.pm view on Meta::CPAN
require Exporter;
*import = \&Exporter::import;
@EXPORT =qw(GET HEAD PUT POST);
@EXPORT_OK = qw($DYNAMIC_FILE_UPLOAD);
require HTTP::Request;
use Carp();
$VERSION = "5.811";
my $CRLF = "\015\012"; # "\r\n" is not portable
inc/HTTP/Request/Common.pm view on Meta::CPAN
sub PUT { _simple_req('PUT' , @_); }
sub POST
{
my $url = shift;
my $req = HTTP::Request->new(POST => $url);
my $content;
$content = shift if @_ and ref $_[0];
my($k, $v);
while (($k,$v) = splice(@_, 0, 2)) {
if (lc($k) eq 'content') {
inc/HTTP/Request/Common.pm view on Meta::CPAN
sub _simple_req
{
my($method, $url) = splice(@_, 0, 2);
my $req = HTTP::Request->new($method => $url);
my($k, $v);
while (($k,$v) = splice(@_, 0, 2)) {
if (lc($k) eq 'content') {
$req->add_content($v);
$req->header("Content-Length", length(${$req->content_ref}));
view all matches for this distribution
view release on metacpan or search on metacpan
t/PostApp/script/post.pl view on Meta::CPAN
#!/usr/bin/perl
use strict;
use warnings;
use LWP::UserAgent;
use HTTP::Request;
use Encode;
my $ua = LWP::UserAgent->new();
print "REQUEST: =============\n";
my $message = <<SOAP;
<Envelope xmlns="http://www.w3.org/2003/05/soap-envelope">
<Body>World</Body>
</Envelope>
SOAP
my $request = HTTP::Request->new('POST','http://localhost:3000/ws/hello');
$request->content_type('application/soap+xml');
$request->content_encoding('utf8');
$request->content(encode_utf8($message));
my $response = $ua->request($request);
print "RESPONSE: ============\n";
t/PostApp/script/post.pl view on Meta::CPAN
$message = <<SOAP;
<Envelope xmlns="http://www.w3.org/2003/05/soap-envelope">
<Body><hello>World</hello></Body>
</Envelope>
SOAP
$request = HTTP::Request->new('POST','http://localhost:3000/ws2');
$request->content_type('application/soap+xml');
$request->content_encoding('utf8');
$request->content(encode_utf8($message));
$response = $ua->request($request);
print "MENSAGEM 2============\n";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Controller/WrapCGI.pm view on Meta::CPAN
use mro 'c3';
extends 'Catalyst::Controller';
use Catalyst::Exception ();
use HTTP::Request::AsCGI ();
use HTTP::Request ();
use URI ();
use URI::Escape;
use HTTP::Request::Common;
use namespace::clean -except => 'meta';
=head1 NAME
lib/Catalyst/Controller/WrapCGI.pm view on Meta::CPAN
=head2 wrap_cgi
C<< $self->wrap_cgi($c, $coderef) >>
Runs C<$coderef> in a CGI environment using L<HTTP::Request::AsCGI>, returns an
L<HTTP::Response>.
The CGI environment is set up based on C<$c>.
The environment variables to pass on are taken from the configuration for your
lib/Catalyst/Controller/WrapCGI.pm view on Meta::CPAN
=cut
sub wrap_cgi {
my ($self, $c, $call) = @_;
my $req = HTTP::Request->new(
map { $c->req->$_ } qw/method uri headers/
);
my $body = $c->req->body;
my $body_content = '';
lib/Catalyst/Controller/WrapCGI.pm view on Meta::CPAN
my $path_info = '/'.join '/' => map {
utf8::is_utf8($_) ? uri_escape_utf8($_) : uri_escape($_)
} @{ $c->req->args };
my $env = HTTP::Request::AsCGI->new(
$req,
($username ? (REMOTE_USER => $username) : ()),
PATH_INFO => $path_info,
# eww, this is likely broken:
FILEPATH_INFO => '/'.$c->action.$path_info,
view all matches for this distribution
view release on metacpan or search on metacpan
author:
- 'John Napiorkowski <jjnapiork@cpan.org>'
build_requires:
Catalyst: '5.90093'
Catalyst::Test: '0'
HTTP::Request::Common: '0'
Moose: '2.1403'
MooseX::MethodAttributes: '0'
Test::Most: '0.34'
Types::Standard: '0'
configure_requires:
view all matches for this distribution
view release on metacpan or search on metacpan
t/author-live_component_controller_action_streaming.t view on Meta::CPAN
{
if ( $ENV{CATALYST_SERVER} ) {
skip "Using remote server", 1;
}
# XXX: Length should be undef here, but HTTP::Request::AsCGI sets it
is( $response->content_length, 12, 'Response Content-Length' );
}
is( $response->content,, <<'EOF', 'Content is a stream' );
foo
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Engine/Embeddable.pm view on Meta::CPAN
and get the response.
It works by using the arguments that are passed from the
handle_request method in the Catalyst module to the prepare_request
method in the engine, which will then handle the request as coming
from the HTTP::Request object passed, instead of trying to fetch the
elements from the ENV, like the CGI engine does.
As the handle_request method only returns the response code and not
the response object at all, in the case you want the complete response
you need to pass a second argument which is a scalar ref where the
lib/Catalyst/Engine/Embeddable.pm view on Meta::CPAN
This information will be stored as $c->req->{_engine_embeddable}{req} and
$c->req->{_engine_embeddable}{res} for future usage.
=item $engine->prepare_headers($c)
This is where the headers are fetched from the HTTP::Request object
and set into $c->req.
=item $engine->prepare_path($c)
Get the path info from the HTTP::Request object.
=item $engine->prepare_query_parameters($c)
Set the query params from the HTTP::Request to the catalyst request.
=item $engine->prepare_body($c)
Gets the body of the HTTP::Request, creates an HTTP::Body object, and
set it in $c->req->{_body}, then being compatible with
Catalyst::Engine from now on.
=item $engine->finalize_headers($c)
lib/Catalyst/Engine/Embeddable.pm view on Meta::CPAN
=back
=head1 SEE ALSO
L<Catalyst::Engine>, L<Catalyst::Engine::CGI>, L<HTTP::Request>,
L<HTTP::Reponse>, L<Catalyst>
=head1 AUTHORS
Daniel Ruoso C<daniel@ruoso.com>
view all matches for this distribution
view release on metacpan or search on metacpan
t/live_component_controller_action_streaming.t view on Meta::CPAN
{
if ( $ENV{CATALYST_SERVER} ) {
skip "Using remote server", 1;
}
# XXX: Length should be undef here, but HTTP::Request::AsCGI sets it
is( $response->content_length, 12, 'Response Content-Length' );
}
is( $response->content,, <<'EOF', 'Content is a stream' );
foo
view all matches for this distribution
view release on metacpan or search on metacpan
t/live_component_controller_action_streaming.t view on Meta::CPAN
{
if ( $ENV{CATALYST_SERVER} ) {
skip "Using remote server", 1;
}
# XXX: Length should be undef here, but HTTP::Request::AsCGI sets it
is( $response->content_length, 12, 'Response Content-Length' );
}
is( $response->content,, <<'EOF', 'Content is a stream' );
foo
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Engine/Server/Base.pm view on Meta::CPAN
use strict;
use base 'Class::Accessor::Fast';
use HTTP::Parser;
use HTTP::Request;
use HTTP::Response;
__PACKAGE__->mk_accessors('application');
sub configure_hook {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Engine/Stomp.pm view on Meta::CPAN
package Catalyst::Engine::Stomp;
use Moose;
use List::MoreUtils qw/ uniq /;
use HTTP::Request;
use Net::Stomp;
use MooseX::Types::Moose qw/Str Int HashRef/;
use namespace::autoclean;
use Encode;
lib/Catalyst/Engine/Stomp.pm view on Meta::CPAN
# set up request
my $config = $app->config->{'Engine::Stomp'};
my $url = 'stomp://'.$config->{hostname}.':'.$config->{port}.'/'.$controller;
my $request_headers = HTTP::Headers->new(%{$frame->headers});
my $req = HTTP::Request->new(POST => $url, $request_headers);
$req->content($frame->body);
$req->content_length(length $frame->body);
# dispatch
my $response;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Engine/XMPP2.pm view on Meta::CPAN
use warnings;
our $VERSION = '0.4';
use base qw(Catalyst::Engine::Embeddable);
use Event qw(loop);
use Encode;
use HTTP::Request;
use AnyEvent::XMPP::Connection;
use UNIVERSAL qw(isa);
__PACKAGE__->mk_accessors(qw( connections ));
lib/Catalyst/Engine/XMPP2.pm view on Meta::CPAN
$node->attr('type') eq 'error';
my $config = $app->config->{'Engine::XMPP2'};
my $url = 'xmpp://'.$config->{username}.'@'.$config->{domain}.'/'.$resource;
my $request = HTTP::Request->new(POST => $url);
$request->header('Content-type' => 'application/xml; charset=utf-8');
$request->header('XMPP_Stanza' => $type);
$request->header('XMPP_Resource' => $resource);
lib/Catalyst/Engine/XMPP2.pm view on Meta::CPAN
=back
=head1 SEE ALSO
L<Catalyst::Engine>, L<Catalyst::Engine::CGI>, L<HTTP::Request>,
L<HTTP::Reponse>, L<Catalyst>, L<AnyEvent::XMPP::Connection>,
L<Catalyst::Engine::Embeddable>
=head1 AUTHORS
view all matches for this distribution
view release on metacpan or search on metacpan
"DBIx::Class::ResultSet" : "0",
"DBIx::Class::Schema" : "0",
"File::Copy::Recursive" : "0",
"File::Path" : "0",
"File::Spec" : "0",
"HTTP::Request::Common" : "0",
"IO::Handle" : "0",
"IPC::Open3" : "0",
"JSON::XS" : "0",
"Test::Deep" : "0",
"Test::More" : "0",
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Manual/Cookbook.pod view on Meta::CPAN
=item An instance of L<URI>.
request( URI->new('http://www.host.com/my/path') );
=item An instance of L<HTTP::Request>.
request( HTTP::Request->new( GET => 'http://www.host.com/my/path') );
=back
C<request> returns an instance of L<HTTP::Response> and C<get> returns the
content (body) of the response.
lib/Catalyst/Manual/Cookbook.pod view on Meta::CPAN
=item * L<HTML::Form>
=item * L<HTTP::Message>
=item * L<HTTP::Request>
=item * L<HTTP::Request::Common>
=item * L<HTTP::Response>
=item * L<HTTP::Status>
view all matches for this distribution
view release on metacpan or search on metacpan
author:
- 'John Napiorkowski <jjnapiork@cpan.org>'
build_requires:
Catalyst: '5.90060'
Data::MuForm: '0'
HTTP::Request::Common: '0'
Moo: '2.003000'
Test::Most: '0'
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 0
view all matches for this distribution
view release on metacpan or search on metacpan
},
"test" : {
"requires" : {
"Catalyst::Test" : "0",
"HTML::FormHandler" : "0",
"HTTP::Request::Common" : "0",
"Scalar::Util" : "0",
"Test::Most" : "0.34"
}
}
},
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Catalyst/Test.pm view on Meta::CPAN
#line 224
sub local_request {
my $class = shift;
require HTTP::Request::AsCGI;
my $request = Catalyst::Utils::request( shift(@_) );
_customize_request($request, @_);
my $cgi = HTTP::Request::AsCGI->new( $request, %ENV )->setup;
$class->handle_request( env => \%ENV );
my $response = $cgi->restore->response;
$response->request( $request );
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-swish.t view on Meta::CPAN
use warnings;
use lib 't/MySWISH/lib';
use Test::More tests => 3;
use Data::Dump qw( dump );
use HTTP::Request::Common;
use File::Spec;
SKIP: {
eval { require SWISH::API::Object; };
view all matches for this distribution
view release on metacpan or search on metacpan
SKIP: {
skip "Environment variable ES_HOME not set", 16
unless defined $ENV{ES_HOME};
use Test::Exception;
use HTTP::Request::Common;
use Test::Requires {
'Search::Elasticsearch::TestServer' => 1.10,
'Search::Elasticsearch::Transport' => 1.10
};
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-client.t view on Meta::CPAN
is $res->code, 201;
my $entry2 = XML::Atom::Entry->new( \$res->content );
isa_ok $entry2, 'XML::Atom::Entry';
is $entry2->title, 'Bar';
sub req_get { HTTP::Request->new( GET => '/' ) }
sub req_post {
my $req = HTTP::Request->new( POST => '/' );
$req->content_type('application/x.atom+xml');
my $xml = $_[0];
$req->content_length(length $xml);
$req->content($xml);
$req;
view all matches for this distribution
view release on metacpan or search on metacpan
}
sub cookies {
my $res = shift;
my $request = HTTP::Request->new( GET => 'http://localhost/' );
$res->request($request);
my $jar = HTTP::Cookies->new();
$jar->extract_cookies($res);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Plugin/Authentication/Basic/Remote.pm view on Meta::CPAN
$c->log->debug("Authentication via ". $c->config->{authentication}->{auth_url} );
$c->log->debug("user: $username");
$c->log->debug("pass: $password");
my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new( HEAD => $c->config->{authentication}->{auth_url} );
$req->header( 'Authorization' => $c->req->header('Authorization') );
my $res = $ua->request($req);
if ( $res->code ne '401' ) {
view all matches for this distribution
view release on metacpan or search on metacpan
t/live_app.t view on Meta::CPAN
or plan skip_all =>
"Test::WWW::Mechanize::Catalyst is needed for this test";
plan tests => 5;
use_ok 'AuthTestApp' or die;
}
use HTTP::Request;
use Test::WWW::Mechanize::Catalyst qw/AuthTestApp/;
my $mech = Test::WWW::Mechanize::Catalyst->new;
$mech->get("http://localhost/moose");
is( $mech->status, 401, "status is 401" );
$mech->content_lacks( "foo", "no output" );
my $r = HTTP::Request->new( GET => "http://localhost/moose" );
$r->authorization_basic(qw/foo s3cr3t/);
$mech->request($r);
is( $mech->status, 200, "status is 200" );
$mech->content_contains( "foo", "foo output" );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Plugin/Authentication/Store/HTTP/User.pm view on Meta::CPAN
my ($self, $password) = @_;
my $ua =
Catalyst::Plugin::Authentication::Store::HTTP::UserAgent->new(
keep_alive => ($self->{keep_alive} ? 1 : 0));
my $req = HTTP::Request->new(HEAD => $self->{auth_url});
# set the credentials for the request.
# if there is a domain set then prepend this onto the user id
$ua->credentials(
($self->{domain} ? join("\\", $self->{domain}, $self->id) : $self->id),
view all matches for this distribution
view release on metacpan or search on metacpan
t/live_app_session.t view on Meta::CPAN
}
use lib 't/lib';
use Catalyst::Test qw/AuthSessionTestApp/;
use HTTP::Cookies;
use HTTP::Request::Common qw(GET);
my $jar = HTTP::Cookies->new;
sub _request {
my $url = shift;
$url =~ s{^/}{http://localhost/};
view all matches for this distribution
view release on metacpan or search on metacpan
"DBIx::Class::DateTime::Epoch" : "0",
"DBIx::Class::EncodedColumn" : "0",
"DBIx::Class::Schema" : "0",
"FindBin" : "0",
"HTML::FormFu" : "0",
"HTTP::Request::Common" : "0",
"Hash::Merge" : "0",
"Module::Install::Catalyst" : "0",
"Moose" : "0",
"MooseX::NonMoose" : "0",
"MooseX::Types::Path::Class" : "0",
view all matches for this distribution
view release on metacpan or search on metacpan
}
},
"test" : {
"requires" : {
"Catalyst::Test" : "0",
"HTTP::Request::Common" : "0",
"Test::Most" : "0"
}
}
},
"release_status" : "stable",
view all matches for this distribution
view release on metacpan or search on metacpan
Catalyst::Runtime: 0
DateTime::Format::HTTP: 0
Digest::MD5: 0
ExtUtils::MakeMaker: 6.59
FindBin: 0
HTTP::Request::Common: 0
Test::More: 0.88
Test::WWW::Mechanize::Catalyst: 0
URI: 0
ok: 0
configure_requires:
view all matches for this distribution
view release on metacpan or search on metacpan
Catalyst::Controller: '0'
Catalyst::Plugin::ConfigLoader: '0'
Catalyst::Runtime: '5.80'
Catalyst::Test: '0'
FindBin: '0'
HTTP::Request::Common: '0'
HTTP::Status: '0'
Test::More: '0'
lib: '0'
strict: '0'
warnings: '0'
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-clamscan.t view on Meta::CPAN
use FindBin;
use lib "$FindBin::Bin/lib";
use Test::More;
use Catalyst::Test 'TestApp';
use HTTP::Request::Common;
use Data::Dumper;
plan tests => 6;
my $no_scan;
view all matches for this distribution
view release on metacpan or search on metacpan
abstract: 'Compress response'
author:
- 'Yiyi Hu C<yiyihu@gmail.com>'
build_requires:
ExtUtils::MakeMaker: 6.36
HTTP::Request::Common: 0
configure_requires:
ExtUtils::MakeMaker: 6.36
distribution_type: module
dynamic_config: 1
generated_by: 'Module::Install version 1.14'
view all matches for this distribution