Feersum

 view release on metacpan or  search on metacpan

lib/Feersum/Connection.pm  view on Meta::CPAN


=item C<< my $w = $req->start_streaming($code, \@headers) >>

A full HTTP header section is sent with "Transfer-Encoding: chunked" (or
"Connection: close" for HTTP/1.0 clients).  

Returns a C<Feersum::Connection::Writer> handle which should be used to
complete the response.  See L<Feersum::Connection::Handle> for methods.

=item C<< $req->send_response($code, \@headers, $body) >>

=item C<< $req->send_response($code, \@headers, \@body) >>

Respond with a full HTTP header (including C<Content-Length>) and body.

Returns the number of bytes calculated for the body.

=item C<< $req->force_http10 >>

=item C<< $req->force_http11 >>

Force the response to use HTTP/1.0 or HTTP/1.1, respectively.

Normally, if the request was made with 1.1 then Feersum uses HTTP/1.1 for the
response, otherwise HTTP/1.0 is used (this includes requests made with the
HTTP "0.9" non-declaration).

For streaming under HTTP/1.1 C<Transfer-Encoding: chunked> is used, otherwise
a C<Connection: close> stream-style is used (with the usual non-guarantees
about delivery).  You may know about certain user-agents that
support/don't-support T-E:chunked, so this is how you can override that.

Supposedly clients and a lot of proxies support the C<Connection: close>
stream-style, see support in Varnish at
http://www.varnish-cache.org/trac/ticket/400

=item C<< $req->fileno >>

The socket file-descriptor number for this connection.

=item C<< $req->response_guard($guard) >>

Register a guard to be triggered when the response is completely sent and the
socket is closed.  A "guard" in this context is some object that will do
something interesting in its DESTROY/DEMOLISH method. For example, L<Guard>.

=item C<< my $env = $req->method >>

req method (GET/POST..) (psgi REQUEST_METHOD)

=item C<< my $env = $req->uri >>

full request uri (psgi REQUEST_URI)

=item C<< my $env = $req->protocol >>

protocol (psgi SERVER_PROTOCOL)

=item C<< my $env = $req->path >>

percent decoded request path (psgi PATH_INFO)

=item C<< my $env = $req->query >>

request query (psgi QUERY_STRING)

=item C<< my $env = $req->content_length >>

body content lenght (psgi CONTENT_LENGTH)

=item C<< my $env = $req->input >>

input body handler (psgi.input), it is advised to close it after read is done

=item C<< my $env = $req->headers([normalization_style]) >>

an array of headers if form of [name, value, name, value, ...]

normalization_style is one of:

0 - skip normalization (default)
HEADER_NORM_LOCASE - "content-type"
HEADER_NORM_UPCASE - "CONTENT-TYPE"
HEADER_NORM_LOCASE_DASH - "content_type"
HEADER_NORM_UPCASE_DASH - "CONTENT_TYPE" (like PSGI, but without "HTTP_" prefix)

One can export these constants via c<<use Feersum 'HEADER_NORM_LOCASE'>>

=item C<< my $value = $req->header(name) >>

simple lookup for header value, name should be in lowercase, eg. 'content-type'

=item C<< my $env = $req->remote_address >>

remote address (psgi REMOTE_ADDR)

=item C<< my $env = $req->remote_port >>

remote port (psgi REMOTE_PORT)

=back

=begin comment

=head2 Private and or Deprecated Methods

=over 4

=item C<< new() >>

No-op. Feersum will create these objects internally.

=item C<< $req->read_handle >>

use psgi.input instead

=item C<< $req->write_handle >>

=item C<< $req->start_response(...) >>

use start_streaming() or start_whole_response() instead



( run in 2.588 seconds using v1.01-cache-2.11-cpan-f56aa216473 )