GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
HTTP::Engine::Request(3) User Contributed Perl Documentation HTTP::Engine::Request(3)

HTTP::Engine::Request - Portable HTTP request object

    # normally a request object is passed into your handler
    sub handle_request {
        my $req = shift;
   };

HTTP::Engine::Request provides a consistent API for request objects across web server enviroments.

    HTTP::Engine::Request->new(
        request_builder => $BUILDER,
        _connection => {
            env           => \%ENV,
            input_handle  => \*STDIN,
            output_handle => \*STDOUT,
        },
        %args
    );

Normally, new() is not called directly, but a pre-built HTTP::Engine::Request object is passed for you into your request handler. You may build your own, following the example above. The $BUILDER may be one of HTTP::Engine::RequestBuilder::CGI or HTTP::Engine::RequestBuilder::NoEnv.

configuration for control of HTTP::Engine::RequestBuilder.
$req->raw_body is not saved.

When receiving upload of a big file, it uses in order to prevent raw_body becoming large.

raw_body is enabled by the default. because of back compatibility.

  $req->upload('file1');
  is $req->raw_body, '...some contents...';
  $req->builder_options->{disable_raw_body} = 1;
  $req->upload('file2');
  is $req->raw_body, '';
  $req->builder_options->{disable_raw_body} = 0;
  $req->upload('file1');
  is $req->raw_body, '...some contents...';
    
change temporarily directory to store upload file. It changes of default temporarily directory by HTTP::Body.

generally use File::Temp.

  $req->builder_options->{upload_tmp} = File::Temp->newdir;
    

for lazy make directory

  $req->builder_options->{upload_tmp} = sub { File::Temp->newdir };
    

In these examples, if request processing finishes, upload files will be deleted.

Returns the IP address of the client.
Returns a reference to a hash containing the cookies
Contains the request method ("GET", "POST", "HEAD", etc).
Returns the protocol (HTTP/1.0 or HTTP/1.1) used for the current request.
Returns the request uri (like $ENV{REQUEST_URI})
Returns a reference to a hash containing query string (GET) parameters. Values can be either a scalar or an arrayref containing scalars.
Returns true or false, indicating whether the connection is secure (https).
Returns undef or uri, if it is proxy request, uri of a connection place is returned.
Returns a URI object for the current request. Stringifies to the URI text.
Returns REMOTE_USER.
Returns string containing body(POST).
Returns an HTTP::Headers object containing the headers for the current request.
Contains the URI base. This will always have a trailing slash.
Returns the hostname of the client.
Returns an HTTP::Body object.
Returns a reference to a hash containing GET and POST parameters. Values can be either a scalar or an arrayref containing scalars.
Returns a reference to a hash containing uploads. Values can be either a HTTP::Engine::Request::Upload object, or an arrayref of HTTP::Engine::Request::Upload objects.
Shortcut to $req->headers->content_encoding.
Shortcut to $req->headers->content_length.
Shortcut to $req->headers->content_type.
Shortcut to $req->headers->header.
Shortcut to $req->headers->referer.
Shortcut to $req->headers->user_agent.
A convenient method to access $req->cookies.

    $cookie  = $req->cookie('name');
    @cookies = $req->cookie;
    
Returns GET and POST parameters with a CGI.pm-compatible param method. This is an alternative method for accessing parameters in $req->parameters.

    $value  = $req->param( 'foo' );
    @values = $req->param( 'foo' );
    @params = $req->param;
    

Like CGI, and unlike earlier versions of Catalyst, passing multiple arguments to this method, like this:

    $req->param( 'foo', 'bar', 'gorch', 'quxx' );
    

will set the parameter "foo" to the multiple values "bar", "gorch" and "quxx". Previously this would have added "bar" as another value to "foo" (creating it if it didn't exist before), and "quxx" as another value for "gorch".

Returns the path, i.e. the part of the URI after $req->base, for the current request.
A convenient method to access $req->uploads.

    $upload  = $req->upload('field');
    @uploads = $req->upload('field');
    @fields  = $req->upload;
    for my $upload ( $req->upload('field') ) {
        print $upload->filename;
    }
    
Returns a rewritten URI object for the current request. Key/value pairs passed in will override existing parameters. Unmodified pairs will be preserved.
convert HTTP::Engine::Request to HTTP::Request.
$req->absolute_url($location)
convert $location to absolute uri.

Kazuhiro Osawa and HTTP::Engine Authors.

Catalyst::Request

HTTP::Request, Catalyst::Request

2011-10-04 perl v5.40.2

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.