File: env.psgi

package info (click to toggle)
libnet-async-fastcgi-perl 0.26-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 284 kB
  • sloc: perl: 2,308; makefile: 2
file content (22 lines) | stat: -rw-r--r-- 522 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/perl

use strict;

sub {
   my $env = shift;

   my $input = "";
   while( $env->{"psgi.input"}->read( my $buffer, 8192 ) ) {
      $input .= $buffer;
   }

   return [
      '200',
      [ 'Content-Type' => 'text/plain' ],
      [ "The method was $env->{REQUEST_METHOD}\n",
        "The path was $env->{PATH_INFO}\n",
        "The query string was $env->{QUERY_STRING}\n",
        "The body was ".length($input)." bytes\n\n" . 
        join("", map { "  \$ENV{$_} = $env->{$_}\n" } sort keys %$env) ],
   ];
}